Hero block
A page opener with eyebrow, title, description, actions and optional media.
SourceStyles source@monoline/react 0.5.0Markdown for AI toolsbeta
- 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
| Prop | Type | Default | Description |
|---|---|---|---|
eyebrow | ReactNode | – | Optional small line above the title, for example a category or announcement. |
title required | ReactNode | – | The main headline of the page. |
description | ReactNode | – | Optional muted supporting text under the title. |
actions | ReactNode | – | Buttons or links. Make one of them the solid Button. |
media | ReactNode | – | 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. |
headingLevel | 1 | 2 | 3 | 1 | Outline 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.
| Attribute | Stylesheet |
|---|---|
[data-align="center"] | block-hero.css |
CSS classes
| Class | Stylesheet |
|---|---|
.container | container.css |
.container-full | container.css |
.container-page | container.css |
.container-text | container.css |
.heading | heading.css |
.heading-display | heading.css |
.heading-lg | heading.css |
.heading-md | heading.css |
.heading-sm | heading.css |
.heading-xl | heading.css |
.text | text.css |
.text-accent | text.css |
.text-danger | text.css |
.text-full | text.css |
.text-lg | text.css |
.text-md | text.css |
.text-muted | text.css |
.text-ok | text.css |
.text-sm | text.css |
.text-success | text.css |
.text-truncate | text.css |
.text-warning | text.css |
.text-xs | text.css |
.block-hero | block-hero.css |
.block-hero-actions | block-hero.css |
.block-hero-copy | block-hero.css |
.block-hero-description | block-hero.css |
.block-hero-eyebrow | block-hero.css |
.block-hero-inner | block-hero.css |
.block-hero-media | block-hero.css |
.heading | block-hero.css |
.heading-display | block-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.