Skip to content
Content Blocks docsv0.8.0Website

Docs / Blocks

<content-hero-block>

A full width section with an image or video behind, or above, its text. Usually the first block on a page.

Import it on its own, for a bundler
import '@content-blocks/js/components/content-hero-block';

Examples

Background image

The simplest hero: a photo behind a heading and a line of text, at the bottom with vertical="bottom".

Open on its own
The road to Hollowmere The last keep still stands. Its gates wait for one rider.

Looping video

Give content-image an .mp4 and it plays muted on a loop, like a GIF, behind the text.

Open on its own
The world burns Ragnarök has begun. Someone has to answer.

Film in an overlay

The button opens a video in a content-overlay, and fill="#ex-hero-film" makes it cover the hero.

Open on its own
The long watch ▶

Anatomy

Content goes into the component's slots, chosen with the slot attribute on each child.

flowchart LR
  root["#lt;content-hero-block#gt;"]:::component
  root --> s0["<b>no slot (default)</b><br/>Default slot, same as content slot"]
  root --> s1["<b>slot=#quot;background#quot;</b><br/>This slot is usually either a video or image component."]
  root --> s2["<b>slot=#quot;content#quot;</b><br/>This slot will usually serve a text block."]
  classDef component fill:#141413,color:#faf9f5,stroke:#141413
The slots of <content-hero-block>
SlotWhat goes in it
(default)Default slot, same as content slot
slot="background"This slot is usually either a video or image component.
slot="content"This slot will usually serve a text block.

Properties

Set them as attributes. Those marked responsive take a value per breakpoint, separated by pipes and named or in order: 1|tablet=2 or 1|2. Seeresponsive values.

AttributeTypeDefaultDescription
classesresponsiveString–Classes to add to the component. Use pipes for different classes per breakpoint, by name or in order: classes="stacked|laptop=side-by-side".
content-positionresponsiveSelect

below · above

'above'Where the content sits: above, over the media, or below it. Over the media by default. Use pipes to change it per breakpoint, such as below|above for the text below the media on phones and over it from tablets.
paddingresponsiveString–Padding around the component, written as CSS padding. Use pipes for different padding per breakpoint, by name or in order: padding="1rem|tablet=2rem 4rem" or padding="1rem|2rem 4rem|3rem 5rem 4rem".

Events and methods

sequenceDiagram
  participant Page
  participant C as content-hero-block
  Page->>C: open event
What <content-hero-block> listens for and what it tells the page