Page header

The top of a page: breadcrumb, back link, the title (the page's h1), status beside it, a description, actions, and tabs on its foot.

Anatomy

div[data-ds-page-header].@container/header      sticky? bordered?
├── div  breadcrumb slot
├── a  ← backLabel                               backHref only
├── div  flex-col; @2xl: row, space-between
│   ├── div
│   │   ├── h1|h2|h3 (truncate? title=…) · div meta slot
│   │   └── div description
│   └── div actions
│       ├── div  secondary as ds::button secondary     @max-xl: hidden with collapseActions, where scripts run
│       ├── ds::dropdown More (ds::dropdown-item each)  @xl: hidden; collapseActions only; hidden with scripting off
│       └── actions slot
└── div  tabs slot

Container queries on the header itself: actions go under the title below 42rem (@2xl), and secondary folds into More below 36rem (@xl). The secondary actions are DATA (label, href or attributes, icon, tone) because one action has to be drawn twice, as a button and as a menu item; a slot of buttons cannot become menu items. With scripting off the fold never happens ([@media(scripting:…)]), since the More menu cannot open without Alpine. Values in attributes are escaped before they go into the bag.

Heading sizes follow the type scale: h1 is text-heading (every page title), h2 text-title, h3 text-section.

States

Truncatedone line, ellipsis, the full title in title and in the heading's text
Stickysticky top-(--ds-sticky-offset,0px), opaque on surface-sunken, the app's ground. stickyOffset (a length; anything else throws) sets the variable on the header; a shell sets it for every page
With tabsno border of its own; the tab row draws the rule

Accessibility

Rolea heading of the given level; the breadcrumb's nav; the tabs' own pattern
Namethe title
KeyboardTab through back link, breadcrumb, actions, More, tabs
Focuseach control's own ring

Do not

  • Do not render two h1s on a page; give a section's header as="h2".
  • Do not put foldable actions in the slot: only secondary folds.
  • Do not pass class strings in secondary: tone and icon only.

From the package repo: edit this page on GitHub.

Was this page helpful?