Component

Sidebar

Provides a collapsible, keyboard-toggled application sidebar.

Install

Run the CLI to copy the source into your project.

pnpm dlx @stalk-ui/cli add @stalk-ui/sidebar

Examples

Live previews render through the docs app's PandaCSS codegen.

Theme
<div
  style={{
    border: '1px solid var(--colors-border-default)',
    borderRadius: 8,
    display: 'flex',
    height: 280,
    overflow: 'hidden',
  }}
>
  <Sidebar.Provider style={{ minHeight: '100%' }}>
    <Sidebar>
      <Sidebar.Header>
        <Sidebar.Trigger />
        <span style={{ fontWeight: 600 }}>Acme</span>
      </Sidebar.Header>
      <Sidebar.Content>
        <Sidebar.Group>
          <Sidebar.GroupLabel>Workspace</Sidebar.GroupLabel>
          <Sidebar.Menu>
            <Sidebar.MenuItem>
              <Sidebar.MenuButton isActive>
                <Home />
                <span>Queue</span>
              </Sidebar.MenuButton>
            </Sidebar.MenuItem>
            <Sidebar.MenuItem>
              <Sidebar.MenuButton>
                <Settings />
                <span>Settings</span>
              </Sidebar.MenuButton>
            </Sidebar.MenuItem>
          </Sidebar.Menu>
        </Sidebar.Group>
      </Sidebar.Content>
      <Sidebar.Rail />
    </Sidebar>
    <Sidebar.Inset>
      <div style={{ alignItems: 'center', display: 'flex', gap: 8, padding: 12 }}>
        <Sidebar.Trigger />
        <strong>Task Queue</strong>
      </div>
    </Sidebar.Inset>
  </Sidebar.Provider>
</div>

Props

Public component props extracted from the source TypeScript types.

PropTypeRequiredDefaultDescription
`asChild``boolean`No-Render the single child element (e.g. a router link) instead of a \`<button>\`.
`isActive``boolean`No-Marks the button as the current item.
PropTypeRequiredDefaultDescription
`defaultOpen``boolean`No--
`open``boolean`No--
`onOpenChange``(open: boolean) => void`No--
PropTypeRequiredDefaultDescription
`children``ReactNode`No--

Variants

Variant axes exposed by the underlying PandaCSS recipe or slot recipe.

No recipe variants are documented for this component.

Registry

Files this component contributes to your registry install.

  • Manifest: `/r/sidebar.json`
  • Recipe: `sidebar`
  • Files: `src/components/ui/sidebar.tsx`