layout-sidebar
Sidebar layout with a fixed-width sidebar and flexible main content area. Automatically stacks on narrow viewports.
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
data-layout-side |
start, end |
start |
Which side the sidebar appears on |
data-layout-gap |
xs, s, m, l, xl |
m |
Gap between sidebar and main content |
data-layout-sidebar-width |
narrow, normal, wide |
normal |
Width of the sidebar (12rem, 15rem, 20rem) |
data-layout-content-min |
40, 50, 60 |
50 |
Minimum width percentage for main content before wrapping |
data-layout-nowrap |
boolean | - | Prevents stacking on narrow viewports |
Side Variants
The data-layout-side attribute controls which side the sidebar appears on.
Sidebar on Start (default)
This area grows to fill available space while the sidebar maintains its width. The layout automatically stacks on narrow screens.
Sidebar on End
The main content area appears first in the markup but is positioned based on flex direction.
Related links, filters, or supplementary information.
Code
Width Variants
The data-layout-sidebar-width attribute controls the sidebar width.
data-layout-sidebar-width="narrow" (12rem)
Narrow sidebar
Main content area with more space.
data-layout-sidebar-width="wide" (20rem)
Wide sidebar with more room for navigation or filters.
Main content area.
Code
Gap Variants
The data-layout-gap attribute controls spacing between sidebar and main content.
data-layout-gap="xs"
Sidebar
Main content with extra-small gap.
data-layout-gap="l"
Sidebar
Main content with large gap.
Code
Usage Examples
Dashboard Layout
Overview
Article with Related Content
Article Title
Main article content goes here. The sidebar provides space for related links, author info, or supplementary content that enhances the reading experience.
The flexible layout ensures the main content always gets priority width while the sidebar maintains its fixed width.
Filters Layout
Product 1
Product 2
Product 3
Product 4
CSS Implementation
Related Elements
- layout-stack - Vertical stacking layout
- layout-grid - Auto-fit grid layout
- layout-switcher - Responsive row/column switcher