Skip to Content
Puzzle
PiecesComponents

Heroes

Responsive hero sections and layouts for websites, applications and landing pages.

Heroes

Heroes are introductory sections that establish the visual identity of a page.

Puzzle Pieces provides a flexible Hero component and a collection of specialized presets. All presets share the same underlying implementation, making them easy to customize without maintaining separate layouts.

Installation

Import the Hero components from Puzzle Pieces:

import {
  Hero,
  SplitHero,
  CenteredHero,
  FullScreenHero,
  ImageHero,
  VideoHero,
} from "@puzzle-ui/pieces";

Components

ComponentDescription
HeroGeneric hero component
SplitHeroText and media side by side
CenteredHeroCentered introduction
FullScreenHeroFull viewport introduction
VideoHeroBackground video
ImageHeroBackground image with overlay
MinimalHeroMinimal introduction
EditorialHeroEditorial layout
AgencyHeroAgency and consultancy websites
ProductHeroProduct introductions
SaaSHeroSaaS product websites
StoreHeroOnline stores and collections
RestaurantHeroRestaurants and hospitality
AccommodationHeroHotels and holiday accommodation
PrintShopHeroPrinting businesses
DashboardWelcomeHeroDashboard introductions
AppHeroWeb application introductions
CampaignHeroCampaign landing pages
ComingSoonHeroPre-launch pages
SearchHeroSearch-oriented websites

Basic usage

Use Hero for complete control over the layout and content.

390 × 844

Layouts

The Hero component supports four layout configurations.

Split

Text and media are displayed in separate columns.

390 × 844

Centered

Content is centered horizontally.

390 × 844

Full width

The inner container uses the full available width.

390 × 844

Asymmetric

The media and content columns use different proportions.

390 × 844

Media positioning

Control where media is displayed using mediaPosition.

ValueDescription
leftMedia before content
rightMedia after content
backgroundMedia behind content
390 × 844

Background media can also be supplied directly.

390 × 844

Height

Control the minimum height of the hero.

ValueDescription
autoContent determines the height
largeLarge introductory section
viewportMinimum height of the viewport
390 × 844

Themes

Hero supports four theme configurations.

ValueDescription
lightStandard light appearance
darkDark appearance
contrastContrasting surface appearance
brandPrimary brand appearance
390 × 844

Hero consumes semantic Puzzle Theme tokens for its background, foreground, typography and spacing.

Overlays

Overlays improve text readability when using background media.

ValueDescription
noneNo overlay
subtleSubtle overlay
strongStrong overlay
gradientDirectional gradient
390 × 844

Content

Hero supports several content slots.

Eyebrow

A short introductory label above the heading.

390 × 844

Description

Additional introductory text.

390 × 844

Actions

Use existing Puzzle UI components for buttons and other actions.

390 × 844

The search slot can contain any existing Puzzle form components.

390 × 844

Meta

Use meta for supplementary information such as availability, opening hours or product details.

390 × 844

Children

Additional content can be placed between the description and the action slots.

390 × 844

Responsive behavior

Hero automatically adapts its layout to smaller screens.

  • Split layouts become single-column layouts.
  • Asymmetric layouts become single-column layouts.
  • Media can move before content on mobile.
  • Typography uses responsive sizing.
  • Horizontal and vertical spacing adapt to available screen space.

Use reverseOnMobile to control the order of content and media.

390 × 844

Disable reversal when the content should remain before the media.

390 × 844

Specialized presets

Presets provide sensible defaults for common website types.

All presets inherit the properties of Hero and can be customized.

SplitHero

390 × 844

CenteredHero

390 × 844

FullScreenHero

390 × 844

VideoHero

390 × 844

Background videos are muted, loop automatically and respect the user's reduced-motion preference.

ImageHero

390 × 844

MinimalHero

390 × 844

EditorialHero

390 × 844

AgencyHero

390 × 844

ProductHero

390 × 844

SaaSHero

390 × 844

StoreHero

390 × 844

RestaurantHero

390 × 844

AccommodationHero

390 × 844

PrintShopHero

390 × 844

DashboardWelcomeHero

390 × 844

AppHero

390 × 844

CampaignHero

390 × 844

ComingSoonHero

390 × 844

SearchHero

390 × 844

Customization

All presets inherit the full Hero API.

For example, an AccommodationHero can use a split layout instead of its default background layout.

390 × 844

CSS customization

Hero uses regular CSS and semantic Puzzle Theme tokens.

The root element has the puzzle-hero class.

You can customize its appearance through CSS variables.

.custom-hero {
  --puzzle-hero-padding-inline: var(--puzzle-space-8);
  --puzzle-hero-padding-block: var(--puzzle-space-16);
  --puzzle-hero-gap: var(--puzzle-space-10);
  --puzzle-hero-background: var(--puzzle-color-surface);
  --puzzle-hero-foreground: var(--puzzle-color-text);
}

You can also target individual elements using their class names.

ClassElement
puzzle-heroRoot element
puzzle-hero__innerLayout container
puzzle-hero__contentContent container
puzzle-hero__titleMain heading
puzzle-hero__descriptionDescription
puzzle-hero__eyebrowEyebrow
puzzle-hero__mediaMedia container
puzzle-hero__backgroundBackground container
puzzle-hero__overlayBackground overlay
puzzle-hero__actionsAction container
puzzle-hero__searchSearch container
puzzle-hero__metaSupplementary information

Accessibility

Hero is designed to work with assistive technologies.

  • Uses semantic section elements by default.
  • Supports custom semantic elements through the as property.
  • Supports configurable heading levels through titleAs.
  • Supports accessible labels.
  • Decorative background images have empty alternative text.
  • Background videos are hidden from assistive technology.
  • Background videos respect prefers-reduced-motion.
  • Interactive content remains accessible through its original Puzzle components.

Always provide meaningful alternative text for informative images.

Use one primary heading per page where appropriate.

API reference

Hero properties

PropertyTypeDefault
asElementTypesection
titleAsElementTypeh1
idstring-
testIdstring-
classNamestring-
contentClassNamestring-
mediaClassNamestring-
styleCSSProperties-
layoutHeroLayoutsplit
mediaPositionHeroMediaPositionright
alignmentHeroAlignmentstart
heightHeroHeightauto
themeHeroThemelight
overlayHeroOverlaynone
contentWidthHeroContentWidthnormal
reverseOnMobilebooleantrue
eyebrowReactNode-
titleReactNode-
descriptionReactNode-
mediaReactNode-
backgroundImagestring-
backgroundVideoHeroVideoSource-
actionsReactNode-
searchReactNode-
metaReactNode-
childrenReactNode-
roleAriaRole-
ariaLabelstring-
ariaLabelledBystring-

HeroLayout

type HeroLayout = "centered" | "split" | "full-width" | "asymmetric";

HeroMediaPosition

type HeroMediaPosition = "left" | "right" | "background";

HeroAlignment

type HeroAlignment = "start" | "center" | "end";

HeroHeight

type HeroHeight = "auto" | "large" | "viewport";

HeroTheme

type HeroTheme = "light" | "dark" | "contrast" | "brand";

HeroOverlay

type HeroOverlay = "none" | "subtle" | "strong" | "gradient";

HeroContentWidth

type HeroContentWidth = "narrow" | "normal" | "wide" | "full";

HeroVideoSource

type HeroVideoSource = {
  src: string;
  type?: string;
  poster?: string;
};
;