Sidebar
3 variantsProduction workspace compositions built with beUI's compound animated sidebar, including responsive drawers, live navigation search, compact and off-canvas collapse modes, and accessible focus handling.
Rail sidebar
A persistent icon rail with a collapsible second panel. Hover to reveal navigation over the workspace, or keep it expanded beside your content.
"use client";
import { FileText } from "lucide-react";
import { useState } from "react";
import { SidebarRail } from "@/components/premium/sidebar-blocks/sidebar-rail";
export function SidebarRailPreview() {
const [title, setTitle] = useState("Launch direction");
return (
<SidebarRail
onItemSelect={(item) => setTitle(item.label)}
onCreate={() => setTitle("Untitled page")}
workspaceHeader={<p className="truncate text-sm font-medium">{title}</p>}
>
<div className="mx-auto flex h-full max-w-xl flex-col justify-center pb-12">
<div className="mb-6 flex items-center gap-2 text-xs text-muted-foreground">
<FileText aria-hidden="true" className="size-4" />
Private page
</div>
<h1 className="text-4xl font-medium tracking-tight">{title}</h1>
<p className="mt-4 max-w-md text-sm leading-6 text-muted-foreground">
A place for the early thoughts, useful references, and small decisions
that move the work forward.
</p>
<div className="mt-9 divide-y divide-border rounded-2xl border border-border bg-background px-5">
{[
[
"01",
"Find the starting point",
"Bring the notes and references together.",
],
[
"02",
"Make room for the good ideas",
"Keep the next step clear and close.",
],
[
"03",
"Share when it feels ready",
"A little progress is still progress.",
],
].map(([number, heading, description]) => (
<div key={number} className="flex gap-4 py-5">
<span className="pt-0.5 font-mono text-xs text-muted-foreground">
{number}
</span>
<div>
<p className="text-sm font-medium">{heading}</p>
<p className="mt-1 text-xs leading-5 text-muted-foreground">
{description}
</p>
</div>
</div>
))}
</div>
</div>
</SidebarRail>
);
}
Source code is locked
Get access to install premium components and view the full source.
Open dashboardInstall
API Reference
Every prop is optional unless marked required. Data, copy, and colors default to the sample content.
SidebarRail14 props
workspaceNameWorkspace name in the panel title and breadcrumbs.
stringsectionsRail sections and their page groups. Defaults to the sample sections.
readonly SidebarRailSection[]defaultExpandedStarts with the panel pinned open when true.
booleanDefault
trueexpandedWhether the panel is pinned open, when controlled.
booleanonExpandedChangeCalled with the new value when the panel is pinned or collapsed.
((expanded: boolean) => void)defaultItemIdId of the page selected at first; only read on mount.
stringonItemSelectCalled with the page and its section when the user selects a page.
((item: SidebarRailItem, section: SidebarRailSection) => void)onCreateCalled when the user clicks the New page button.
(() => void)accountUser shown as initials at the bottom of the rail.
{ name: string; initials: string; }onAccountClickCalled when the user clicks the account button in the rail.
(() => void)panelHeaderReplaces the panel title; search and collapse controls stay built in. Pass null to hide it.
ReactNoderailFooterReplaces the account control at the bottom of the icon rail. Pass null to hide it.
ReactNodeworkspaceHeaderReplaces the workspace breadcrumbs; the navigation toggle stays built in. Pass null to hide them.
ReactNodeclassNameClasses merged onto the root element.
string
Types2 types
The object types these props take, field by field.
SidebarRailItem3 fields
idRequiredUnique id used to track the selected page.
stringlabelRequiredPage name shown in the panel and matched by search.
stringiconOptional Lucide icon shown before the label.
LucideIcon
SidebarRailSection4 fields
idRequiredUnique id for the rail section.
stringlabelRequiredSection name shown as the rail tooltip and panel title.
stringiconRequiredLucide icon shown on the rail button.
LucideIcongroupsRequiredLabeled groups of pages listed in the panel for this section.
readonly { label: string; items: readonly SidebarRailItem[]; }[]
Workspace sidebar
A sharp operations sidebar composed from beUI's provider, panel, group, menu, submenu, and inset primitives, with searchable navigation, live badges, mobile focus trapping, and a dashboard workspace.
"use client";
import { SidebarWorkspace } from "@/components/premium/sidebar-blocks";
export function SidebarWorkspacePreview() {
return <SidebarWorkspace />;
}
Source code is locked
Get access to install premium components and view the full source.
Open dashboardInstall
API Reference
Every prop is optional unless marked required. Data, copy, and colors default to the sample content.
SidebarWorkspace5 props
workspaceNameWorkspace selected at first; only read on mount.
stringDefault
Northstar AIworkspacesWorkspaces listed in the switcher, after the initial one.
readonly string[]Default
["Northstar AI", "Acme Studio", "Orbit Labs"]onWorkspaceChangeCalled with the workspace name when the user switches workspace.
((workspace: string) => void)accountSigned-in user shown in the sidebar footer.
{ name: string; email: string; initials: string; }classNameClasses merged onto the root element.
string
Off-canvas sidebar
A flat workspace sidebar with searchable navigation, an animated workspace switcher, and a full off-canvas collapse that removes labels and icons together.
"use client";
import { SidebarOffcanvas } from "@/components/premium/sidebar-blocks";
export function SidebarOffcanvasPreview() {
return <SidebarOffcanvas />;
}
Source code is locked
Get access to install premium components and view the full source.
Open dashboardInstall
API Reference
Every prop is optional unless marked required. Data, copy, and colors default to the sample content.
SidebarOffcanvas9 props
workspaceNameWorkspace selected at first; only read on mount.
stringDefault
Northstar AIworkspacesWorkspaces listed in the switcher, after the initial one.
readonly string[]Default
["Northstar AI", "Acme Studio", "Orbit Labs"]onWorkspaceChangeCalled with the workspace name when the user switches workspace.
((workspace: string) => void)navigationItemsSidebar links, also searchable. Defaults to the sample nav items.
readonly SidebarOffcanvasNavigationItem[]activeItemLabel of the active item when controlled.
stringdefaultActiveItemLabel of the item active at first when uncontrolled.
stringDefault
InboxonNavigateCalled with the item when the user picks it from the list or search.
((item: SidebarOffcanvasNavigationItem) => void)accountSigned-in user shown in the sidebar footer.
{ name: string; email: string; initials: string; }classNameClasses merged onto the root element.
string
Types1 type
The object types these props take, field by field.
SidebarOffcanvasNavigationItem4 fields
labelRequiredItem text; also its id for the active item and search.
stringiconRequiredLucide icon shown before the label and in search results.
LucideIconkeywordsExtra search terms that match this item.
readonly string[]badgeSmall count or tag shown at the end of the row.
string