Playground

Hero block

A page opener with eyebrow, title, description, actions and optional media.

  • Built on native elements
  • A section named by its title through aria-labelledby.
  • The title is a real heading; headingLevel sets the outline level (h1 by default).
  • Media is passed in: give images alt text.
  • Styles in one file: container.css

Import

import '@monoline/css';
import {BlockHero} from '@monoline/react';

Not installed yet? Pick a route.

Copies the source and its styles into your project.

npx monoline add block-hero

Usage

import {BlockHero, Button} from '@monoline/react';

<BlockHero
  eyebrow="Version 1.0"
  title="Interfaces with fewer parts"
  description="A small kit of plain components. Copy the ones you need."
  actions={<><Button variant="solid">Get started</Button><Button variant="line">Read the docs</Button></>}
  media={<div style={{border: '1px solid var(--rule)', aspectRatio: '4 / 3', display: 'grid', placeItems: 'center'}}>Preview</div>}
/>

Examples

Left aligned

Centred

Props

BlockHeroProps

PropTypeDefaultDescription
eyebrowReactNode–Optional small line above the title, for example a category or announcement.
title requiredReactNode–The main headline of the page.
descriptionReactNode–Optional muted supporting text under the title.
actionsReactNode–Buttons or links. Make one of them the solid Button.
mediaReactNode–An image, screenshot or illustration shown beside (wide) or below (narrow) the copy.
align"center" | "start"'start'`start` (default) left-aligns the copy; `center` centres it.
headingLevel1 | 2 | 31Outline level of the title. A hero is usually the page's h1.

Data Attributes

State is exposed through attributes. Style it with these selectors, not with class toggles.

AttributeStylesheet
[data-align="center"]block-hero.css

CSS classes

ClassStylesheet
.containercontainer.css
.container-fullcontainer.css
.container-pagecontainer.css
.container-textcontainer.css
.headingheading.css
.heading-displayheading.css
.heading-lgheading.css
.heading-mdheading.css
.heading-smheading.css
.heading-xlheading.css
.texttext.css
.text-accenttext.css
.text-dangertext.css
.text-fulltext.css
.text-lgtext.css
.text-mdtext.css
.text-mutedtext.css
.text-oktext.css
.text-smtext.css
.text-successtext.css
.text-truncatetext.css
.text-warningtext.css
.text-xstext.css
.block-heroblock-hero.css
.block-hero-actionsblock-hero.css
.block-hero-copyblock-hero.css
.block-hero-descriptionblock-hero.css
.block-hero-eyebrowblock-hero.css
.block-hero-innerblock-hero.css
.block-hero-mediablock-hero.css
.headingblock-hero.css
.heading-displayblock-hero.css

Customization

Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.

app.css
.container {
  border-color: var(--accent);
}
.container[data-align="center"] {
  background: var(--wash);
}

Accessibility

  • A section named by its title through aria-labelledby.
  • The title is a real heading; headingLevel sets the outline level (h1 by default).
  • Media is passed in: give images alt text.