Skip to content

Page head

The top of a page inside the shell, with location, title, one line of purpose and actions.

<header class="cap-page-head" id="ph-full">
  <div class="cap-page-head-text">
    <nav class="cap-breadcrumb" aria-label="Breadcrumb">
      <ol class="cap-breadcrumb-list">
        <li class="cap-breadcrumb-item"><a class="cap-breadcrumb-link" href="#sites">Sites</a></li>
        <li class="cap-breadcrumb-item"><span class="cap-breadcrumb-page" aria-current="page">example.org</span></li>
      </ol>
    </nav>
    <h3 class="cap-page-head-title">example.org</h3>
    <p class="cap-page-head-lead">Checks run every five minutes. A failing required check blocks publishing.</p>
  </div>
  <div class="cap-page-head-actions">
    <button type="button" class="cap-btn">Run checks now</button>
    <button type="button" class="cap-btn" data-variant="primary">Publish</button>
  </div>
</header>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/page-head.css";

Usage

<header class="cap-page-head">
  <div class="cap-page-head-text">
    <nav class="cap-breadcrumb" aria-label="Breadcrumb">...</nav>   <!-- optional, two or more levels -->
    <h1 class="cap-page-head-title">Title</h1>
    <p class="cap-page-head-lead">One line saying what the page is for.</p>   <!-- optional -->
  </div>
  <div class="cap-page-head-actions">[buttons and links]</div>   <!-- optional -->
</header>

Examples

Title and lead, no trail, no actions

<header class="cap-page-head" id="ph-lead">
  <div class="cap-page-head-text">
    <h3 class="cap-page-head-title">Queue</h3>
    <p class="cap-page-head-lead">Jobs waiting for a driver, newest first.</p>
  </div>
</header>

Title only

<header class="cap-page-head" id="ph-title">
  <div class="cap-page-head-text">
    <h3 class="cap-page-head-title">Settings</h3>
  </div>
</header>

A long title wraps, and the actions drop below in a narrow space

<div id="ph-narrow" class="page-head-narrow-box">
  <header class="cap-page-head" id="ph-long">
    <div class="cap-page-head-text">
      <h3 class="cap-page-head-title">Why the uptime strip counts gaps and does not average them away</h3>
      <p class="cap-page-head-lead">Draft, last saved a minute ago.</p>
    </div>
    <div class="cap-page-head-actions">
      <button type="button" class="cap-btn">Preview</button>
      <button type="button" class="cap-btn" data-variant="primary">Save</button>
    </div>
  </header>
</div>

API reference

PageHead

PropTypeRequiredDoes
crumbsBreadcrumbItem[]Levels above this page, first to current. Fewer than two levels draws no trail (a hub).
renderLinkBreadcrumbProps["renderLink"]Draw a trail link with the app's router link; passed to the Breadcrumb.
titleReactNodeYesThe page's one h1.
leadReactNodeOne line saying what the page is for.
actionsReactNodeThe page's actions, at the right (buttons and links).
headingLevel"h1" | "h2" | "h3"The title's level: the page's one h1, or lower where the page already has one (a states page's specimen, a view inside another page).
patchPatchOptionsA round patch beside the title (manual.md, Patch), for a page that is one of its part's members.

Parts and data attributes

ClassIs
.cap-page-headthe root
.cap-page-head-actionsa part
.cap-page-head-leada part
.cap-page-head-texta part
.cap-page-head-titlea part

Accessibility

KeyDoes
TabMoves through the trail's links, then the actions, in reading order
  • A header inside main is not a banner landmark, so it adds no landmark; the h1 is the page's heading.
  • The title is --text on the ground and the lead is --muted; both are in the contrast report's pairs.
  • The trail is its own nav named "Breadcrumb".