Skip to content
Klarhimmel UI

Contact, form grid

Contact, form grid previewContact, form grid preview

Install

npx shadcn add https://ui.klarhimmel.com/r/contact-form-grid.json
DetailsAbout, usage, props and more

A centred contact section: a two-part heading and a short line, then fields in two columns, a full-width message, and a row with a terms tick box and a send button.

Import

Import

import Block from '@/components/klarhimmel/blocks/contact-form-grid';
Also called
  • contact/form-grid
About
A centred contact section: a two-part heading and a short line, then fields in two columns, a full-width message, and a row with a terms tick box and a send button. One column on a phone.
Category
A form, a booking panel or office details. The page wires the submit. New project? Set it up once: /get-started/installation.

Notes

When to use it

A centred contact section with a two-part heading and a short line, then fields in two columns, a full-width message and a row with a terms tick box and a send button. Use contact-split when details should sit beside the form.

Writing for it

- Write each field's placeholder as the field's name, since it also names the field for assistive tech. - Put the short fields two to a row and leave the message full width. - Say in the line who the form is for and how soon the team answers.

Watch out for

The page wires the submit, so the block alone sends nothing. The terms tick box must link to real terms, and the form is one column on a phone.

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 ContactFormGrid from '@/components/klarhimmel/blocks/contact-form-grid';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <ContactFormGrid props={{
          "title": "Name the section",
          "titleStrong": "Name the business",
          "description": "Say in one or two sentences who this form is for, what they can ask and how soon the team answers.",
          "fields": [
            {
              "label": "The visitor’s first name",
              "type": "text",
              "required": true
            },
            {
              "label": "The visitor’s last name",
              "type": "text",
              "required": false
            },
            {
              "label": "Their company",
              "type": "text",
              "required": false
            },
            {
              "label": "Their role",
              "type": "text",
              "required": false
            },
            {
              "label": "Their email address",
              "type": "email",
              "required": true
            },
            {
              "label": "Their phone number",
              "type": "tel",
              "required": false
            }
          ],
          "messageLabel": "What the visitor wants to ask",
          "consent": "Say what the visitor agrees to by sending.",
          "consentLink": {
            "label": "Terms",
            "href": "#terms"
          },
          "submit": "Send the message"
        }} />
      </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'Name the section'Text, up to 30 characters.
titleStrongstring'Name the business'Text, up to 30 characters.
descriptionstring'Say in one or two sentences who thi…'Text, up to 240 characters.
fields{ label, type, required }[]6 itemsList of 1 to 8. Each item: label, type ('text' | 'email' | 'tel') (optional), required (optional).
messageLabelstring'What the visitor wants to ask'Text, up to 40 characters.
consentstring'Say what the visitor agrees to by s…'Text, up to 80 characters.
consentLinkLink{…}Optional; empty is not rendered.
submitstring'Send the message'Text, up to 24 characters.
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.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.