Contact, form


Install
npx shadcn add @klarhimmel/contact-formDetailsAbout, usage, props and more
Heading and contact details beside a simple message form. Presentation only: the page wires the submit.
Import
Import
- contact/form
- 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
Heading and contact details on the left beside a message form on the right. Presentation only: the page wires the submit. For a list of addresses without a form, use contact-channels or contact-minimal.
Writing for it
- Details take up to four label and value pairs (40 and 120) in plain text, not links; keep to the phone, visit and hours people ask for. - Leave nameLabel empty to drop the name field and keep only email and message. messageLabel (40) names the last field. - messageType turns the last field into a single line: domain for a site address, url for a full link, email or text. Set messageName if your backend expects a field other than 'message'.
Watch out for
The sent and error texts are drawn only when the host sets status, usually after a redirect with ?sent=1. When status is sent, the fields are hidden and only the message shows. An empty messageLabel removes the last field.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
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.
| Prop | Type | Default | Description |
|---|---|---|---|
eyebrow | string | 'Name the topic' | Text, up to 60 characters. |
title | string | 'Ask what they want to tell you' | Text, up to 120 characters. |
description | string | 'Say in one sentence who reads the m…' | Text, up to 300 characters. |
details | { label, value, href, note }[] | 3 items | List of up to 6. Each item: label, value, href (optional), note (optional). |
nameLabel | string | 'Full name' | Text, up to 40 characters. Optional; empty is not rendered. |
emailLabel | string | 'Your email' | Text, up to 40 characters. |
phoneLabel | string | - | Text, up to 40 characters. Optional; empty is not rendered. |
address | { street, postcode, city } | - | Fields: street (optional), postcode (optional), city (optional). Optional; empty is not rendered. |
fields | { kind, label, name, options, required, placeholder, hint, after }[] | - | List of up to 30. Each item: kind ('heading' | 'text' | 'select' | 'radio' | 'checkboxes' | 'date' | 'number'), label, name (optional), options (optional), required (optional), placeholder (optional), hint (optional), after (optional). Optional; empty is not rendered. |
messageLabel | string | 'Your message' | Text, up to 80 characters. |
messageType | 'textarea' | 'url' | 'domain' | 'email' | 'text' | - | One of 'textarea', 'url', 'domain', 'email', 'text'. Optional; empty is not rendered. |
messageName | string | - | Text, up to 40 characters. Optional; empty is not rendered. |
errors | { required, email, url, domain } | {…} | Fields: required (optional), email (optional), url (optional), domain (optional). Optional; empty is not rendered. |
submit | string | 'Send' | Text, up to 40 characters. |
consent | string | 'Say in one line what the details ar…' | Text, up to 160 characters. |
consentLink | Link | - | Optional; empty is not rendered. |
consentRequired | boolean | - | Optional; empty is not rendered. |
honeypot | string | - | Text, up to 40 characters. Optional; empty is not rendered. |
action | string | - | 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. |
captcha | boolean | - | Optional; empty is not rendered. |
captchaSitekey | string | - | 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. |
headingLevel | '1' | '2' | - | One of '1', '2'. Optional; empty is not rendered. |