Skip to content
Klarhimmel UI

Hero, prompt

Hero, prompt previewHero, prompt preview

Install

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

Centred headline with a prompt input as the call to action and suggestion chips. For AI products.

Import

Import

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

An opener built around an input: a prompt box, a site address field or a search, with suggestion chips below. It is for products where the visitor's first act is typing; for a plain pitch use hero-centered.

Writing for it

- Placeholder (120) and submit (20) are both required. Make the placeholder an example of a good answer, and set inputLabel (80) so the field has a proper accessible name. - Suggestions take up to five chips of 60 characters each; they should be real prompts a visitor could send as they are. - For a site address, set multiline to false and inputType to domain. The optional field adds a second labelled input under the prompt only when it has a label.

Watch out for

The sent and error states come from the status prop, which only the host can set; the block never decides on its own that a submit worked. Without action and method it does not submit natively.

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 HeroPrompt from '@/components/klarhimmel/blocks/hero-prompt';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <HeroPrompt 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.",
          "placeholder": "Describe what you want, in a line…",
          "submit": "Send",
          "suggestions": [
            "Give a first example request",
            "Give a second example request",
            "Give a third example request"
          ],
          "note": "Say what makes starting easy.",
          "messages": {
            "sent": "Confirm that the request arrived and what happens next.",
            "error": "Say that it failed and ask them to try again."
          }
        }} />
      </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.
descriptionPlacement'under-title' | 'under-note'-One of 'under-title', 'under-note'. Optional; empty is not rendered.
placeholderstring'Describe what you want, in a line…'Text, up to 120 characters.
submitstring'Send'Text, up to 20 characters.
suggestionsstring[]3 itemsList of up to 5. Optional; empty is not rendered.
notestring'Say what makes starting easy.'Text, up to 80 characters.
inputNamestring-Text, up to 40 characters. Optional; empty is not rendered.
multilineboolean-Optional; empty is not rendered.
inputType'text' | 'url' | 'domain'-One of 'text', 'url', 'domain'. Optional; empty is not rendered.
growboolean-Optional; empty is not rendered.
inputLabelstring-Text, up to 80 characters. Optional; empty is not rendered.
escapeLink-Optional; empty is not rendered.
escapePlacement'inside' | 'below'-One of 'inside', 'below'. Optional; empty is not rendered.
field{ label, name, placeholder, type, required, escape }-Fields: label (optional), name (optional), placeholder (optional), type ('text' | 'url' | 'domain') (optional), required (optional), escape (optional). Optional; empty is not rendered.
actionstring-Text, up to 300 characters. Optional; empty is not rendered.
method'post' | 'get'-One of 'post', 'get'. Optional; empty is not rendered.
hidden{ }-Optional; empty is not rendered.
captchaboolean-Optional; empty is not rendered.
captchaSitekeystring-Text, up to 100 characters. Optional; empty is not rendered.
status'idle' | 'sent' | 'error'-One of 'idle', 'sent', 'error'. Optional; empty is not rendered.
messages{ sent, error }{…}Fields: sent, error. Optional; empty is not rendered.
errors{ required, email, url, domain }-Fields: required (optional), email (optional), url (optional), domain (optional). Optional; empty is not rendered.
bareboolean-Optional; empty is not rendered.
attach{ label, accept, name, multiple }-Fields: label (optional), accept (optional), name (optional), multiple (optional). Optional; empty is not rendered.
tools{ label, icon, kind, name, href }[]-List of up to 2. Each item: label, icon ('globe' | 'bot' | 'sparkles' | 'image' | 'link') (optional), kind ('toggle' | 'link'), name (optional), href (optional). Optional; empty is not rendered.
height'auto' | 'screen'-One of 'auto', 'screen'. Optional; empty is not rendered.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.