Skip to content
Klarhimmel UI

Call to action, over an image

Call to action, over an image previewCall to action, over an image preview

Install

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

A wide image with a solid panel laid over its lower left corner holding the headline, a sentence and two actions (stacked under the image on narrow screens).

Import

Import

import Block from '@/components/klarhimmel/blocks/cta-media';
Also called
  • cta/media
About
A wide image with a solid panel laid over its lower left corner holding the headline, a sentence and two actions (stacked under the image on narrow screens).
Category
One clear next step near the end of a page. New project? Set it up once: /get-started/installation.

Notes

When to use it

A wide photograph with a solid panel over its lower left corner holding the headline, a sentence and two buttons. The picture sets the mood; for a plain side-by-side layout, cta-split fits better.

Writing for it

- The title is required and holds 100 characters, the shortest limit of the CTA blocks with an image, because the overlay panel is only about 36rem wide. - The description allows 220 characters. One sentence is enough, since the panel covers part of the picture and every extra line covers more. - Choose a wide image that stays interesting with its lower left corner hidden; the media is cropped to a 16 to 7 frame at least 24rem tall.

Watch out for

The panel overlays the image only from the @3xl container width up; below that it stacks under the picture. The text sits on a solid ink panel, so the image colours cannot hurt contrast, but a missing alt text on the image is still your job.

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 CtaMedia from '@/components/klarhimmel/blocks/cta-media';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <CtaMedia props={{
          "title": "Say what the visitor can do next",
          "description": "Say in two sentences what the offer is and what the visitor gets from taking it up.",
          "primary": {
            "label": "Main action",
            "href": "#book"
          },
          "secondary": {
            "label": "Second action",
            "href": "#rooms"
          },
          "media": {
            "src": "/pictures/photo-food1.avif",
            "alt": "Caramelised figs on a white plate"
          }
        }} />
      </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 what the visitor can do next'Text, up to 100 characters.
descriptionstring'Say in two sentences what the offer…'Text, up to 900 characters.
primaryLink{…}Optional; empty is not rendered.
secondaryLink{…}Optional; empty is not rendered.
detailsLink[]-List of up to 4. Optional; empty is not rendered.
panel'dark' | 'light'-One of 'dark', 'light'. Optional; empty is not rendered.
overlapboolean-Optional; empty is not rendered.
bleedboolean-Optional; empty is not rendered.
mediaMedia{…}See the type.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.