Article Layout

Content page with sidebar navigation using layout-sidebar. Sidebar collapses below content on narrow screens.

Overview

This pattern creates a documentation or article page with a sidebar for in-page navigation. It uses data-layout="sidebar" for the responsive split and <layout-text> to constrain the reading width.

Key features:

  • Responsive sidebar that stacks on mobile
  • Tree navigation for section links
  • Comfortable reading measure with layout-text
  • Article metadata (date, read time)
  • Section-based content structure

Live Example

An article page with sidebar navigation linking to content sections.

Source Code

The data-layout="sidebar" attribute handles the responsive behavior automatically.

Layout Configuration

The data-layout="sidebar" pattern accepts these data attributes:

Attribute Values Description
data-layout-gap xs s m l xl 2xl Gap between sidebar and content.
data-layout-sidebar-width narrow normal wide Intrinsic width of the sidebar.
data-layout-content-min 40 50 60 Minimum content width (%) before sidebar stacks.
data-layout-side end Place sidebar after content (default: before content).

Usage Notes

  • Responsive: Sidebar stacks below content when viewport is too narrow (controlled by data-layout-content-min)
  • Navigation: Use nav.tree for the sidebar navigation with in-page anchor links
  • Reading width: Wrap article content in <layout-text> to constrain line length
  • Sections: Use id attributes on sections that match navigation href values
  • Active state: Add aria-current="page" to the currently visible section link

Related

Layout Sidebar

Sidebar layout element documentation

Tree Navigation

Collapsible tree navigation pattern

Layout Text

Reading measure constraint element