Skip to content

Hero

Edit on GitHub
@volvo-cars/css v2.3.0

Heroes are full-width blocks for prominent page-level messaging. Use text-hero for text-only layouts or media-hero when pairing content with an image or video.

The text hero is a full-height block with the title at the top and body + actions pushed to the bottom. The vertical gap between title and body is flexible — it grows with the element’s height.

volvocars.com
<section class="text-hero" style="min-height: 740px">
<h1 slot="title">Care. By Volvo</h1>
<div slot="body">
<p>All-electric Volvo EX60</p>
<p>
A transparent monthly cost that includes service and financing. Now with
free home charging.
</p>
</div>
<div slot="action" class="button-group">
<a class="button-filled" href="#">Choose your EX60</a>
<a class="button-outlined" href="#">Read more</a>
</div>
</section>

This component uses slots to give content built-in styling.

  • slot="title" - Primary heading
  • slot="body" - Supporting text
  • slot="action" - Buttons or links
volvocars.com
<section class="text-hero" style="min-height: 600px">
<code slot="title">title</code>
<code slot="body">body</code>
<code slot="action">action</code>
</section>

The text hero requires explicit height to create the flexible gap between the title and body+action. Without height, the body collapses directly below the title.

The recommended minimum height is 80vh.

Set height via:

  • Inline style: min-height: 80vh
  • Utility class: min-h-full (inside a sized parent)
  • Layout context: when placed in a grid or flex container that assigns height

The media hero presents a heading, body text, and action buttons above a full-width media element. On mobile the content stacks vertically; on large screens the heading occupies the left half while body and actions sit on the right.

Use a semantic <section> element (or <div>) as the root.

volvocars.com
<section class="media-hero">
<h1 slot="title">Care. By Volvo</h1>
<div slot="body">
<p>All-electric Volvo EX60</p>
<p>A transparent monthly cost that includes service and financing.</p>
<p>Now with free home charging.</p>
</div>
<div slot="action" class="button-group">
<a class="button-filled" href="#">Choose your EX60</a>
<a class="button-outlined" href="#">Read more</a>
</div>
<img slot="media" src="/images/decorative/ex60-road.avif" alt="" />
</section>

This component uses slots to give content built-in styling.

  • slot="title" - Primary heading
  • slot="body" - Supporting text
  • slot="action" - Buttons or links
  • slot="media" - Image or video
volvocars.com
<section class="media-hero">
<code slot="title">title</code>
<code slot="body">body</code>
<code slot="action">action</code>
<div
slot="media"
style="aspect-ratio: 1/1"
class="bg-feedback-gray flex items-center justify-center"
>
<code>media</code>
</div>
</section>

The media slot includes responsive default aspect ratios that adapt across breakpoints:

BreakpointAspect ratioToken
sm1:1Square, mobile-optimized
md3:2Landscape, tablet
lg, xl21:9Desktop

These defaults can be overridden with aspect ratio utility classes on the media element:

<!-- Override to use 16:9 on all breakpoints -->
<img slot="media" class="aspect-16/9" src="…" alt="" />
<!-- Override only on desktop -->
<img slot="media" class="lg:aspect-16/9" src="…" alt="" />

The button-group class provides responsive button layout:

  • Buttons sit side by side when there’s enough space
  • Buttons grow to full width in containers narrower than 30rem
  • Use semantic elements: <section> for page sections, <div> when no semantic meaning is needed
  • Choose the appropriate heading level (<h1>, <h2>) based on the page hierarchy
  • Ensure action links and buttons have meaningful text describing their destination or purpose
ClassDescription
text-heroRoot class. Flex column with title at top, body+action pushed to bottom via auto margin.
media-heroRoot class. Single-column grid on mobile, two-column grid on desktop. Content above full-width media.
button-groupLayout class for the action slot. Provides responsive side-by-side button layout.