Components
← All components

Sidebar

stimeo--sidebar

A sidebar that changes shape with the viewport: a collapsible rail when wide, a modal panel when narrow.

  • Core
  • Dialog (Modal)

A sidebar that changes shape with the width of the screen. On a wide screen it sits beside the content as a rail you can collapse and expand, and it remembers that choice for your next visit. On a narrow screen it becomes a panel laid over the content. While it is laid over, focus stays inside it and the background stops scrolling and responding. Esc or a click on the background closes it and returns focus to the button that opened it. It is deliberately not announced as a dialog, so it keeps its meaning as a navigation landmark. This demo keeps the rail shape. To see the overlay, narrow the whole window below 768px: this Playground's own sidebar is built with the same part. The rail width, the slide and the dimmed background are this demo's CSS.

running

Keyboard

KeyAction
Esc Close the overlay (below the breakpoint) and return focus to the trigger.
Tab / Shift+Tab Cycle focus within the panel while the overlay is open (focus trap).