Skip to content

Hero

A landing page's first section, with eyebrow, h1, lead, actions, a note and an aside.

<div data-mount="start" id="sample-start"></div>

Installation

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

Usage

<section class="cap-hero" aria-labelledby="h" data-aside>
  <div class="cap-hero-text"><p class="cap-eyebrow" data-tone="accent">Release notes</p><h1 id="h" class="cap-hero-title">Every change, written down once</h1>
    <p class="cap-hero-lead">...</p><div class="cap-hero-actions">[button links]</div><p class="cap-hero-note">...</p></div>
  <div class="cap-hero-aside">[card or picture]</div>
</section>

Examples

Centered

<div data-mount="center" id="sample-center"></div>

On a card over a backdrop

<div data-mount="card" id="sample-card"></div>

API reference

Hero

PropTypeRequiredDoes
titleReactNodeYes
eyebrowReactNode
leadReactNode
childrenReactNodeMore between the lead and the actions: further paragraphs, a price line.
actionsReactNodeButtons or button links; the first is the primary.
noteReactNodeA short line under the actions ("No card needed").
asideReactNodeBeside the words from 60rem, under them before.
backdropReactNodeDecorative, behind everything; hidden from assistive technology.
align"start" | "center"Center the words (no aside). Default start.
cardbooleanThe words sit on a raised card over the backdrop (bsw's frosted card).
headingLevel"h1" | "h2"
idstringThe section's id, for a skip or "back to top" link.
classNamestring

CSS variables

VariableDefault
--_titlevar(--hero-title, clamp(2.25rem, 1.6rem + 3vw, 4rem))
--hero-card-bgcolor-mix(in srgb, var(--surface) 82%, transparent)
--hero-card-blur12px
--hero-card-max48rem
--hero-card-padvar(--space-7)
--hero-card-radiusvar(--radius-xl)
--hero-card-shadownone
--hero-faceinherit
--hero-gapvar(--space-8)
--hero-lead-faceinherit
--hero-lead-leadingvar(--leading-normal)
--hero-lead-sizevar(--title-4)
--hero-lead-weightvar(--weight-regular)
--hero-titleclamp(2.25rem, 1.6rem + 3vw, 4rem)
--hero-title-leadingvar(--leading-none)
--hero-title-trackingcalc(-1 * var(--tracking-wide))
--hero-title-weightrevert-layer

Parts and data attributes

ClassIs
.cap-herothe root
.cap-hero-actionsa part
.cap-hero-asidea part
.cap-hero-backdropa part
.cap-hero-bodya part
.cap-hero-leada part
.cap-hero-notea part
.cap-hero-texta part
.cap-hero-titlea part
AttributeValues
data-aligncenter
data-asidepresent or absent
data-cardpresent or absent

Accessibility

KeyDoes
TabThrough the actions
  • Screen readers: no manual NVDA or VoiceOver run, by decision (2026-11-07); the automated browser checks and a front-end review stand in. Automated: see the site's Tests page.