Skip to content
Components / Navigation

Sidebar

The persistent navigation of an operational app.

@fabrials/ui
Loading state

Overview

Two accounts, last sync 4 minutes ago. Synthetic data.

Installation

  1. Import the control from @fabrials/ui, after setting the app up.

    TypeScript
    import { SidebarProvider, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarMenuBadge } from "@fabrials/ui";
  2. Or install it under shadcn's name, so code that imports @/components/ui/sidebar gets this control. See shims.

    npx shadcn@latest add @fabrials/sidebar

API reference

Prop / exportTypeDescription
isActivebooleanMarks the current destination (aria-current page, a fill and a 2 px Stormlight bar).
SidebarMenuButton sizedefault | sm | lg | touchtouch is a navigation row: a 44 px target around a 40 px band, the focus ring inside the band, muted icons. Nested rows take depth (0 to 4).
SidebarMenuButton renderReactElementPass the host's link: render={<a href />} or a router Link.
SidebarMenuBadgespanInside the button it is a count in the row and part of the link's name (a screen reader hears Inbox 12); beside it, it floats over the end of the button.
SidebarProvider keyboardShortcutstring | falseThe key that toggles the sidebar with Ctrl or Command (default b). It is ignored while a person types in a field or an editor, where Ctrl+B is Bold. false turns it off.
SidebarProvider persistbooleanfalse writes no sidebar_state cookie, for a host that keeps the state.
Sidebar labels / SidebarTrigger label / SidebarRail labelstringThe names screen readers hear (English by default): translate them.

Behavior

Menu rows work without a SidebarProvider: a list of navigation links renders expanded with no shell around it. Below 768px the full sidebar shell becomes a sheet. The host owns routing.

Accessibility

Keyboard and contrast
Keep visible labels, keyboard focus and status announcements when customizing. These components inherit your theme; maintain sufficient contrast in both color modes. The preview is keyboard operable.