# App, sidebar navigation

- **[Sections](/blocks/)**
- **[Application](/blocks/app/)**
- **App, sidebar navigation**

The sidebar of an app: grouped links with icons and an optional count, groups that open and close, the current page marked with aria-current, and a button that folds it…

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-shell-sidebar
  ```
- **Import**

  ```
  import Block from '@/components/klarhimmel/blocks/app-shell-sidebar';
  ```

Also called

- app/shell-sidebar

- **About**: The sidebar of an app: grouped links with icons and an optional count, groups that open and close, the current page marked with aria-current, and a button that folds it into an icon rail whose names appear in tooltips (on hover and…
- **Category**: Interface sections for signed-in products. New project? Set it up once: /get-started/installation.

## Notes

- **When to use it**: The side navigation of an app, with grouped links and a current page. Use `app-shell-topbar` with it for breadcrumbs and the account menu; a marketing site should use a navbar block, not this.
- **Writing for it**: - Labels hold 30 characters, and the optional badge holds only 6, so write a count like 14 and not a word.
- active must equal one item label exactly, or no link is marked as the current page. Keep labels unique across groups for the same reason.
- Set collapsible: true only on groups that people may want to fold away, such as Manage. Up to 4 groups of 6 links keep the rail readable.
- **Watch out for**: In the collapsed rail the labels become tooltips and the brand is hidden visually, and collapsible groups stop behaving as buttons. An item with an empty label is not drawn at all, so a blank link vanishes without a warning.

## Pairs well with

- **[App, top bar](/blocks/app/shell-topbar)**
- **[App, stat panel row](/blocks/app/dashboard-stats)**
- **[App, data table](/blocks/app/data-table)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppShellSidebar from '@/components/klarhimmel/blocks/app-shell-sidebar';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppShellSidebar props={{
          "brand": "Name the product",
          "navLabel": "Main navigation",
          "groups": [
            {
              "label": "Workspace",
              "collapsible": false,
              "open": true,
              "items": [
                {
                  "label": "First page",
                  "icon": "gauge",
                  "href": "#overview"
                },
                {
                  "label": "Second page",
                  "icon": "book",
                  "href": "#bookings",
                  "badge": "00"
                }
              ]
            },
            {
              "label": "Manage",
              "collapsible": true,
              "open": true,
              "items": [
                {
                  "label": "Page five",
                  "icon": "heart",
                  "href": "#team"
                },
                {
                  "label": "Page six",
                  "icon": "chart",
                  "href": "#reports"
                }
              ]
            }
          ],
          "active": "Second page",
          "collapsed": false,
          "toggle": {
            "collapse": "Collapse sidebar",
            "expand": "Expand sidebar"
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

- **brand**: Text, up to 30 characters.
- **navLabel**: Text, up to 40 characters.
- **groups**: List of 1 to 4. Each item: label, collapsible, open, items.
- **active**: Text, up to 30 characters.
- **collapsed**: See the type.
- **toggle**: Fields: collapse, expand.

[Previous](/blocks/app/settings-profile)

[Next](/blocks/app/shell-topbar)
