A button that opens a panel of options from the side. Rows arrive one after another, a highlight follows the pointer, and groups open in place.
pnpm dlx shadcn@latest add @latheui/sidebar-menuPart of Lathe Pro. Set up your project once with your license key: npx latheui init --key <key>. See Lathe Pro.
Sidebar Menu is part of Lathe Pro
The preview is live and free to try. The source, the install and every assembly come with Pro: $79 once, with lifetime updates.
Depends on
| Prop | Type | Default | Description |
|---|---|---|---|
| label* (required) | string | — | Title of the panel, and the default trigger's name. |
| sections* (required) | { heading?, items }[] | — | Groups of items, in order. |
| current | string | — | The id or href of the current item. It gets a solid highlight and aria-current. |
| onSelect | (item) => void | — | Called when an item is chosen. The panel then closes. |
| side | "left" | "right" | "left" | The edge the panel slides from. |
| open / defaultOpen | boolean | — | Controlled or initial state. |
| onOpenChange | (open: boolean) => void | — | Called when the panel opens or closes. |
| header | ReactNode | — | Top of the panel, in place of the title. The title stays for screen readers. |
| footer | ReactNode | — | Pinned to the bottom, such as an account row. |
| trigger | ReactElement | — | Your own button. A menu icon button when not set. |
| width | number | 300 | Panel width in px, never wider than the screen. |
| renderLink | (item, props) => ReactNode | — | Renders items with an href. Spread props onto your router's link. |
| Prop | Type | Default | Description |
|---|---|---|---|
| id* (required) | string | — | Unique across the menu. |
| label* (required) | string | — | Row text. |
| href | string | — | Makes the row a link. Otherwise it is a button. |
| icon | ReactNode | — | Shown before the label. |
| badge | ReactNode | — | Shown at the end, such as a count. |
| items | SidebarMenuItem[] | — | One level of sub-items, shown in a group that opens and closes. |
| disabled | boolean | — | Dims the row and ignores it. |
<SidebarMenu
side="right"
label="Account"
sections={sections}
trigger={<Button variant="outline">Account</Button>}
/><SidebarMenu
label="Menu"
sections={sections}
current={pathname}
renderLink={(item, { children, ...props }) => <Link {...props}>{children}</Link>}
/>