# Sidebar Menu

> SidebarMenu is the vertical navigation menu of a sidebar - grouped links, nested submenus, the selected route with aria-current, router links through renderLink, and an icon rail with tooltips and flyout submenus - in a nav landmark that works in any vertical navigation container.

Canonical: https://salmonui.dev/docs/navigation/sidebar-menu

```tsx
import { SidebarMenu, type SidebarMenuEntry } from '@salmonui/navigation/sidebar-menu';
import '@salmonui/navigation/sidebar-menu/styles.css';

const items: SidebarMenuEntry[] = [
  {
    type: 'group',
    id: 'workspace',
    label: 'Workspace',
    children: [
      { id: '/overview', label: 'Overview', href: '/overview', icon: <LayoutDashboard /> },
      { id: '/orders', label: 'Orders', href: '/orders', icon: <ShoppingCart />, badge: 12 },
    ],
  },
  {
    type: 'group',
    id: 'operations',
    label: 'Operations',
    children: [
      {
        id: 'commerce',
        label: 'Commerce',
        icon: <Store />,
        children: [{ id: '/products', label: 'Products', href: '/products' }],
      },
    ],
  },
];

<SidebarMenu items={items} selected={pathname} renderLink={(props) => <Link to={props.href} {...props} />} />
```

`SidebarMenu` is the navigation menu of a sidebar: it pairs with
[SidebarLayout](https://salmonui.dev/docs/navigation/sidebar-layout) (put it in a
`SidebarPanel`, pass the layout's `collapsed` state for the icon rail, and
the overlay presentation makes it the mobile drawer menu), and it works the
same in any other vertical navigation container, such as a settings page
column or a plain `<aside>`. It is its own subpath: a page that uses
`SidebarLayout` without it does not load it. Its stylesheet needs nothing
besides `@salmonui/core/styles.css`.

### Live demo: Sidebar menu with router links

Live demo: https://salmonui.dev/demos/navigation/sidebar-menu-admin

A grouped admin SidebarMenu whose links render through renderLink as client-side router links; the selected item follows the current path and carries aria-current.

`Demo.tsx`:

```tsx
'use client';
import { useState, type MouseEvent, type ReactNode } from 'react';
import { SidebarMenu, type SidebarMenuEntry, type SidebarMenuLinkProps } from '@salmonui/navigation/sidebar-menu';

// Links render through a stand-in router: the real path lives in state, the
// href points at this demo's own title so no link dangles in the static export.
const DEMO_ANCHOR = '#demo-sidebar-menu-admin-title';

const glyph = (d: string): ReactNode => (
  <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
    <path d={d} />
  </svg>
);

const ITEMS: SidebarMenuEntry[] = [
  {
    type: 'group',
    id: 'workspace',
    label: 'Workspace',
    children: [
      { id: '/workspace/overview', label: 'Overview', href: '/workspace/overview', icon: glyph('M2 9h5V2H2zM9 14h5V7H9zM2 14h5v-3H2zM9 5h5V2H9z') },
      { id: '/workspace/analytics', label: 'Analytics', href: '/workspace/analytics', icon: glyph('M2 14h12M4 11V7M8 11V3M12 11V6') },
      { id: '/workspace/orders', label: 'Orders', href: '/workspace/orders', icon: glyph('M2 2h2l2 8h7l1-5H5M6.5 13.5h.01M12 13.5h.01') },
    ],
  },
  {
    type: 'group',
    id: 'operations',
    label: 'Operations',
    children: [
      {
        id: 'commerce',
        label: 'Commerce',
        icon: glyph('M2 6l1-4h10l1 4M3 6v8h10V6M6 14v-4h4v4'),
        children: [
          { id: '/operations/commerce/products', label: 'Products', href: '/operations/commerce/products' },
          { id: '/operations/commerce/promotions', label: 'Promotions', href: '/operations/commerce/promotions' },
        ],
      },
      { id: '/operations/payments', label: 'Payments', href: '/operations/payments', icon: glyph('M2 4h12v8H2zM2 7h12') },
    ],
  },
  {
    type: 'group',
    id: 'system',
    label: 'System',
    children: [{ id: '/system/settings', label: 'Settings', href: '/system/settings', icon: glyph('M8 10a2 2 0 100-4 2 2 0 000 4zM8 1v2M8 13v2M1 8h2M13 8h2') }],
  },
];

export default function SidebarMenuAdminDemo() {
  const [path, setPath] = useState('/workspace/orders');
  const [last, setLast] = useState('nothing yet');
  // With a real router, return its link: `<Link to={props.href} {...props} />`.
  const renderLink = (props: SidebarMenuLinkProps) => (
    <a
      {...props}
      href={DEMO_ANCHOR}
      data-path={props.href}
      onClick={(event: MouseEvent<HTMLAnchorElement>) => {
        if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
        event.preventDefault();
        setPath(props.href);
      }}
    />
  );
  return (
    <div style={{ display: 'flex', gap: 16, alignItems: 'flex-start', flexWrap: 'wrap' }}>
      <div style={{ inlineSize: 232, border: '1px solid var(--salmon-border-subtle)', borderRadius: 'var(--salmon-radius-lg)', background: 'var(--salmon-surface-raised)' }}>
        <SidebarMenu
          aria-label="Admin"
          items={ITEMS}
          selected={path}
          defaultExpanded="all"
          renderLink={renderLink}
          onItemClick={(item, event) => setLast(`${String(item.label)}${event.metaKey || event.ctrlKey || event.shiftKey ? ' (modified click: not selected)' : ''}`)}
        />
      </div>
      <div className="demo-stack">
        <p className="demo-status" aria-live="polite">
          Current path: <code>{path}</code>
        </p>
        <p className="demo-status">Last item click: {last}</p>
      </div>
    </div>
  );
}
```

## Items

`items` is an array of entries:

| Entry | Renders | Notes |
| --- | --- | --- |
| `{ id, label, href }` | a link | `aria-current="page"` when `selected`; through `renderLink` when given |
| `{ id, label }` (no `href`, no `children`) | a button | An action (sign out, open a dialog); selectable like a link, `aria-current="true"` when selected |
| `{ id, label, children }` | a disclosure button and a nested list | `aria-expanded` and `aria-controls`; `href` is ignored |
| `{ type: 'group', id, label, children }` | a heading and a list it names | Top level only, never collapses; the heading is the list's accessible name |

Every item also takes `icon` (a decorative `ReactNode`, `aria-hidden`; Salmon
UI ships no icon set, use any icon component), `badge` (trailing content
that is part of the accessible name, such as a count), `disabled` (a
disabled link has no `href` and `aria-disabled="true"`; a disabled submenu
button is `disabled`) and `textValue` (the plain text of a non-string
`label`, used for the rail initial). Ids must be unique: they are the keys
of `selected` and `expanded`. A duplicate logs a development warning.

## Selection and router links

- `selected` / `defaultSelected` / `onSelectedChange(id, { item, source })`:
  `selected` is one id or `null`. With a router, derive it from the current
  location (`selected={pathname}` when ids are paths) and the highlight
  follows navigation from anywhere. A click on a leaf proposes it; a click
  with a modifier key (Ctrl, Cmd, Shift, Alt) or another button opens a new
  tab or window instead and selects nothing.
- `onItemClick(item, event)` runs for every press on an enabled leaf,
  modified clicks included: close a mobile drawer here.
- `renderLink(props, item)` renders a link item with another element.
  Spread every prop: `href`, `className`, `aria-current` and the
  `data-sidebar-menu-*` attributes the menu uses to find the item on click.
  Keep your link's own `onClick` (a router link prevents the full page
  load); the menu reads the click as it bubbles, so it never needs the
  link's handler.

```tsx
<SidebarMenu
  items={items}
  selected={pathname}
  renderLink={(props, item) => <Link to={props.href} {...props} />}
  onItemClick={() => setDrawerOpen(false)}
/>
```

The submenus around the selected item get `data-active` (their button shows
the selected color), so a closed submenu still tells where the page is.

## Submenus

`expanded` / `defaultExpanded` / `onExpandedChange(ids, { id, expanded,
source })` hold the open submenu ids. `defaultExpanded="all"` opens every
submenu; by default the submenus around the selected item start open. An
uncontrolled menu also opens the submenus around a newly selected item, so
navigating elsewhere reveals the current page. Closed submenus stay in the
server markup with `hidden="until-found"`: the browser's find-in-page
reveals them (`source: 'find'`). The open and close transition animates the
height in CSS, off under `prefers-reduced-motion`.

### Live demo: Nested sidebar menu

Live demo: https://salmonui.dev/demos/navigation/sidebar-menu-nested

Three levels of controlled submenus with expand-all and collapse-all buttons, badges, a disabled link, an action item and an event log.

`Demo.tsx`:

```tsx
'use client';
import { useState } from 'react';
import { Button } from '@salmonui/buttons/button';
import { SidebarMenu, type SidebarMenuEntry } from '@salmonui/navigation/sidebar-menu';

// Placeholder links target this demo's own title (no dangling links in the static export).
const DEMO_ANCHOR = '#demo-sidebar-menu-nested-title';

const count = (n: number) => <span style={{ minInlineSize: 20, paddingInline: 6, borderRadius: 999, background: 'var(--salmon-color-primary-subtle)', color: 'var(--salmon-color-primary-text)', textAlign: 'center' }}>{n}</span>;

const ITEMS: SidebarMenuEntry[] = [
  { id: 'inbox', label: 'Inbox', href: DEMO_ANCHOR, badge: count(4) },
  {
    id: 'projects',
    label: 'Projects',
    children: [
      {
        id: 'web',
        label: 'Website',
        children: [
          { id: 'web-roadmap', label: 'Roadmap', href: DEMO_ANCHOR },
          { id: 'web-issues', label: 'Issues', href: DEMO_ANCHOR, badge: count(12) },
        ],
      },
      {
        id: 'mobile',
        label: 'Mobile app',
        children: [
          { id: 'mobile-releases', label: 'Releases', href: DEMO_ANCHOR },
          { id: 'mobile-crashes', label: 'Crash reports', href: DEMO_ANCHOR },
        ],
      },
      { id: 'archive', label: 'Archive', href: DEMO_ANCHOR, disabled: true },
    ],
  },
  { id: 'reports', label: 'Reports', children: [{ id: 'weekly', label: 'Weekly', href: DEMO_ANCHOR }, { id: 'quarterly', label: 'Quarterly', href: DEMO_ANCHOR }] },
  { id: 'sign-out', label: 'Sign out' },
];

const ALL = ['projects', 'web', 'mobile', 'reports'];

export default function SidebarMenuNestedDemo() {
  const [expanded, setExpanded] = useState<readonly string[]>(['projects', 'web']);
  const [log, setLog] = useState<string[]>([]);
  const push = (line: string) => setLog((l) => [line, ...l].slice(0, 5));
  return (
    <div style={{ display: 'flex', gap: 16, alignItems: 'flex-start', flexWrap: 'wrap' }}>
      <div style={{ inlineSize: 240, border: '1px solid var(--salmon-border-subtle)', borderRadius: 'var(--salmon-radius-lg)', background: 'var(--salmon-surface-raised)' }}>
        <SidebarMenu
          aria-label="Projects"
          items={ITEMS}
          defaultSelected="web-issues"
          expanded={expanded}
          onExpandedChange={(ids, event) => {
            setExpanded(ids);
            push(`${event.expanded ? 'opened' : 'closed'} ${event.id} (${event.source})`);
          }}
          onSelectedChange={(id, event) => push(`selected ${id} (${event.source})`)}
        />
      </div>
      <div className="demo-stack">
        <div className="demo-toolbar">
          <Button onClick={() => setExpanded(ALL)}>Expand all</Button>
          <Button onClick={() => setExpanded([])}>Collapse all</Button>
        </div>
        <ul className="demo-log" aria-live="polite">
          {log.length ? log.map((line, i) => <li key={i}>{line}</li>) : <li>No events yet</li>}
        </ul>
      </div>
    </div>
  );
}
```

## Dividers and row metrics

`dividers` draws a rule between the groups (the collapsed rail draws it
anyway). The row metrics are custom properties on
`.salmon-sidebar-menu`, so a sidebar can match an existing layout without
new props:

| Property | Default | Sets |
| --- | --- | --- |
| `--salmon-sidebar-menu-item-inset` | `8px` | the gap between a row and the menu edge |
| `--salmon-sidebar-menu-item-padding` | `12px` | the inline padding inside a row |
| `--salmon-sidebar-menu-group-inset` | `20px` | the inline start of a group heading |
| `--salmon-sidebar-menu-group-font-size` | the small font size | the group heading size |
| `--salmon-sidebar-menu-indent` | `26px` | the extra start padding per submenu level |

```tsx
<SidebarMenu
  items={items}
  dividers
  style={{ '--salmon-sidebar-menu-item-inset': '16px', '--salmon-sidebar-menu-item-padding': '16px', '--salmon-sidebar-menu-group-font-size': '14px' } as CSSProperties}
/>
```

## Collapsed rail

`collapsed` turns the top level into an icon rail: labels hide visually but
stay the accessible names, an item without an icon shows its initial, group
headings become separators, and

- a link shows its label as a tooltip on hover or keyboard focus (the
  tooltip is decorative, the link is already named);
- a submenu button opens a flyout next to it: hover opens it for a look and
  leaving closes it; a click, Enter, Space or Right pins it, a keyboard open
  moves focus to its first link. Escape or Left closes it and returns focus
  to the button; a press outside or focus leaving closes it too. Deeper
  submenus inside a flyout are inline disclosures.

The flyout is rendered inside the item's `<li>` and shown in the top layer,
so it is never clipped by the scrolling sidebar and the Tab order runs from
the button through the flyout to the next rail item. The rail popups are a
small chunk loaded after mount once the menu is collapsed; the server
markup is the same in both modes. Pass the `SidebarLayout` state:

```tsx
const [collapsed, setCollapsed] = useState(false);

<SidebarLayout collapsed={collapsed} onCollapsedChange={setCollapsed} railSize="64px">
  <SidebarPanel navigation aria-label="Main">
    <SidebarMenu landmark={false} items={items} collapsed={collapsed} selected={pathname} />
  </SidebarPanel>
  <SidebarMain>
    <SidebarTrigger action="collapse" />
    …
  </SidebarMain>
</SidebarLayout>
```

### Live demo: Sidebar menu icon rail

Live demo: https://salmonui.dev/demos/navigation/sidebar-menu-rail

A SidebarMenu inside a SidebarLayout that collapses to a 64px icon rail; links show label tooltips and submenus open as flyouts on hover, click or the keyboard.

`Demo.tsx`:

```tsx
'use client';
import { useState, type ReactNode } from 'react';
import { SidebarLayout, SidebarMain, SidebarPanel, SidebarTrigger } from '@salmonui/navigation/sidebar-layout';
import { SidebarMenu, type SidebarMenuEntry } from '@salmonui/navigation/sidebar-menu';

// Placeholder links target this demo's own title (no dangling links in the static export).
const DEMO_ANCHOR = '#demo-sidebar-menu-rail-title';

const glyph = (d: string): ReactNode => (
  <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
    <path d={d} />
  </svg>
);

const ITEMS: SidebarMenuEntry[] = [
  { id: 'overview', label: 'Overview', href: DEMO_ANCHOR, icon: glyph('M2 9h5V2H2zM9 14h5V7H9zM2 14h5v-3H2zM9 5h5V2H9z') },
  { id: 'analytics', label: 'Analytics', href: DEMO_ANCHOR, icon: glyph('M2 14h12M4 11V7M8 11V3M12 11V6') },
  {
    id: 'commerce',
    label: 'Commerce',
    icon: glyph('M2 6l1-4h10l1 4M3 6v8h10V6M6 14v-4h4v4'),
    children: [
      { id: 'products', label: 'Products', href: DEMO_ANCHOR },
      { id: 'promotions', label: 'Promotions', href: DEMO_ANCHOR },
      { id: 'subscriptions', label: 'Subscriptions', href: DEMO_ANCHOR },
    ],
  },
  {
    id: 'customers',
    label: 'Customers',
    icon: glyph('M6 7a2.5 2.5 0 100-5 2.5 2.5 0 000 5zM1.5 14c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4M11 2.5a2.5 2.5 0 010 4.5M14.5 14c0-2-1-3.3-2.5-3.8'),
    children: [
      { id: 'segments', label: 'Segments', href: DEMO_ANCHOR },
      { id: 'support', label: 'Support cases', href: DEMO_ANCHOR },
    ],
  },
  { id: 'settings', label: 'Settings', href: DEMO_ANCHOR, icon: glyph('M8 10a2 2 0 100-4 2 2 0 000 4zM8 1v2M8 13v2M1 8h2M13 8h2') },
];

export default function SidebarMenuRailDemo() {
  const [collapsed, setCollapsed] = useState(true);
  const [selected, setSelected] = useState<string | null>('products');
  return (
    <SidebarLayout
      collapsed={collapsed}
      onCollapsedChange={setCollapsed}
      size="14rem"
      railSize="64px"
      style={{ blockSize: 320, border: '1px solid var(--salmon-border-default)', borderRadius: 'var(--salmon-radius-lg)' }}
    >
      <SidebarPanel aria-label="Rail panel">
        <SidebarMenu aria-label="Rail navigation" items={ITEMS} collapsed={collapsed} selected={selected} onSelectedChange={setSelected} />
      </SidebarPanel>
      <SidebarMain>
        <div style={{ padding: 12 }}>
          <SidebarTrigger action="collapse" />
          <p className="demo-status" aria-live="polite">
            Selected: {selected ?? 'none'} · {collapsed ? 'rail' : 'expanded'}
          </p>
        </div>
      </SidebarMain>
    </SidebarLayout>
  );
}
```

## Keyboard and screen readers

Site and app navigation is a list of links, so `SidebarMenu` follows the
WAI-ARIA disclosure navigation pattern, not the menu pattern:
`role="menu"` is for application commands, and it would replace the link
semantics (screen readers' link lists, "open in a new tab", browse-mode
reading) and the plain Tab order users expect from navigation.

- The root is a `<nav>` landmark named by `aria-label` /
  `aria-labelledby`, `localeText.label` (`'Main'`) by default. Inside a
  landmark that already names it (a `SidebarPanel navigation`), pass
  `landmark={false}` to render a `<div>`.
- Lists of links; group headings name their list; submenus are buttons
  with `aria-expanded` and `aria-controls`; the selected link has
  `aria-current="page"`.

| Key | Action |
| --- | --- |
| Tab / Shift+Tab | Every enabled link and submenu button, in order (disabled and closed items are skipped) |
| Enter, Space | Follow a link; toggle a submenu; open a rail flyout into its first link |
| Down / Up | Next / previous visible item (shortcut on top of Tab) |
| Home / End | First / last visible item |
| Right | Open a closed submenu, or move into an open one; open a rail flyout |
| Left | Close an open submenu, or move to the parent submenu button; close a rail flyout |
| Escape | Close a rail flyout and return to its button; hide a rail tooltip |

Right and Left are mirrored under `dir="rtl"`; the indentation, the rail
and the flyout side follow the inherited direction.

## Appearance

The menu uses the theme's sidebar surface variables when they are set and
the neutral theme colors otherwise:

| Variable | Used for | Fallback |
| --- | --- | --- |
| `--salmon-surface-sidebar-bg` | menu, flyout background | transparent (menu), `--salmon-surface-raised` (flyout) |
| `--salmon-surface-sidebar-fg` | item text | `--salmon-text-primary` |
| `--salmon-surface-sidebar-hover` | hovered item | `--salmon-surface-hover` |
| `--salmon-surface-sidebar-selected-bg` / `-selected-fg` | selected item, active submenu | `--salmon-color-primary-subtle` / `-text` |
| `--salmon-surface-sidebar-border` | rail separators, flyout border | `--salmon-border-subtle` |

Group headings mix the item color with the background. Set the variables in
the theme for a dark sider (every sidebar menu, flyout and tooltip
follows), or on one container. `--salmon-sidebar-menu-item-height` (36px)
and `--salmon-sidebar-menu-indent` (26px per level) adjust the rows.
`className`, `style` and DOM props reach the root; parts carry
`.salmon-sidebar-menu-*` classes (`-link`, `-icon`, `-label`, `-badge`,
`-group-label`, `-submenu`, `-flyout`, `-tooltip`).

### Live demo: Sidebar menu on a dark surface

Live demo: https://salmonui.dev/demos/navigation/sidebar-menu-dark

An admin sidebar with three groups, two nested submenus and every submenu open, colored by the sidebar surface variables for a dark sider.

`Demo.tsx`:

```tsx
'use client';
import { useState, type CSSProperties, type ReactNode } from 'react';
import { SidebarLayout, SidebarMain, SidebarPanel, SidebarTrigger } from '@salmonui/navigation/sidebar-layout';
import { SidebarMenu, type SidebarMenuEntry } from '@salmonui/navigation/sidebar-menu';

// Placeholder links target this demo's own title (no dangling links in the static export).
const DEMO_ANCHOR = '#demo-sidebar-menu-dark-title';

const glyph = (d: string): ReactNode => (
  <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
    <path d={d} />
  </svg>
);

// A dark sider: normally set once in the theme, not per component.
const DARK_SIDER = {
  '--salmon-surface-sidebar-bg': '#192225',
  '--salmon-surface-sidebar-fg': 'rgba(255, 255, 255, 0.85)',
  '--salmon-surface-sidebar-hover': 'rgba(255, 255, 255, 0.08)',
  '--salmon-surface-sidebar-selected-bg': '#3a484c',
  '--salmon-surface-sidebar-selected-fg': '#ffffff',
  '--salmon-surface-sidebar-border': 'rgba(255, 255, 255, 0.12)',
  background: 'var(--salmon-surface-sidebar-bg)',
  borderInlineEnd: 0,
} as CSSProperties;

const ITEMS: SidebarMenuEntry[] = [
  {
    type: 'group',
    id: 'workspace',
    label: '工作區',
    children: [
      { id: 'overview', label: '總覽', href: DEMO_ANCHOR, icon: glyph('M2 9h5V2H2zM9 14h5V7H9zM2 14h5v-3H2zM9 5h5V2H9z') },
      { id: 'analytics', label: '數據分析', href: DEMO_ANCHOR, icon: glyph('M2 14h12M4 11V7M8 11V3M12 11V6') },
      { id: 'orders', label: '訂單管理', href: DEMO_ANCHOR, icon: glyph('M2 2h2l2 8h7l1-5H5M6.5 13.5h.01M12 13.5h.01') },
    ],
  },
  {
    type: 'group',
    id: 'operations',
    label: '營運',
    children: [
      {
        id: 'commerce',
        label: '商務中心',
        icon: glyph('M2 6l1-4h10l1 4M3 6v8h10V6M6 14v-4h4v4'),
        children: [
          { id: 'products', label: '商品目錄', href: DEMO_ANCHOR },
          { id: 'promotions', label: '促銷活動', href: DEMO_ANCHOR },
          { id: 'subscriptions', label: '訂閱方案', href: DEMO_ANCHOR },
        ],
      },
      {
        id: 'customers',
        label: '客戶關係',
        icon: glyph('M6 7a2.5 2.5 0 100-5 2.5 2.5 0 000 5zM1.5 14c0-2.5 2-4 4.5-4s4.5 1.5 4.5 4M11 2.5a2.5 2.5 0 010 4.5M14.5 14c0-2-1-3.3-2.5-3.8'),
        children: [
          { id: 'segments', label: '客群管理', href: DEMO_ANCHOR },
          { id: 'support', label: '服務案件', href: DEMO_ANCHOR },
          { id: 'feedback', label: '回饋中心', href: DEMO_ANCHOR },
        ],
      },
      { id: 'payments', label: '金流管理', href: DEMO_ANCHOR, icon: glyph('M2 4h12v8H2zM2 7h12') },
    ],
  },
  {
    type: 'group',
    id: 'system',
    label: '系統',
    children: [
      { id: 'integrations', label: '整合服務', href: DEMO_ANCHOR, icon: glyph('M8 15A7 7 0 108 1a7 7 0 000 14zM1 8h14M8 1c2 2 2.8 4.5 2.8 7S10 13 8 15M8 1C6 3 5.2 5.5 5.2 8S6 13 8 15') },
      { id: 'settings', label: '系統設定', href: DEMO_ANCHOR, icon: glyph('M8 10a2 2 0 100-4 2 2 0 000 4zM8 1v2M8 13v2M1 8h2M13 8h2') },
    ],
  },
];

export default function SidebarMenuDarkDemo() {
  const [collapsed, setCollapsed] = useState(false);
  const [selected, setSelected] = useState<string | null>('promotions');
  return (
    <SidebarLayout
      collapsed={collapsed}
      onCollapsedChange={setCollapsed}
      size="216px"
      railSize="64px"
      style={{ blockSize: 560, border: '1px solid var(--salmon-border-default)', borderRadius: 'var(--salmon-radius-lg)' }}
    >
      <SidebarPanel navigation style={DARK_SIDER} aria-label="主選單">
        <SidebarMenu landmark={false} items={ITEMS} collapsed={collapsed} selected={selected} onSelectedChange={setSelected} defaultExpanded="all" dividers />
      </SidebarPanel>
      <SidebarMain>
        <div style={{ padding: 12 }}>
          <SidebarTrigger action="collapse" />
          <p className="demo-status" aria-live="polite">
            Selected: {selected ?? 'none'}
          </p>
        </div>
      </SidebarMain>
    </SidebarLayout>
  );
}
```

## Localization

`localeText` overrides `SIDEBAR_MENU_DEFAULT_LOCALE_TEXT` (`{ label: 'Main' }`,
the landmark name). Item labels are application content.

## API reference

[`@salmonui/navigation/sidebar-menu`](https://salmonui.dev/docs/reference/navigation/sidebar-menu):
`SidebarMenu`, `SIDEBAR_MENU_DEFAULT_LOCALE_TEXT` and the `SidebarMenuItem`,
`SidebarMenuGroup`, `SidebarMenuEntry`, `SidebarMenuLinkProps` and event
types.
