Shows app navigation that collapses to an icon rail.
Overview
Revenue this month
$48,210
+12.4% from August
Latest orders
- Olivia Martin#3210$1,999
- Jackson Lee#3209$39
- Isabella Nguyen#3208$299
"use client";
import {
ChartLineUpIcon,
HouseIcon,
PackageIcon,
ReceiptIcon,
UsersIcon,
} from "@phosphor-icons/react";
import { useState } from "react";
import { RouterProvider } from "react-aria-components";
import {
Sidebar,
SidebarContent,
SidebarGroup,
SidebarHeader,
SidebarInset,
SidebarItem,
SidebarMenu,
SidebarProvider,
SidebarTrigger,
} from "@/components/vip-ui/sidebar";
const navigation = [
{ label: "Overview", href: "#overview", icon: HouseIcon },
{ label: "Orders", href: "#orders", icon: ReceiptIcon },
{ label: "Customers", href: "#customers", icon: UsersIcon },
{ label: "Products", href: "#products", icon: PackageIcon },
{ label: "Reports", href: "#reports", icon: ChartLineUpIcon },
];
const orders = [
{ id: "#3210", customer: "Olivia Martin", total: "$1,999" },
{ id: "#3209", customer: "Jackson Lee", total: "$39" },
{ id: "#3208", customer: "Isabella Nguyen", total: "$299" },
];
export function SidebarDemo() {
const [current, setCurrent] = useState("#overview");
return (
<div className="h-[32rem] w-full max-w-[48rem] overflow-hidden rounded-xl ring-1 ring-border/70">
<RouterProvider navigate={setCurrent}>
<SidebarProvider className="h-full" shortcut={false}>
<Sidebar className="h-full">
<SidebarHeader>
<div className="flex items-center gap-2.5">
<span
aria-hidden="true"
className="grid size-8 shrink-0 place-items-center rounded-lg bg-primary text-sm font-bold text-primary-foreground"
>
A
</span>
<div className="min-w-0">
<p className="truncate text-sm font-semibold">Acme Store</p>
<p className="truncate text-xs text-muted-foreground">
Pro plan
</p>
</div>
</div>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarMenu aria-label="Store">
{navigation.map((item) => (
<SidebarItem
key={item.label}
href={item.href}
icon={<item.icon aria-hidden="true" />}
isCurrent={item.href === current}
>
{item.label}
</SidebarItem>
))}
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
</Sidebar>
<SidebarInset>
<header className="flex h-14 items-center gap-2 border-b border-border/70 px-3">
<SidebarTrigger />
<p className="text-sm font-medium">
{navigation.find((item) => item.href === current)?.label}
</p>
</header>
<div className="grid gap-3 p-4">
<div className="grid gap-1">
<p className="text-xs text-muted-foreground">
Revenue this month
</p>
<p className="text-2xl font-semibold tabular-nums">$48,210</p>
<p className="text-xs text-success-foreground">
+12.4% from August
</p>
</div>
<div className="overflow-hidden rounded-lg bg-card ring-1 ring-border/70">
<p className="border-b border-border/70 px-3 py-2 text-xs font-medium text-muted-foreground">
Latest orders
</p>
<ul className="divide-y divide-border/70">
{orders.map((order) => (
<li
key={order.id}
className="flex items-center gap-3 px-3 py-2 text-sm"
>
<span className="min-w-0 flex-1 truncate">
{order.customer}
</span>
<span className="font-mono text-xs text-muted-foreground">
{order.id}
</span>
<span className="tabular-nums">{order.total}</span>
</li>
))}
</ul>
</div>
</div>
</SidebarInset>
</SidebarProvider>
</RouterProvider>
</div>
);
}The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.
pnpm dlx shadcn@latest add https://vip-ui.dev/r/sidebar.jsonimport { HouseIcon, ReceiptIcon } from "@phosphor-icons/react";
import {
Sidebar,
SidebarContent,
SidebarGroup,
SidebarInset,
SidebarItem,
SidebarMenu,
SidebarProvider,
SidebarTrigger,
} from "@/components/vip-ui/sidebar";
export function AppShell() {
return (
<SidebarProvider>
<Sidebar>
<SidebarContent>
<SidebarGroup>
<SidebarMenu aria-label="Main">
<SidebarItem
href="/"
icon={<HouseIcon aria-hidden="true" />}
isCurrent
>
Overview
</SidebarItem>
<SidebarItem
href="/orders"
icon={<ReceiptIcon aria-hidden="true" />}
>
Orders
</SidebarItem>
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
</Sidebar>
<SidebarInset>
<SidebarTrigger />
</SidebarInset>
</SidebarProvider>
);
}SidebarProviderOwns the collapsed state and the sheet state.
SidebarSidebarHeaderOptionalSidebarContentSidebarGroupRepeatsSidebarGroupLabelOptionalSidebarMenuSidebarItemRepeats
SidebarFooterOptional
SidebarInsetSidebarTriggerPut it in the inset header so it stays visible in the rail and on phones.
useSidebar Returns isOpen, setOpen, toggle, isMobileOpen, setMobileOpen, and state for a custom trigger.
Set defaultOpen to false to start as a rail.
Projects
Studio North
Maya Chen
Due Oct 18
Atlas
Sam Rivera
Due Oct 24
Field Notes
Jo Park
Due Nov 2
Signal
Maya Chen
Due Nov 9
"use client";
import {
FolderIcon,
SquaresFourIcon,
UsersThreeIcon,
WalletIcon,
WrenchIcon,
} from "@phosphor-icons/react";
import { useState } from "react";
import { RouterProvider } from "react-aria-components";
import {
Sidebar,
SidebarContent,
SidebarGroup,
SidebarHeader,
SidebarInset,
SidebarItem,
SidebarMenu,
SidebarProvider,
SidebarTrigger,
} from "@/components/vip-ui/sidebar";
const navigation = [
{ label: "Projects", href: "#projects", icon: SquaresFourIcon },
{ label: "Files", href: "#files", icon: FolderIcon },
{ label: "Clients", href: "#clients", icon: UsersThreeIcon },
{ label: "Invoices", href: "#invoices", icon: WalletIcon },
{ label: "Workshop", href: "#workshop", icon: WrenchIcon },
];
const projects = [
{ name: "Studio North", owner: "Maya Chen", due: "Oct 18" },
{ name: "Atlas", owner: "Sam Rivera", due: "Oct 24" },
{ name: "Field Notes", owner: "Jo Park", due: "Nov 2" },
{ name: "Signal", owner: "Maya Chen", due: "Nov 9" },
];
export function SidebarRailDemo() {
const [current, setCurrent] = useState("#projects");
return (
<div className="h-[32rem] w-full max-w-[48rem] overflow-hidden rounded-xl ring-1 ring-border/70">
<RouterProvider navigate={setCurrent}>
<SidebarProvider
defaultOpen={false}
shortcut={false}
className="h-full"
>
<Sidebar className="h-full">
<SidebarHeader>
<div className="flex items-center gap-2.5">
<span
aria-hidden="true"
className="grid size-8 shrink-0 place-items-center rounded-lg bg-primary text-sm font-bold text-primary-foreground"
>
N
</span>
<div className="min-w-0">
<p className="truncate text-sm font-semibold">
Northwind Studio
</p>
<p className="truncate text-xs text-muted-foreground">
Design team
</p>
</div>
</div>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarMenu aria-label="Workspace">
{navigation.map((item) => (
<SidebarItem
key={item.label}
href={item.href}
icon={<item.icon aria-hidden="true" />}
isCurrent={item.href === current}
>
{item.label}
</SidebarItem>
))}
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
</Sidebar>
<SidebarInset>
<header className="flex h-14 items-center gap-2 border-b border-border/70 px-3">
<SidebarTrigger />
<p className="text-sm font-medium">
{navigation.find((item) => item.href === current)?.label}
</p>
</header>
<div className="grid gap-3 p-4 sm:grid-cols-2">
{projects.map((project) => (
<div
key={project.name}
className="grid gap-1 rounded-lg bg-card p-3 ring-1 ring-border/70"
>
<p className="text-sm font-medium">{project.name}</p>
<p className="text-xs text-muted-foreground">
{project.owner}
</p>
<p className="text-xs tabular-nums text-muted-foreground">
Due {project.due}
</p>
</div>
))}
</div>
</SidebarInset>
</SidebarProvider>
</RouterProvider>
</div>
);
}Also install Badge.
Overview
Today
- 12 orders need a shipping label
- 3 payouts are due on Friday
- 2 customers asked about the return policy
"use client";
import {
ChartLineUpIcon,
CreditCardIcon,
HouseIcon,
ReceiptIcon,
UsersIcon,
UsersThreeIcon,
} from "@phosphor-icons/react";
import { useState } from "react";
import { RouterProvider } from "react-aria-components";
import { Badge } from "@/components/vip-ui/badge";
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupLabel,
SidebarHeader,
SidebarInset,
SidebarItem,
SidebarMenu,
SidebarProvider,
SidebarTrigger,
} from "@/components/vip-ui/sidebar";
const sections = [
{
label: "Store",
items: [
{ label: "Overview", href: "#overview", icon: HouseIcon },
{
label: "Orders",
href: "#orders",
icon: ReceiptIcon,
badge: (
<Badge>
12<span className="sr-only"> new</span>
</Badge>
),
},
{ label: "Customers", href: "#customers", icon: UsersIcon },
],
},
{
label: "Reports",
items: [
{ label: "Revenue", href: "#revenue", icon: ChartLineUpIcon },
{
label: "Payouts",
href: "#payouts",
icon: CreditCardIcon,
badge: <Badge variant="warning">Due</Badge>,
},
],
},
{
label: "Settings",
items: [
{
label: "Team",
href: "#team",
icon: UsersThreeIcon,
badge: <Badge>3</Badge>,
},
],
},
];
export function SidebarSectionsDemo() {
const [current, setCurrent] = useState("#overview");
const title = sections
.flatMap((section) => section.items)
.find((item) => item.href === current)?.label;
return (
<div className="h-[32rem] w-full max-w-[48rem] overflow-hidden rounded-xl ring-1 ring-border/70">
<RouterProvider navigate={setCurrent}>
<SidebarProvider className="h-full" shortcut={false}>
<Sidebar className="h-full">
<SidebarHeader>
<div className="flex items-center gap-2.5">
<span
aria-hidden="true"
className="grid size-8 shrink-0 place-items-center rounded-lg bg-primary text-sm font-bold text-primary-foreground"
>
A
</span>
<div className="min-w-0">
<p className="truncate text-sm font-semibold">Acme Store</p>
<p className="truncate text-xs text-muted-foreground">
Pro plan
</p>
</div>
</div>
</SidebarHeader>
<SidebarContent>
{sections.map((section) => (
<SidebarGroup key={section.label}>
<SidebarGroupLabel>{section.label}</SidebarGroupLabel>
<SidebarMenu aria-label={section.label}>
{section.items.map((item) => (
<SidebarItem
key={item.label}
href={item.href}
icon={<item.icon aria-hidden="true" />}
badge={item.badge}
isCurrent={item.href === current}
>
{item.label}
</SidebarItem>
))}
</SidebarMenu>
</SidebarGroup>
))}
</SidebarContent>
<SidebarFooter>
<p className="px-2.75 text-xs leading-5 text-muted-foreground">
Signed in as maya@acme.store
</p>
</SidebarFooter>
</Sidebar>
<SidebarInset>
<header className="flex h-14 items-center gap-2 border-b border-border/70 px-3">
<SidebarTrigger />
<p className="text-sm font-medium">{title}</p>
</header>
<div className="grid gap-3 p-4">
<p className="text-xs font-medium text-muted-foreground">Today</p>
<ul className="grid gap-2">
{[
"12 orders need a shipping label",
"3 payouts are due on Friday",
"2 customers asked about the return policy",
].map((item) => (
<li
key={item}
className="rounded-lg bg-card px-3 py-2.5 text-sm ring-1 ring-border/70"
>
{item}
</li>
))}
</ul>
</div>
</SidebarInset>
</SidebarProvider>
</RouterProvider>
</div>
);
}Below 48rem of container width, the sidebar opens in a sheet.
Overview
Olivia Martin
#3210 · $1,999
Jackson Lee
#3209 · $39
Isabella Nguyen
#3208 · $299
"use client";
import {
ChartLineUpIcon,
HouseIcon,
PackageIcon,
ReceiptIcon,
UsersIcon,
} from "@phosphor-icons/react";
import { useState } from "react";
import { RouterProvider } from "react-aria-components";
import {
Sidebar,
SidebarContent,
SidebarGroup,
SidebarHeader,
SidebarInset,
SidebarItem,
SidebarMenu,
SidebarProvider,
SidebarTrigger,
} from "@/components/vip-ui/sidebar";
const navigation = [
{ label: "Overview", href: "#overview", icon: HouseIcon },
{ label: "Orders", href: "#orders", icon: ReceiptIcon },
{ label: "Customers", href: "#customers", icon: UsersIcon },
{ label: "Products", href: "#products", icon: PackageIcon },
{ label: "Reports", href: "#reports", icon: ChartLineUpIcon },
];
export function SidebarMobileDemo() {
const [current, setCurrent] = useState("#overview");
return (
<div className="w-full overflow-x-auto">
<div className="h-[32rem] w-[360px] max-w-full overflow-hidden rounded-xl ring-1 ring-border/70">
<RouterProvider navigate={setCurrent}>
<SidebarProvider className="h-full" shortcut={false}>
<Sidebar className="h-full">
<SidebarHeader>
<div className="flex items-center gap-2.5">
<span
aria-hidden="true"
className="grid size-8 shrink-0 place-items-center rounded-lg bg-primary text-sm font-bold text-primary-foreground"
>
A
</span>
<div className="min-w-0">
<p className="truncate text-sm font-semibold">Acme Store</p>
<p className="truncate text-xs text-muted-foreground">
Pro plan
</p>
</div>
</div>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarMenu aria-label="Store">
{navigation.map((item) => (
<SidebarItem
key={item.label}
href={item.href}
icon={<item.icon aria-hidden="true" />}
isCurrent={item.href === current}
>
{item.label}
</SidebarItem>
))}
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
</Sidebar>
<SidebarInset>
<header className="flex h-14 items-center gap-2 border-b border-border/70 px-3">
<SidebarTrigger />
<p className="text-sm font-medium">
{navigation.find((item) => item.href === current)?.label}
</p>
</header>
<div className="grid gap-2 p-4">
{[
{ id: "#3210", customer: "Olivia Martin", total: "$1,999" },
{ id: "#3209", customer: "Jackson Lee", total: "$39" },
{ id: "#3208", customer: "Isabella Nguyen", total: "$299" },
].map((order) => (
<div
key={order.id}
className="rounded-lg bg-card px-3 py-2.5 ring-1 ring-border/70"
>
<p className="text-sm font-medium">{order.customer}</p>
<p className="text-xs text-muted-foreground tabular-nums">
{order.id} · {order.total}
</p>
</div>
))}
</div>
</SidebarInset>
</SidebarProvider>
</RouterProvider>
</div>
</div>
);
}Also install Button and Progress bar.
Storage
6.8 GB of 10 GB is in use. Receipts and product photos take the most space.
Largest folders
Product photos · 3.4 GB
Receipts · 1.8 GB
Exports · 900 MB
"use client";
import {
ChartLineUpIcon,
GearSixIcon,
HouseIcon,
ReceiptIcon,
SidebarSimpleIcon,
UsersIcon,
} from "@phosphor-icons/react";
import { useState } from "react";
import { RouterProvider } from "react-aria-components";
import { Button } from "@/components/vip-ui/button";
import { ProgressBar } from "@/components/vip-ui/progress-bar";
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarHeader,
SidebarInset,
SidebarItem,
SidebarMenu,
SidebarProvider,
SidebarTrigger,
useSidebar,
} from "@/components/vip-ui/sidebar";
const navigation = [
{ label: "Overview", href: "#overview", icon: HouseIcon },
{ label: "Orders", href: "#orders", icon: ReceiptIcon },
{ label: "Customers", href: "#customers", icon: UsersIcon },
{ label: "Reports", href: "#reports", icon: ChartLineUpIcon },
{ label: "Settings", href: "#settings", icon: GearSixIcon },
];
function StorageCard() {
const { toggle } = useSidebar();
return (
<div className="rounded-lg bg-muted/60 p-3 ring-1 ring-border/70">
<ProgressBar
label="Storage"
value={68}
valueLabel="6.8 of 10 GB"
className="gap-1.5 **:data-[slot=progress-bar-label]:text-xs **:data-[slot=progress-bar-value]:text-xs"
/>
<p className="mt-2 text-xs leading-5 text-muted-foreground">
Upgrade to get 100 GB for receipts and product photos.
</p>
<div className="mt-1 flex items-center justify-between gap-2">
<Button variant="minimal" size="xs" className="-ms-2.5">
Upgrade plan
</Button>
<Button
variant="minimal"
size="xs"
iconOnly
aria-label="Collapse sidebar"
onPress={toggle}
>
<SidebarSimpleIcon aria-hidden="true" />
</Button>
</div>
</div>
);
}
export function SidebarFooterDemo() {
const [current, setCurrent] = useState("#overview");
return (
<div className="h-[32rem] w-full max-w-[48rem] overflow-hidden rounded-xl ring-1 ring-border/70">
<RouterProvider navigate={setCurrent}>
<SidebarProvider className="h-full" shortcut={false}>
<Sidebar className="h-full">
<SidebarHeader>
<div className="flex items-center gap-2.5">
<span
aria-hidden="true"
className="grid size-8 shrink-0 place-items-center rounded-lg bg-primary text-sm font-bold text-primary-foreground"
>
A
</span>
<div className="min-w-0">
<p className="truncate text-sm font-semibold">Acme Store</p>
<p className="truncate text-xs text-muted-foreground">
Pro plan
</p>
</div>
</div>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarMenu aria-label="Store">
{navigation.map((item) => (
<SidebarItem
key={item.label}
href={item.href}
icon={<item.icon aria-hidden="true" />}
isCurrent={item.href === current}
>
{item.label}
</SidebarItem>
))}
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
<SidebarFooter>
<StorageCard />
</SidebarFooter>
</Sidebar>
<SidebarInset>
<header className="flex h-14 items-center gap-2 border-b border-border/70 px-3">
<SidebarTrigger />
<p className="text-sm font-medium">Storage</p>
</header>
<div className="grid content-start gap-3 p-4">
<p className="text-sm text-muted-foreground">
6.8 GB of 10 GB is in use. Receipts and product photos take the
most space.
</p>
<div className="grid gap-2 rounded-lg bg-card p-3 text-sm ring-1 ring-border/70">
<p className="font-medium">Largest folders</p>
<p className="text-muted-foreground">Product photos · 3.4 GB</p>
<p className="text-muted-foreground">Receipts · 1.8 GB</p>
<p className="text-muted-foreground">Exports · 900 MB</p>
</div>
</div>
</SidebarInset>
</SidebarProvider>
</RouterProvider>
</div>
);
}Mod+B toggles the sidebar. Set shortcut to false to turn it off. Also install Kbd & code.
Recent orders
"use client";
import {
HouseIcon,
MagnifyingGlassIcon,
ReceiptIcon,
UsersIcon,
} from "@phosphor-icons/react";
import { useState, useSyncExternalStore } from "react";
import { RouterProvider } from "react-aria-components";
import { Kbd, KbdGroup } from "@/components/vip-ui/kbd-code";
import {
Sidebar,
SidebarContent,
SidebarGroup,
SidebarHeader,
SidebarInset,
SidebarItem,
SidebarMenu,
SidebarProvider,
SidebarTrigger,
} from "@/components/vip-ui/sidebar";
const navigation = [
{ label: "Overview", href: "#overview", icon: HouseIcon },
{ label: "Orders", href: "#orders", icon: ReceiptIcon },
{ label: "Customers", href: "#customers", icon: UsersIcon },
];
const subscribe = () => () => {};
export function SidebarShortcutDemo() {
const [current, setCurrent] = useState("#overview");
const isMac = useSyncExternalStore(
subscribe,
() => /Mac|iPhone|iPad/.test(navigator.platform),
() => false,
);
return (
<div className="h-[32rem] w-full max-w-[48rem] overflow-hidden rounded-xl ring-1 ring-border/70">
<RouterProvider navigate={setCurrent}>
<SidebarProvider className="h-full">
<Sidebar className="h-full">
<SidebarHeader>
<div className="flex items-center gap-2.5">
<span
aria-hidden="true"
className="grid size-8 shrink-0 place-items-center rounded-lg bg-primary text-sm font-bold text-primary-foreground"
>
A
</span>
<div className="min-w-0">
<p className="truncate text-sm font-semibold">Acme Store</p>
<p className="truncate text-xs text-muted-foreground">
Pro plan
</p>
</div>
</div>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarMenu aria-label="Store">
{navigation.map((item) => (
<SidebarItem
key={item.label}
href={item.href}
icon={<item.icon aria-hidden="true" />}
isCurrent={item.href === current}
>
{item.label}
</SidebarItem>
))}
</SidebarMenu>
</SidebarGroup>
</SidebarContent>
</Sidebar>
<SidebarInset>
<header className="flex h-14 items-center gap-2 border-b border-border/70 px-3">
<SidebarTrigger />
<KbdGroup>
<Kbd>{isMac ? "⌘" : "Ctrl"}</Kbd>
<Kbd>B</Kbd>
</KbdGroup>
<div className="relative ms-auto w-full max-w-56 min-w-0">
<MagnifyingGlassIcon
aria-hidden="true"
className="pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"
/>
<input
type="search"
aria-label="Search orders"
placeholder="Search orders"
className="h-9 w-full rounded-md border border-border bg-card ps-8 pe-3 text-sm outline-none transition-[border-color,box-shadow] duration-150 ease-out-quint placeholder:text-muted-foreground focus:border-ring focus:ring-1 focus:ring-ring"
/>
</div>
</header>
<div className="grid content-start gap-3 p-4">
<p className="text-xs font-medium text-muted-foreground">
Recent orders
</p>
{[
{ id: "#3210", customer: "Olivia Martin", total: "$1,999" },
{ id: "#3209", customer: "Jackson Lee", total: "$39" },
{ id: "#3208", customer: "Isabella Nguyen", total: "$299" },
].map((order) => (
<div
key={order.id}
className="flex items-center gap-3 rounded-lg bg-card px-3 py-2.5 text-sm ring-1 ring-border/70"
>
<span className="min-w-0 flex-1 truncate">
{order.customer}
</span>
<span className="font-mono text-xs text-muted-foreground">
{order.id}
</span>
<span className="tabular-nums">{order.total}</span>
</div>
))}
</div>
</SidebarInset>
</SidebarProvider>
</RouterProvider>
</div>
);
}SidebarProvider
Lays out the sidebar and the page area, and owns the collapsed state and the sheet state.
- isOpen: boolean
- Controls the collapsed state.
- defaultOpen: boolean = true
- Opens the wide sidebar at first. Set it to false to start as a rail.
- onOpenChange: (isOpen: boolean) => void
- Receives the new collapsed state. Use it to save the state in a cookie or a parent.
- shortcut: boolean = true
- Toggles the sidebar with Mod+B. The shortcut does not fire in a field or while an event is already handled.
- --sidebar-width: CSS length = 16rem
- Sets the width of the expanded sidebar. Set it on the provider.
- --sidebar-width-rail: CSS length = 3.5rem
- Sets the width of the rail. Set it on the provider.
Sidebar
- collapsible: "icon" | "none" = "icon"
- Sets icon to collapse to a rail, or none to keep the sidebar at full width.
- aria-label: string = "Sidebar"
- Names the navigation landmark.
SidebarMenu
- aria-label: string
- Names the nav landmark. Set it when the sidebar has more than one menu.
SidebarHeader
Holds the brand and the trigger at the top of the sidebar.
SidebarContent
The scrolling middle of the sidebar. It fades the top and bottom edges.
SidebarFooter
Holds account or version content at the bottom. It hides in the rail unless a child sets data-rail="keep".
SidebarGroup
Groups items under a label.
- aria-label: string
- Names the group when it has no SidebarGroupLabel.
- aria-labelledby: string
- Points to the label element. The group uses its SidebarGroupLabel by default.
SidebarGroupLabel
Names a group. It becomes screen-reader-only in the rail so the icon items keep their context.
SidebarItem
- href: stringRequired
- The link target.
- icon: ReactNodeRequired
- The icon before the label. It uses an 18px size and fills when isCurrent is set.
- isCurrent: boolean = false
- Marks the current page with aria-current="page" and the accent fill.
- badge: ReactNode
- A badge after the label. In the rail it shrinks to a 6px dot, and the text stays in the accessible name.
- tooltip: string
- The rail tooltip text. Without it, a string label is the text.
- onPress: (event: PressEvent) => void
- Runs on press. In the mobile sheet, the sheet closes after it.
SidebarInset
- render: (props, state) => ReactElement
- Renders a different element, such as main. The state argument is expanded or collapsed.
SidebarTrigger
Toggles the rail in the wide layout, and opens the sheet in the narrow layout. Accepts Button props for variant and size.
- aria-label: string
- Names the button. The default is "Collapse sidebar", "Expand sidebar", or "Open navigation".