Skip to content
Klarhimmel UI

Hero, centered

Hero, centered previewHero, centered preview

Install

npx shadcn add @klarhimmel/hero-centered
DetailsAbout, usage, props and more

Centered headline, description and two actions, with a wide framed image below.

Import

Import

import Block from '@/components/klarhimmel/blocks/hero-centered';
Also called
  • hero/centered
Category
The first screen: what it is, who it is for, what to do next. New project? Set it up once: /get-started/installation.

Notes

When to use it

The classic opener: centred headline, a description, two actions and a wide image below. Choose hero-split when the image should sit beside the text, and hero-minimal when there is no image.

Writing for it

- The title is the h1 of the page and holds 120 characters. State what the product does for the reader rather than its category. - Description holds 300 characters but reads as a lead paragraph, so two sentences is the useful length. The note (80) sits under the buttons for reassurance such as no card needed. - The media field is a wide framed image and its alt text is required in the defaults, so describe what the screenshot shows.

Watch out for

This block renders the page's only h1. Putting a second hero or another block with an h1 on the same page breaks the heading outline.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import HeroCentered from '@/components/klarhimmel/blocks/hero-centered';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <HeroCentered props={{
          "eyebrow": "Name what this is",
          "title": "Say what the visitor gets in one line",
          "description": "Say in one or two sentences what it does, who it is for and what the visitor can do next, in plain words.",
          "primary": {
            "label": "Main action",
            "href": "#start"
          },
          "secondary": {
            "label": "Second action",
            "href": "#demo"
          },
          "note": "Say what makes starting easy.",
          "media": {
            "src": "/pictures/scr-calendar.avif",
            "alt": "A month calendar with one day chosen",
            "srcDark": "/pictures/scr-calendar-dark.avif"
          }
        }} />
      </BlockSurface>
    </Theme>
  );
}

Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

PropTypeDefaultDescription
eyebrowstring'Name what this is'Text, up to 60 characters.
titlestring'Say what the visitor gets in one li…'Text, up to 120 characters.
descriptionstring'Say in one or two sentences what it…'Text, up to 300 characters.
primaryLink{…}Optional; empty is not rendered.
secondaryLink{…}Optional; empty is not rendered.
notestring'Say what makes starting easy.'Text, up to 80 characters.
tertiaryLink-Optional; empty is not rendered.
actionsLayout'stack' | 'stagger' | 'column'-One of 'stack', 'stagger', 'column'. Optional; empty is not rendered.
mediaMedia{…}Optional; empty is not rendered.
titleMediaMedia-Optional; empty is not rendered.
titleAfterstring-Text, up to 120 characters. Optional; empty is not rendered.
titleMediaWideboolean-Optional; empty is not rendered.
actionsBelowboolean-Optional; empty is not rendered.
align'center' | 'start'-One of 'center', 'start'. Optional; empty is not rendered.
titleSize'display' | 'section' | 'compact'-One of 'display', 'section', 'compact'. Optional; empty is not rendered.
fullHeightboolean-Optional; empty is not rendered.
narrowMediaboolean-Optional; empty is not rendered.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.