Sidebar

Vertical navigation sidebar with a header, footer, sections, links, dividers, and an optional collapse toggle.

Installation

npx dafink-ui add sidebar

Also installs: Tooltip, Scroll-fade

Demo

Composition

<Sidebar>
<SidebarHeader />
<SidebarSection>
<SidebarLink />
</SidebarSection>
<SidebarDivider />
<SidebarFooter>
<SidebarLink />
</SidebarFooter>
</Sidebar>

Props

NameTypeDefaultDescription
widthstring'w-56'Tailwind width class used when expanded.
collapsedWidthstring'w-16'Tailwind width class used when collapsed.
collapsiblebooleanfalseRenders the built-in expand/collapse toggle button.
collapsedbooleanundefinedControlled collapsed state. Omit to let Sidebar manage its own state.
defaultCollapsedbooleanfalseInitial collapsed state when uncontrolled.
onCollapsedChange(collapsed: boolean) => voidundefinedCalled whenever the toggle button changes the collapsed state.
togglePosition'top' | 'middle' | 'bottom''middle'Where the collapse toggle button sits along the right border.
classNamestring''Additional CSS classes.
childrenReactNodeundefinedSidebar content (header, sections, links, dividers, footer).