Skip to content
Klarhimmel UI

Hero, flanked picture

Hero, flanked picture previewHero, flanked picture preview

Install

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

A centred heading, then one picture in the middle with a button on each side of it. On a phone the second action, the picture and the main action stack in that order.

Import

Import

import Block from '@/components/klarhimmel/blocks/hero-flanked-media';
Also called
  • hero/flanked-media
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

A short statement with one picture in the middle and a button on each side of it, for a page with exactly two choices. For one action under a picture use hero-media-foot.

Writing for it

- Title up to 100 characters, one line. - Both buttons are short verbs: the left one the quieter choice, the right one the main action. - The picture is 4 by 3 at a middle width, so give it a real subject.

Watch out for

The side buttons only sit beside the picture on a wide screen. On a phone they stack in source order around it, so the quieter choice comes first; do not rely on the sides to explain which is which.

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 HeroFlankedMedia from '@/components/klarhimmel/blocks/hero-flanked-media';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <HeroFlankedMedia props={{
          "title": "Say in one line what the page offers",
          "media": {
            "src": "/pictures/photo-spa1.avif",
            "alt": "A treatment room with a massage table by a window"
          },
          "secondary": {
            "label": "Second action",
            "href": "#more"
          },
          "primary": {
            "label": "Main action",
            "href": "#start"
          }
        }} />
      </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
titlestring'Say in one line what the page offers'Text, up to 100 characters.
mediaMedia{…}See the type.
secondaryLink{…}Optional; empty is not rendered.
primaryLink{…}Optional; empty is not rendered.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.