One sticky header across every public, app and admin page in the family, with logo and links.
<div data-mount="lh-public"></div>
Installation
// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/site-header.css";
import { enhance } from "capsomer/behavior/site-header";
enhance();import "capsomer/tokens.css";
import "capsomer/site-header.css";
import { SiteHeader, SiteTabs } from "capsomer/react/site-header";Usage
<header class="cap-site-header" data-cap="site-header" data-links="right" data-band="dark" [data-collapse="lg"] [data-sheet-icons="auto"] [data-scrolled, set by the behavior]>
<a class="cap-site-header-skip" href="#main">Skip to content</a>
<a class="cap-site-header-logo" href="/" aria-label="Foxhound">[mark, wordmark]</a>
<div class="cap-site-header-switcher">
<button type="button" class="cap-site-header-switch" data-cap-part="panel-trigger" aria-expanded="false" aria-controls="sw-business" aria-label="Business: Acme Supply Co."><span class="cap-site-header-switch-tile" data-tile="A" aria-hidden="true"></span><span>Acme Supply Co.</span>[chevron]</button>
<div class="cap-site-header-panel" id="sw-business" popover="manual" role="group" aria-label="Businesses">[the site's panel]</div>
<span class="cap-site-header-sep" aria-hidden="true">/</span>
[the product's button and panel]
</div>
<nav class="cap-site-header-sections" aria-label="Main">
<ul>
<li><a class="cap-site-header-link" href="/pricing" aria-current="page">Pricing</a></li>
<li><button type="button" class="cap-site-header-link" data-cap-part="panel-trigger" aria-expanded="false" aria-controls="books">Books[chevron]</button><div class="cap-site-header-panel" id="books" popover="manual" role="group" aria-label="Books">…</div></li>
</ul>
</nav>
<div class="cap-site-header-tools">
<div class="cap-site-header-search" data-cap-part="search"><a class="cap-site-header-icon cap-site-header-search-button" href="/search" aria-label="Search" data-cap-part="search-trigger">[glyph][tip]</a><div class="cap-site-header-search-panel" data-align="end"><form role="search" aria-label="Search" action="/search" method="get">[glyph]<input type="search" name="q" placeholder="Search" aria-label="Search" autocomplete="off" enterkeyhint="search"></form></div></div>
<div class="cap-site-header-extras">
<button type="button" class="cap-site-header-icon" aria-label="Inbox, 4 need you">[18px glyph] <span class="cap-site-header-badge" aria-hidden="true">4</span><span class="cap-site-header-tip cap-popover" data-variant="tooltip" data-side="bottom" data-offset="6" popover="manual" role="tooltip" aria-hidden="true"><span class="cap-site-header-tip-text">Inbox</span></span></button>
<a class="cap-site-header-cta" href="/audit">Free audit</a>
</div>
[the theme button: theme-switch's button form, with the class cap-site-header-icon]
<div class="cap-site-header-account">
<button type="button" class="cap-site-header-icon cap-site-header-avatar" data-cap-part="panel-trigger" aria-expanded="false" aria-controls="account" aria-label="Your account"><span class="cap-site-header-initials" data-initials="SR" aria-hidden="true"><img class="cap-site-header-avatar-image" src="/avatars/sam.jpg" alt=""></span>[tip]</button>
<div class="cap-site-header-panel" id="account" popover="manual" data-align="end" role="group" aria-label="Your account">
<div class="cap-site-header-who"><strong>Sam Rivera</strong><small>sam@example.com</small></div>
<hr><div class="cap-site-header-panel-label">Acme Supply Co.</div><ul class="cap-site-header-panel-list">[links]</ul>
<hr><ul class="cap-site-header-panel-list"><li><button type="button" data-panel-close>Sign out</button></li></ul>
</div>
[signed out: <a class="cap-site-header-signin" href="/sign-in">[person glyph]<span class="cap-site-header-signin-text">Sign in</span></a>]
</div>
<button type="button" class="cap-site-header-icon cap-site-header-menu" aria-label="Menu" aria-haspopup="dialog" aria-expanded="false" aria-controls="sheet">[glyph]</button>
</div>
<dialog class="cap-dialog cap-site-header-sheet" data-cap="dialog" data-placement="bottom" id="sheet" aria-labelledby="sheet-title">
<div class="cap-dialog-header"><h2 id="sheet-title" class="cap-dialog-title cap-site-header-sheet-title" tabindex="-1">Foxhound menu</h2></div>
<div class="cap-dialog-body"><nav aria-labelledby="sheet-title">[.cap-site-header-sheet-label, ul.cap-site-header-sheet-list of rows: .cap-site-header-sheet-icon, .cap-site-header-sheet-name, .cap-site-header-count] [a.cap-site-header-sheet-cta]</nav></div>
<nav class="cap-site-header-sheet-account" aria-label="Account">[ul.cap-site-header-sheet-list]</nav>
[the dialog's Close button]
</dialog>
</header>
[the page]
<nav class="cap-site-tabs" aria-label="Your reading">[up to five links: icon, label, .cap-site-header-badge]</nav><SiteHeader
logo={{ href: "/", label: "Foxing", mark: <FoxMark /> }}
links="center"
translucent
sections={[{ id: "books", label: "Books", panel: <BooksPanel />, groups: [...] }, { id: "clubs", label: "Clubs", href: "/clubs" }]}
extras={[{ id: "search", label: "Search", icon: <SearchIcon />, onClick: openSearch, keys: "/" }, { id: "join", label: "Join free", kind: "button", href: "/join" }]}
signIn={{ href: "/sign-in" }}
skipTo="#main"
/><li><form class="cap-site-header-form" method="post" action="/sign-out"><input type="hidden" name="token" value="…"><button type="submit" data-panel-close>Sign out</button></form></li>
<li><form class="cap-site-header-form" method="post" action="/switch"><input type="hidden" name="workspace" value="w2"><button type="submit" data-panel-close>Field Office</button></form></li>
<li><form class="cap-site-header-form" method="post" action="/switch"><button type="button" data-panel-close aria-current="true">Example Press</button></form></li><SiteHeader
logo={{ href: "/", label: "Example Press" }}
switchers={[{ id: "workspace", label: "Example Press", name: "Switch workspace: Example Press", tile: "E",
groups: [{ label: "Workspaces", links: [
{ id: "w1", label: "Example Press", action: "/switch", fields: { workspace: "w1" }, current: true },
{ id: "w2", label: "Field Office", action: "/switch", fields: { workspace: "w2" } },
] }] }]}
sections={[{ id: "topics", label: "Topics", panelSize: "wide", panelClassName: "site-topics", panel: <TopicsPanel /> }]}
account={{ name: "Alex Rivera", initials: initialsOf("Alex Rivera"), signOutAction: "/sign-out", signOutFields: { token } }}
themeCookie="site_theme"
onThemeSave={signedIn ? (theme) => fetch("/api/theme", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ theme }) }) : undefined}
/>Examples
The family letterhead in your admin: the logo and names, search, the theme, the inbox and the account in the corner, where you are and View site in the second row
<div data-mount="lh-admin"></div>
Phone: the family letterhead keeps its links row, which swipes; search is its icon
<div data-mount="lh-public"></div>
Amber site, public, signed out: a dark band in both themes, links on the right before a divider, Free audit, the theme, Sign in last
<div data-mount="fh-public"></div>
Amber site, a user's dashboard: the business tile and the product switcher, no strip, the 288px menu, the avatar last
<div data-mount="fh-dashboard"></div>
Amber site, the dashboard's account menu: the business's rows under its name, Help, Sign out last
<div data-mount="fh-dashboard-account"></div>
Amber site, the business switcher open
<div data-mount="fh-dashboard-switcher"></div>
Amber site, your admin: the strip of apps and badges, the 232px menu, Search and Inbox in the header, no switcher
<div data-mount="fh-admin"></div>
Fox site, public, signed out: a translucent band, links centered, Search and Join free, the theme, Sign in last
<div data-mount="fx-public"></div>
Fox site, clear at rest: no ground or line at the top of the page, the band once it is stuck
<div data-mount="fx-rest-clear"></div>
Fox site, the Books panel open: the site's own panel, under its button
<div data-mount="fx-books"></div>
Fox site, signed in: the bell joins Search, the avatar last
<div data-mount="fx-reader"></div>
Fox site, the account menu as the site draws it
<div data-mount="fx-reader-account"></div>
Fox site, your admin: the same strip, extras and account as every admin
<div data-mount="fx-admin"></div>
Phone: amber site, public, signed out: the logo, the theme, Sign in as an icon, the menu button last
<div data-mount="fh-public"></div>
Phone: amber site, a user's dashboard, with the bottom bar
<div data-mount="fh-dashboard"></div>
Phone: amber site, the dashboard's sheet: the switchers, every page, the account pinned under them
<div data-mount="fh-sheet"></div>
Phone: amber site, your admin: Search and Inbox in the top row
<div data-mount="fh-admin"></div>
Phone: fox site, public: Search, the theme, Sign in, the menu button; no second row of links
<div data-mount="fx-public"></div>
Phone: fox site, the sheet: Books and Celebrity Picks grouped, the other links, Join free full width
<div data-mount="fx-sheet"></div>
Phone: fox site, signed in, with the bottom bar of five tabs
<div data-mount="fx-reader"></div>
Phone: fox site, your admin
<div data-mount="fx-admin"></div>
Written by hand: the same header as plain HTML, enhanced by the behavior module
<div class="sh-site" data-family="amber">
<header class="cap-site-header" data-cap="site-header" data-links="right" data-band="dark" data-markup="">
<a class="cap-site-header-skip" href="#main">Skip to content</a>
<a class="cap-site-header-logo" href="#home" aria-label="Foxhound"><span class="sh-fh-wordmark" aria-hidden="true">fo<em>x</em>hound</span></a>
<nav class="cap-site-header-sections" aria-label="Main">
<ul>
<li>
<button type="button" class="cap-site-header-link" data-cap-part="panel-trigger" aria-expanded="false" aria-controls="markup-products">Products<svg class="cap-site-header-chev" viewBox="0 0 24 24" aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg></button>
<div class="cap-site-header-panel" id="markup-products" popover="manual" role="group" aria-label="Products">
<ul class="cap-site-header-panel-list">
<li><a href="#recovery">Recovery</a></li>
<li><a href="#disputes">Disputes</a></li>
<li><a href="#intelligence">Intelligence</a></li>
</ul>
</div>
</li>
<li><a class="cap-site-header-link" href="#pricing" aria-current="page">Pricing</a></li>
<li><a class="cap-site-header-link" href="#docs">Docs</a></li>
</ul>
</nav>
<div class="cap-site-header-tools">
<div class="cap-site-header-extras"><a class="cap-site-header-cta" href="#audit">Free audit</a></div>
<button type="button" class="cap-theme-button cap-site-header-icon cap-site-header-theme" data-cap="theme-switch" data-variant="button" data-cap-pref="cap-theme-specimen-markup" aria-label="Switch to dark theme">
<svg class="cap-theme-icon" data-show="light" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z" /></svg>
<svg class="cap-theme-icon" data-show="dark" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" /></svg>
<span class="cap-theme-tip cap-popover" data-variant="tooltip" data-side="bottom" data-offset="6" popover="manual" role="tooltip" aria-hidden="true"><span class="cap-theme-tip-text">Switch to dark theme</span></span>
</button>
<div class="cap-site-header-account">
<a class="cap-site-header-signin" href="#sign-in"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="8" r="4" /><path d="M4 21c1.5-4 4.5-6 8-6s6.5 2 8 6" /></svg><span class="cap-site-header-signin-text">Sign in</span></a>
</div>
<button type="button" class="cap-site-header-icon cap-site-header-menu" aria-label="Menu" aria-haspopup="dialog" aria-expanded="false" aria-controls="markup-sheet"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h16" /></svg></button>
</div>
<dialog class="cap-dialog cap-site-header-sheet" data-cap="dialog" data-placement="bottom" data-size="md" id="markup-sheet" aria-labelledby="markup-sheet-title">
<div class="cap-dialog-header"><h2 id="markup-sheet-title" class="cap-dialog-title cap-site-header-sheet-title" tabindex="-1">Foxhound menu</h2></div>
<div class="cap-dialog-body">
<nav aria-labelledby="markup-sheet-title">
<div class="cap-site-header-sheet-label">Products</div>
<ul class="cap-site-header-sheet-list">
<li><a href="#recovery"><span class="cap-site-header-sheet-icon" aria-hidden="true"></span><span class="cap-site-header-sheet-name">Recovery</span></a></li>
<li><a href="#disputes"><span class="cap-site-header-sheet-icon" aria-hidden="true"></span><span class="cap-site-header-sheet-name">Disputes</span></a></li>
</ul>
<div class="cap-site-header-sheet-label">More</div>
<ul class="cap-site-header-sheet-list">
<li><a href="#pricing" aria-current="page"><span class="cap-site-header-sheet-icon" aria-hidden="true"></span><span class="cap-site-header-sheet-name">Pricing</span></a></li>
<li><a href="#docs"><span class="cap-site-header-sheet-icon" aria-hidden="true"></span><span class="cap-site-header-sheet-name">Docs</span></a></li>
</ul>
<a class="cap-site-header-sheet-cta" href="#audit">Free audit</a>
</nav>
</div>
<nav class="cap-site-header-sheet-account" aria-label="Account">
<ul class="cap-site-header-sheet-list">
<li><a href="#sign-in"><span class="cap-site-header-sheet-icon" aria-hidden="true"></span><span class="cap-site-header-sheet-name">Sign in</span></a></li>
</ul>
</nav>
<button type="button" class="cap-btn cap-dialog-close" data-variant="quiet" data-icon-only="" data-cap-part="close" aria-label="Close"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path d="M4 4l8 8M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg></button>
</dialog>
</header>
<main class="sh-hero" id="main" tabindex="-1">
<p class="sh-eyebrow">Written by hand</p>
<h1>The same contract, with no framework.</h1>
<p class="sh-lead">The behavior module wires the panel, the theme button, the tips and the sheet.</p>
</main>
</div>
Written by the server, no hydration: the React header sent as HTML and wired by the behavior module, a workspace switcher whose rows post, Guides in groups, Topics as a wide panel, Sign out a form post
<div data-static=""></div>
No hydration, the wide panel open: the site's own layout in a mega-menu's room
<div data-static=".cap-site-header-sections [aria-controls$='topics']"></div>
No hydration, the switcher open: each workspace is a form that posts, the current one posts nothing
<div data-static=".cap-site-header-switch"></div>
No hydration, the account menu open: the initials, the rows, Sign out a form post
<div data-static=".cap-site-header-avatar"></div>
Phone, no hydration: the button extra kept in the top row (data-phone=bar), the sheet holding the rest
<div data-static=""></div>
A site's own look by tokens and slots: a 64px band whose bar keeps to a 72rem column, semibold links, the site's own Get a quote, no account, a hairline once the page scrolls
<div data-static="" data-own=""></div>
The same site under 1024px (data-collapse=lg): the phone's row and its sheet, whose rows have no icons and so no icon column
<div data-static=".cap-site-header-menu" data-own=""></div>
API reference
SiteHeader
| Prop | Type | Required | Does |
|---|---|---|---|
logo | HeaderLogo | Yes | |
switchers | HeaderSwitcher[] | ||
sections | HeaderSection[] | ||
links | "left" | "center" | "right" | Where the section links sit: after the switcher (left), centered in the header (center), or on the right before the extras, after a thin divider (right). | |
extras | HeaderExtra[] | ||
theme | boolean | The theme button; on by default. themeKey is the single key the header binds to switch it ("T"), shown in its tip; leave it out where the site does not bind single keys. A person's choice is kept in this browser (themePrefKey), in the site's cookie (themeCookie, so its server renders the next page in it) and by the site's own save (onThemeSave, the signed-in account); themeInitial is what the server rendered (theme-switch.md). | |
themePrefKey | string | ||
themeKey | string | ||
themeCookie | string | ||
onThemeSave | ThemeSave | ||
themeInitial | ThemeChoice | ||
themeAction | string | The site's theme route: the theme is then the no-script form (ThemeForm), two submit buttons posting there, for a site that must switch with no script (dustinedwards.info's /theme). | |
account | HeaderAccount | Signed in: the avatar menu. Signed out: Sign in holds its place, last. | |
signIn | { href: string; label?: string } | ||
variant | "letterhead" | The family letterhead: the band in the page's text color under the family's stripe, the names beside the mark, the section links in a second row at every width (components/site-header). | |
search | { action: string; label: string; name?: string; suggest?: Suggest } | Search: an icon linking to action (the site's search page) that opens a field under it, the query sent as name (default "q"). label names it and is its placeholder ("Search Capsid"). suggest answers each query as it is typed, and its matches drop down under the field (wireSearch). | |
trail | { crumbs: Array<{ label: string; href?: string; current?: boolean }>; viewSite?: string } | An admin's second row in the letterhead: where you are, and View site. | |
collapse | "lg" | The width under which the bar becomes the phone's one row with the menu sheet: 768px by default; "lg" is 1024px, for a bar whose links need more room (data-collapse="lg"). | |
sheetIcons | "auto" | "auto": the sheet drops its 24px icon column when no row has an icon (data-sheet-icons="auto"). By default every row keeps the column. | |
menuIcon | ReactNode | The menu button's glyph, for a site whose own differs (bsw's three lines 6px apart); by default the family's. | |
band | "dark" | The band: dark in both themes, and translucent over the page. | |
translucent | boolean | ||
rest | "clear" | Clear at rest: no ground or line until the header is stuck (a scroll-state query). | |
sticky | boolean | Off only for a header drawn inside a frame that scrolls itself (a specimen). | |
skipTo | string | The skip link's target, first in the tab order ("#main"). | |
sheetStart | SheetPart | The site's own rows at the top of the phone's sheet (in your admin, the family's apps), and what follows the switchers and the section links (in your admin and a dashboard, the menu). A function is given the sheet's close, for its links. | |
sheetEnd | SheetPart | ||
sheetTitle | string | The sheet's heading; default "<name> menu". | |
sheetLinksLabel | string | null | The label over the plain section links in the sheet: "Pages", or "More" after grouped sections. null shows none (a one-list sheet). | |
navLabel | string | The section links' nav name: "Main" by default. | |
hydrate | boolean | False on a page React never runs on in the browser (a public plane that does not hydrate): the header is written for capsomer/behavior/site-header's enhance() to wire, every panel opens with no script at all (popovertarget), and nothing here wires itself. | |
renderLink | (props: LinkProps) => ReactNode | ||
attributes | Record<`data-${string}`, string> | The site's own data attributes on the <header> (a command palette's hooks, say). Only data-* names: the header's own attributes are set after these and win. | |
toolsEnd | ReactNode | The site's own markup in the tools, after the theme control and the account (before the phone's menu button), and at the very end of the <header>: an island's <template>, say. | |
end | ReactNode |
SiteTabs
| Prop | Type | Required | Does |
|---|---|---|---|
tabs | HeaderLink[] | Yes | |
label | string | ||
renderLink | (p: LinkProps) => ReactNode |
Functions
| Function | Signature | Does |
|---|---|---|
stepIndex | (count: number, at: number, key: string): number | null | The next item for a key in a panel of count items with at focused (-1: none yet). Returns null for a key that does not move. Up and Down wrap; Home and End go to the ends. |
panelItems | (panel: HTMLElement): HTMLElement[] | The items a panel holds that a person can reach: links and enabled buttons that are drawn. |
closePanels | (except?: HTMLElement | undefined): void | |
placePanel | (trigger: HTMLElement, panel: HTMLElement): void | Puts a panel under its button, lined up with the button's edge (start, or end with data-align="end"), its top just under the header's bottom edge so it never covers the header. |
dismissOutside | (on: On, trigger: HTMLElement, panel: HTMLElement, close: () => void): void | Focus leaving an open panel for anything but its button closes it, as does a press outside both. |
wirePanel | (trigger: HTMLElement, panel: HTMLElement): () => void | |
guardForms | (root: HTMLElement): () => void | A form in a panel or the sheet (Sign out, an account switch, any item that posts) sends once: a second press before the next page arrives is dropped, so two posts never race (Foxhound's account switch). A page restored from the back-forward cache can send again. |
wireThemeKey | (header: HTMLElement, key: string): () => void | The theme key (data-cap-theme-key on the header, "T"), where the site binds single keys: not while a person types, and off with the shortcuts switch. It presses the header's theme button (whichever form it takes), so the key keeps the choice exactly as the button does. |
wireScrolled | (header: HTMLElement): () => void | Keeps data-scrolled on the header while the page is scrolled down, for the site's scrolled look (--header-scrolled-edge, --header-scrolled-mix, --header-scrolled-shadow). Behavior only: the defaults draw nothing new. |
openSheet | (header: HTMLElement): void | Opens the phone's sheet (the shared dialog, from the bottom) from the menu button. |
closeSheet | (header: HTMLElement): void | |
enhance | (root?: Element | Document, { suggest }?: { suggest?: Suggest | undefined; }): () => void | Attaches to every [data-cap="site-header"] under root not yet attached: each panel, each icon control's tip, search (answered by suggest, the site's own), the menu button and its sheet. Returns a function that detaches them all. Document | Element rather than ParentNode, so a site with the Workers types can pass an element. |
wireSearchOnDemand | (search: HTMLElement, suggest?: Suggest | undefined): () => void | Wires a header's search (wireSearch, site-header-search.ts), loading that module on demand so a site without search never downloads it. Until it arrives, or if it fails to, the icon is the link to the search page it always is; a failed load reaches the page's error reporting. Returns a function that unwires it. |
searchHtml | ({ action, label, name, }: { action: string; label: string; name?: string | undefined; }): string | The search icon and its panel, as letterheadHtml writes them and the React header draws them. |
letterheadHtml | ({ name, agency, home, mark, links, current, search, skipTo, theme, }: LetterheadOptions): string | A public page's letterhead as HTML: plain string building, so a static build or a server writes the same markup as the React header (Dustin, 2026-10-27). enhance and the theme switch wire it. |
badgeText | (count: number): string | A count is a glance, not a figure: past 99 it says 99+, in the header, the sheet, the bottom bar and the admin shell alike; the accessible name keeps the real count. |
isOpen | (panel: HTMLElement): boolean |
CSS variables
| Variable | Default |
|---|---|
--_bubble | var(--space-5) |
--cap-popover-x | 0px |
--cap-popover-y | 0px |
--header-accent | var(--accent) |
--header-avatar | var(--accent-12) |
--header-avatar-fg | var(--ground) |
--header-bg | var(--ground) |
--header-blur | 12px |
--header-chev-size | var(--fs-small) |
--header-cta | var(--primary) |
--header-cta-fg | var(--primary-fg) |
--header-cta-order | 0 |
--header-edge | var(--header-line) |
--header-fg | var(--text) |
--header-fg-muted | var(--muted) |
--header-fs | var(--fs-body) |
--header-hover | color-mix(in srgb, var(--header-bg), var(--header-fg) 12%) |
--header-icon-bg | none |
--header-icon-glyph | 18px |
--header-icon-size | 36px |
--header-icon-stroke | 1.6 |
--header-inset | max(var(--header-side), (100% - var(--header-max-inline-size)) / 2 + var(--header-side)) |
--header-line | var(--line) |
--header-link-current-weight | var(--weight-medium) |
--header-link-gap | var(--space-2) |
--header-link-pad | 0 |
--header-link-weight | var(--weight-regular) |
--header-links-gap | 20px |
--header-max-inline-size | 100% |
--header-menu-bg | var(--header-icon-bg, none) |
--header-menu-glyph | var(--header-icon-glyph, 18px) |
--header-menu-line | var(--header-line) |
--header-menu-size | var(--header-icon-size, 36px) |
--header-names | 19.75rem |
--header-panel-w | 40rem |
--header-row | 4rem |
--header-row-2 | 3rem |
--header-scrolled-edge | var(--header-edge) |
--header-scrolled-mix | var(--header-translucent-mix) |
--header-scrolled-shadow | none |
--header-sep | block |
--header-sheet-label-case | none |
--header-sheet-label-fs | var(--fs-detail) |
--header-sheet-label-ink | var(--muted) |
--header-sheet-label-tracking | normal |
--header-sheet-label-weight | var(--weight-medium) |
--header-sheet-row-fs | var(--fs-body) |
--header-sheet-row-h | max(var(--control), var(--target)) |
--header-side | var(--space-6) |
--header-slot | calc(36px + var(--space-4)) |
--header-stripe | var(--space-3) |
--header-theme-order | 0 |
--header-tools-gap | var(--space-3) |
--header-translucent-mix | 85% |
Parts and data attributes
| Class | Is |
|---|---|
.cap-site-header | the root |
.cap-site-header-account | a part |
.cap-site-header-agency | a part |
.cap-site-header-app | a part |
.cap-site-header-avatar | a part |
.cap-site-header-avatar-image | a part |
.cap-site-header-badge | a part |
.cap-site-header-chev | a part |
.cap-site-header-count | a part |
.cap-site-header-cta | a part |
.cap-site-header-extras | a part |
.cap-site-header-form | a part |
.cap-site-header-ground | a part |
.cap-site-header-icon | a part |
.cap-site-header-initials | a part |
.cap-site-header-link | a part |
.cap-site-header-logo | a part |
.cap-site-header-mark | a part |
.cap-site-header-menu | a part |
.cap-site-header-name | a part |
.cap-site-header-names | a part |
.cap-site-header-panel | a part |
.cap-site-header-panel-label | a part |
.cap-site-header-panel-list | a part |
.cap-site-header-result-all | a part |
.cap-site-header-result-detail | a part |
.cap-site-header-result-kind | a part |
.cap-site-header-result-title | a part |
.cap-site-header-results | a part |
.cap-site-header-results-empty | a part |
.cap-site-header-sections | a part |
.cap-site-header-sep | a part |
.cap-site-header-sheet | a part |
.cap-site-header-sheet-account | a part |
.cap-site-header-sheet-cta | a part |
.cap-site-header-sheet-icon | a part |
.cap-site-header-sheet-label | a part |
.cap-site-header-sheet-list | a part |
.cap-site-header-sheet-name | a part |
.cap-site-header-sheet-title | a part |
.cap-site-header-signin | a part |
.cap-site-header-signin-text | a part |
.cap-site-header-skip | a part |
.cap-site-header-switch | a part |
.cap-site-header-switch-tile | a part |
.cap-site-header-switcher | a part |
.cap-site-header-theme | a part |
.cap-site-header-tools | a part |
.cap-site-header-trail | a part |
.cap-site-header-view | a part |
.cap-site-header-who | a part |
| Attribute | Values |
|---|---|
data-align | end |
data-band | dark |
data-collapse | lg |
data-current | present or absent |
data-highlighted | present or absent |
data-links | center right |
data-logo-fill | on |
data-phone | bar |
data-placed-by | present or absent |
data-rest | clear |
data-scrolled | present or absent |
data-sheet-icons | auto |
data-size | wide |
data-sticky | false |
data-translucent | present or absent |
data-variant | letterhead |
| State | Read from |
|---|---|
:empty | the platform |
:focus | the platform |
:focus-visible | the platform |
:focus-within | the platform |
:hover | the platform |
:popover-open | the platform |
[aria-current="page"] | an attribute |
[aria-current="true"] | an attribute |
[aria-current] | an attribute |
[aria-expanded="true"] | an attribute |
Accessibility
| Key | Does |
|---|---|
| Tab | The skip link, the logo, the switcher, the section links, the extras, the theme, the account; then (in your admin) the strip, the menu, the page |
| Enter or Space on the switcher, a section with children or the account | Opens its panel; focus moves to its first item |
| Down or Up on one of those buttons | Opens its panel on its first or last item (as a menu button's keys do, WAI-ARIA APG) |
| Up and Down in a panel | Move between items (they wrap); Home and End go to the ends |
| Esc | Closes the panel; focus returns to its button. Closes the sheet; focus returns to the menu button. A panel opened by hover that closes as the pointer leaves leaves focus where it was |
| Back or Forward | Closes any open panel and the sheet, as following a link does |
| Tab past a panel's last item | Closes the panel and goes on |
| T | Switches the theme, where the site binds single keys (themeKey); off with the shortcuts switch |
- The header is the page's
bannerlandmark. The section links are anavnamed "Main"; the sheet's list is anavnamed by its heading and its pinned rows anavnamed "Account"; the bottom bar anavnamed by the site ("Sections"). - The current page is
aria-current="page"; a section with children that holds the current page shows its underline too. - The theme button says what it does: "Switch to dark theme" while the page is light. A count is in its control's name: "Inbox, 4 need you"; the bubble shows 99+ past 99, and the name starts with what is seen: "Inbox 99+, 120 need you". The visible label and count are words of the name in order, a space between them in the HTML (WCAG 2.5.3, as axe-core 4.14 reads it, aria-hidden text included). The business tile's letter and the avatar's initials are drawn from
data-tileanddata-initials, not text, so they do not count as part of the visible label. - Forced colors: the current link keeps its underline, the band keeps its edge, a bubble is drawn in system colors.
- The tests measure the painted contrast of the links, the current link's underline, the icon controls, Sign in and the button extra on both bands in both themes.