Skip to content

SidebarRail

The sidebar of the admin panels: a compact 72 px rail with one button per section. A section opens its panel to the side, a page with children opens another level further to the side, lined up with its row, and a third level the same way; nothing ever expands downward. Pick it for a panel with many sections, such as content, commerce, marketing and settings.

  • SidebarRail

PreviewLink to the section Preview

Live in all three themes. Everything here is interactive.

Light theme, SidebarRail

Skip to contentSkip to navigation

Variants

The rail is compact. Point at Commerce: its panel opens to the side; point at Products and its pages open one level further to the side, lined up with the row. The pin docks the panel beside the content. Narrow the window for the phone drawer, where each level is a screen.

#/commerce/products/variants

Dark theme, SidebarRail

Skip to contentSkip to navigation

Variants

The rail is compact. Point at Commerce: its panel opens to the side; point at Products and its pages open one level further to the side, lined up with the row. The pin docks the panel beside the content. Narrow the window for the phone drawer, where each level is a screen.

#/commerce/products/variants

High contrast theme, SidebarRail

Skip to contentSkip to navigation

Variants

The rail is compact. Point at Commerce: its panel opens to the side; point at Products and its pages open one level further to the side, lined up with the row. The pin docks the panel beside the content. Narrow the window for the phone drawer, where each level is a screen.

#/commerce/products/variants

UsageLink to the section Usage

tsx
import { SidebarRail } from '@skribly/ui/shell'
tsx
<SidebarRail
  sections={[
    { id: 'home', label: 'Home', icon: <Icon name="nav.home" />, href: '/' },
    { id: 'commerce', label: 'Commerce', icon: <Icon name="content.product" />, count: 12, countLabel: '12 orders to ship',
      groups: [{ label: 'Catalog', links: [
        { href: '/products', label: 'Products', icon: <Icon name="content.product" />,
          children: [{ href: '/products/variants', label: 'Variants' }, { href: '/products/brands', label: 'Brands' }] }
      ] }] }
  ]}
  current={pathname}
  labels={{ rail: 'Sections', pin: 'Keep the panel open', filterLabel: (s) => `Filter ${s}`, noMatches: 'No page matches.',
    currentSection: 'holds the open page', back: 'All sections', backTo: (label) => `Back to ${label}`, close: 'Close navigation' }}
  top={<SiteSwitcher />}
  bottom={<><ThemeMenu /><UserMenu /></>}
/>

Every label is a prop, so the app passes its own words in its own language. See no built-in text.

AccessibilityLink to the section Accessibility

  • The rail is a named navigation of buttons: the up and down arrows, Home and End move between them, and each section button reports aria-expanded and controls the panel.
  • Enter, Space or the right arrow opens the panel and moves focus into it; on a row with a chevron they open the next level to the side and move focus to its first link.
  • The left arrow or Escape closes one level and returns focus to the row or button that opened it.
  • Arrows, Home and End move inside one level.
  • Each rail button is a Tab stop.
  • The open page has aria-current="page", a filled pill and a heavier label, never colour alone; every row on the way to it and its rail button take the accent tone, and the current section is said in words.
  • A mouse opens a level after a 150 ms hover, and a safe triangle keeps the level open while the pointer crosses the rows on its way to it.
  • A floating panel closes on a click outside, Escape or a choice.
  • Targets are at least 44 px.
  • Below 48rem the menu button opens one modal drawer whose levels are screens that slide in, each with a back row such as "Back to Commerce".
  • Motion lasts 180 ms and stops under reduced motion.

This demo runs through axe in all three themes on every test run. See what the tests check.

Search this site

Arrows move through the results, Enter opens one, Esc closes. Ctrl K /