Sidebar Layout

Persistent and responsive sidebar plus content composition

Sidebar Layout

Sidebar Layout is a state-free CSS Grid for persistent navigation beside main content. It is separate from Drawer: use Sidebar Layout for the wide persistent surface and the existing Drawer for temporary mobile navigation.

Basic layout

The persistent sidebar appears when this component’s own inline size reaches 48rem. At narrower sizes the sidebar’s auto track collapses and content fills the grid.

Persistent sidebar

End sidebar

Start and end are logical directions and therefore follow RTL writing direction.

End-aligned sidebar

Application-owned states

Apply .sidebar-layout-compact or .sidebar-layout-hidden to the root. The layout does not add a checkbox, event listener, or other runtime state.

Class Purpose
.sidebar-layout Named inline-size container and grid root
.sidebar-layout-sidebar Persistent sidebar region
.sidebar-layout-content Shrink-safe main content region
.sidebar-layout-start, .sidebar-layout-end Logical sidebar placement
.sidebar-layout-compact Uses --sidebar-layout-compact-width
.sidebar-layout-hidden Removes the persistent sidebar

Override --sidebar-layout-width and --sidebar-layout-compact-width on the root when needed.

Compose with Drawer on narrow containers

Keep the persistent <aside> in Sidebar Layout and provide a separate native Drawer for the same navigation destinations. An application-controlled menu button can invoke a popover or dialog Drawer on narrow layouts. The two primitives are intentionally not coupled.