Sidebar
The application's own navigation: a collapsible rail on a wide screen, an overlay on a narrow one.
- Navigation
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add sidebarnpm packages installed: radix-ui.
import { SidebarProvider } from "@/components/ui/sidebar";Default
Collapsed
<SidebarProvider>
| Prop | Type | Default |
|---|---|---|
defaultOpen | boolean | true |
onOpenChange | (open: boolean) => void | — |
openControlled open state. | boolean | — |
children | ReactNode | — |
<Sidebar>
| Prop | Type | Default |
|---|---|---|
label (required)Names the navigation landmark. Required, not optional. A page has more than one navigation region — this, a breadcrumb, a footer — and three landmarks all called "navigation" is a list a screen reader user cannot choose from. | string | — |
mobileTitleTitle for the overlay on a narrow screen, where it is a dialog. | string | — |
Plus every attribute of <aside>.
<SidebarHeader>
Plus every attribute of <div>.
<SidebarContent>
Plus every attribute of <div>.
<SidebarFooter>
Plus every attribute of <div>.
<SidebarGroup>
Plus every attribute of <div>.
<SidebarGroupLabel>
Plus every attribute of <div>.
<SidebarMenu>
Plus every attribute of <ul>.
<SidebarMenuItem>
Plus every attribute of <li>.
<SidebarMenuButton>
| Prop | Type | Default |
|---|---|---|
isActiveThe page currently being shown. | boolean | false |
asChildRender the child as the control, for a router's own link or a button. | boolean | false |
Plus every attribute of <a>.
<SidebarMenuLabel>
Plus every attribute of <span>.
<SidebarTrigger>
| Prop | Type | Default |
|---|---|---|
labelOverrides the label, which otherwise says what pressing it will do. | string | — |
Plus every attribute of <button>.
<SidebarInset>
Plus every attribute of <main>.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes