Sidebar

Responsive app sidebar with collapse modes, mobile overlay and persisted state

View documentation

Full structure

Every region at once, with collapsible="none" so the panel stays a plain <aside> and fits in this card. menu-button renders an anchor when it has href and a <button> otherwise.

Main content

sidebar.inset is the content area beside the panel.

The trigger

sidebar.trigger toggles whichever provider is above it, so it can sit anywhere inside one — typically in the top bar of sidebar.inset. sidebar.rail is the second toggle: an edge strip inside the panel.

Click it — the page sidebar collapses.

Same button as the one in this page's top bar. sidebar.rail is the other toggle: an edge strip inside the panel itself, which the page sidebar also carries.

Collapsible modes

Conceptual

The collapsible panel is position: fixed by preset, so it cannot honestly live inside a demo card — the sidebar framing this page is the live example, and the trigger above drives it. Narrow the viewport to see offcanvas instead of icon.

sidebar.provider
State wrapper. Mounts the controller and exposes the width CSS variables.
sidebar
The panel itself. Owns side, variant and collapsible.
sidebar.inset
The content area beside the panel.
sidebar.trigger / sidebar.rail
Toggles: a button anywhere, or the edge strip inside the panel.
sidebar.header / content / footer
The three layout regions.
sidebar.brand
Header link with separate expanded and icon-collapsed content.
sidebar.group / group-label / group-action / group-content
A titled navigation section.
sidebar.menu / menu-item / menu-button
The primary menu structure.
sidebar.menu-action / menu-badge / menu-skeleton
Per-item affordances.
sidebar.menu-sub / menu-sub-item / menu-sub-button
One nested level.
sidebar.input / sidebar.separator
Search field and divider, styled for the panel.

Variant, side and persistence

Conceptual

variant takes sidebar, floating or inset. side is physical and does not mirror in RTL. The provider persists the desktop expanded state in cookie-name, which is why a reload keeps it where you left it.

Collapse the sidebar framing this page, reload, and it stays collapsed — that is cookie-name at work, with no application code behind it.