SideBar
Compound navigation: sections, folders, a create row, and a compact mode.
When to use
Use SideBar when you need compound navigation: sections, folders, a create row, and a compact mode.
Import
TypeScript
import { SideBar } from '@gzodo/ui'SideBar is the app navigation, not a list of links in a page. Compose it from Header, Section, Item, Folder, Create, and Footer. compact hides labels and keeps the icons. Inside a resizable panel, pass compact from the layout or let the sidebar measure its own width.
Examples
5Sections and items
Section groups rows. Title is the group label. active on an item is the current page. Clicking a row is onClick.Folder
Folder nests items under a row that toggles. defaultOpen starts it expanded. open and onOpenChange make it controlled.Collapsible section
collapsible turns the title into a toggle. The body animates closed. Compact mode ignores the collapse and shows icons only.Create and footer
Create is the quiet add row at the end of the list. Footer stays pinned to the bottom of the sidebar.Compact
compact hides labels, titles, and the create text. Icons stay centered. Use it for a collapsed app rail.SideBar
4SideBar
Property
Description
Type
Default
childrenHeader, sections, create, and footer.
ReactNode—
compactForce icon-only mode. When omitted, the sidebar measures its width.
boolean—
compactBreakpointWidth at which measuring switches to compact. Defaults to the snap width.
number—
classNameClass on the root.
string—
SideBar.Item
7SideBar.Item
Property
Description
Type
Default
childrenLabel. Hidden in compact mode.
ReactNode—
activeCurrent destination. Filled surface and border.
boolean—
iconLeading icon, in an 18px slot.
ReactNode—
titleNative tooltip and accessible name. Important in compact mode.
string—
onClickActivate the row.
() => void—
actionsTrailing actions, shown on hover.
ReactNode—
actionsVisibleKeep the actions visible without hover.
boolean—
SideBar.Folder
7SideBar.Folder
Property
Description
Type
Default
titleFolder label.
ReactNode—
iconIcon when closed.
ReactNode—
openIconIcon when open. Falls back to icon.
ReactNode—
defaultOpenUncontrolled initial open state.
boolean—
openControlled open state.
boolean—
onOpenChangeCalled when the folder toggles.
(open: boolean) => void—
childrenNested items.
ReactNode—
SideBar.Create
4SideBar.Create
Property
Description
Type
Default
childrenLabel. Hidden in compact mode.
ReactNode—
iconLeading icon.
ReactNode—
onClickStart the create action.
() => void—
titleAccessible name.
string—