A sidebar pairs a supporting region of a preferred width with a primary region that takes all remaining space. When the primary region would fall below a minimum share of the row, the two regions wrap and stack, in source order, without a breakpoint: the switch is driven by the space the sidebar itself has. A viewport fallback forces one column at phone widths. Use it for settings navigation beside a form, filters beside results, or an article beside its related links.
Use when
A secondary region (local navigation, filters, table of contents, metadata) belongs beside the primary content on wide screens.
The pair must reflow correctly inside panes of different widths, not only at viewport breakpoints.
The supporting region should keep a comfortable width while the primary region absorbs extra space.
Avoid when
The supporting column needs a fixed track with a start or end placement and a fixed breakpoint: use Rail.
Both regions are roughly equal peers: use Switcher.
Users resize the two regions: use Split pane with application-owned resize behavior.
Behavior to know
Source order decides which region comes first when stacked; Forma never reorders them.
The sidebar stretches to the row height by default, so a background or rule runs the full height of the content.
Only the two element classes are styled; the regions keep their own semantics (aside, nav, article).
Basic example
The smallest correct markup: the canonical pattern from patterns/sidebar.html inside its public tag. Copy this first, then adapt labels, names and state. This component owns a page's main landmark, so it renders in its own document below.
Canonical
Minimal sidebar
Rendered from the canonical pattern file.
Static specimen. Its links point to placeholder destinations that do not exist on this site. Its controls are shown for their markup and appearance and cannot be operated here.
<forma-sidebar class="forma-component-tag">
<section class="forma-sidebar" aria-label="Workspace">
<aside class="forma-sidebar__side"><nav aria-label="Workspace navigation"><a href="#overview" aria-current="page">Overview</a><a href="#evidence">Evidence</a></nav></aside>
<main class="forma-sidebar__content" id="overview"><h2>Overview</h2><p>The main region grows while the sidebar preserves a useful measure.</p></main>
</section>
</forma-sidebar>
Click or tap the code once to select all of it, then copy.
Examples
Scenario
Settings with section navigation
Account settings: a local navigation list in the sidebar and a form in the content region. On a wide screen they sit side by side; in a narrow pane the navigation wraps above the form.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its links point to placeholder destinations that do not exist on this site. Its controls are shown for their markup and appearance and cannot be operated here.
Click or tap the code once to select all of it, then copy.
Scenario
Article with related links after it
The article comes first in the source and the related links second, so the sidebar sits at the inline end on wide screens and below the article when stacked. The sidebar width is narrowed with --forma-sidebar-width.
Static specimen. Its links point to placeholder destinations that do not exist on this site. Its controls are shown for their markup and appearance and cannot be operated here.
Rotating API keys without downtime
Issue the new key, deploy it alongside the old one, confirm traffic has moved, then revoke the old key. Each step can be rolled back independently.
Keys issued before March 2026 cannot be rotated in place and must be replaced.
<forma-sidebar class="forma-component-tag">
<div class="forma-sidebar" style="--forma-sidebar-width: 14rem">
<article class="forma-sidebar__content forma-stack" aria-labelledby="sidebar-article-end-sidebar-title">
<h2 id="sidebar-article-end-sidebar-title">Rotating API keys without downtime</h2>
<p>Issue the new key, deploy it alongside the old one, confirm traffic has moved, then revoke the old key. Each step can be rolled back independently.</p>
<p>Keys issued before March 2026 cannot be rotated in place and must be replaced.</p>
</article>
<aside class="forma-sidebar__side forma-stack" data-density="compact" aria-labelledby="sidebar-article-end-sidebar-related">
<h3 id="sidebar-article-end-sidebar-related">Related</h3>
<a href="#key-scopes">Key scopes and permissions</a>
<a href="#audit-log">Reading the audit log</a>
</aside>
</div>
</forma-sidebar>
Click or tap the code once to select all of it, then copy.
Mobile
Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.
Mobile example
Mobile filters above results
A filter panel beside search results. At phone width the viewport fallback makes the sidebar a one-column grid, so filters stack above results in source order.
Static specimen. Submitting or resetting it needs the consuming application's form handling, which this documentation does not have. Its controls are shown for their markup and appearance and cannot be operated here.
Frames narrower than the selected width show the component at the width available.
What changes at narrow widths
At 30rem and below the sidebar switches to a one-column grid and both regions take the full width.
Above that, stacking still happens intrinsically whenever the content region would drop below 60% of the row.
Filters come first because they are first in the source; move them after the results in the markup if results should lead on phones.
Nothing scrolls horizontally; long filter labels wrap inside the full-width region.
Click or tap the code once to select all of it, then copy.
Baseline
Mobile · 320px
The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.
Static specimen. Its links point to placeholder destinations that do not exist on this site. Its controls are shown for their markup and appearance and cannot be operated here.
Frames narrower than the selected width show the component at the width available.
API and configuration
Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.
Native and ARIA attributes
Attribute
On
Values
Default
Description
aria-label
.forma-sidebar__side / region
string
—
Names a nav, aside or form in the sidebar so its landmark is distinguishable.