Skip to content
New

Contact, form

beta

Name, email, a subject and a message beside your other contact details; sends as a WhatsApp, text or email message.

npx rasengan-ui add contact-form

Talk to us

A person on the team reads every message and answers within a working day.

Office
12 rue des Petites Écuries, Paris
About

Use it
A product's support or sales page, or a business taking requests (events, catering, quotes) without a backend.
Avoid it
Several ways to reach you and no form needed: contact-links.

Installation

Terminal
npx rasengan-ui add contact-form

It installs into components/blocks/contact-form/, with what it uses (Button, Field, Input, Label, Radio Group, Textarea) and lib/blocks.ts.

Usage

Without content, the block shows its example. Pass your own, typed by the block's schema, from a content file (here, the example with one field changed):

app/_routes/index.page.tsx
import { ContactForm } from "@/components/blocks/contact-form";
import { home } from "@/content/home";
 
export default function Home() {
  return <ContactForm content={home.contact} />;
}
content/home.ts
import { example, type ContactFormContent } from "@/components/blocks/contact-form";
 
export const home = {
  contact: { ...example, channel: { kind: "email", to: "support@senbon.example" } } satisfies ContactFormContent,
};

There is no server behind the form. When the visitor sends it, the block writes the message (your labels.intro, then the fields) and opens it in the app named by channel: WhatsApp, their texts or their mail app, addressed to you. To use your own backend, pass action (the form posts name, email, topic and message), or onSubmit to take the values in code.

The block is in both families: a product's support page, or a restaurant's events and catering.

Events and catering

Birthdays, weddings, office lunches: tell us the date and how many, we answer the same day.

Visit
Rue Joss, Akwa, Douala
A map of Akwa with the restaurant marked on Rue Joss.
Occasion

Content

FieldTypeLimitsGuidance
titlestring2–48 chars'Talk to us', 'Events and catering'.
sublineoptionalstring≤ 180 charsWho answers and how fast.
channelobjectWhere the message goes: the visitor's WhatsApp, texts or mail app opens with it written.
channel.kind"whatsapp" | "sms" | "email"Where the visitor's message opens: their WhatsApp, their texts, or their mail app.
channel.tostring1–120 charsThe business's number in international form, or its email address.
fieldsobject
fields.nameobject
fields.name.labelstring1–32 chars'Your name'
fields.name.placeholderoptionalstring≤ 48 chars
fields.emailobject
fields.email.labelstring1–32 chars'Email'
fields.email.placeholderoptionalstring≤ 48 chars
fields.topicoptionalobjectA choice of subjects, shown as chips: two to six short ones.
fields.topic.labelstring1–32 chars'About'
fields.topic.optionsstring[]2–6 items
fields.messageobject
fields.message.labelstring1–32 chars'Your message'
fields.message.placeholderoptionalstring≤ 48 chars
submitstring1–32 chars'Send', 'Send on WhatsApp'.
detailsoptionalobject[]≤ 4 itemsOther ways to reach you, beside the form.
details[].labelstring1–24 chars'Email', 'Phone', 'Office'.
details[].valuestring1–80 chars
details[].hrefoptionalstring
imageoptionalobjectA static map or a photo, under the details.
image.srcstringA local path ('/images/terrace.jpg') or the project's asset URL.
image.altstring≤ 140 charsWhat the image shows, for people who cannot see it. Empty only if purely decorative.
image.widthinteger
image.heightinteger
labelsobjectShown only when needed: in the message, under a field, after sending.
labels.introstring1–120 charsThe message's first line: 'Hello, I am writing from your website.'
labels.requiredstring1–32 charsUnder an empty required field: 'Required'.
labels.invalidEmailstring1–60 charsUnder a malformed address: 'Enter an email like name@example.com'.
labels.sentstring1–160 charsOnce the app opens: 'Your message is ready: send it from your mail app.'

Props

PropNotes
contentContactFormContent; the example when left out
actiona URL: the form posts its fields there instead of opening a message
onSubmit(values) => void: the values in code instead of a message
idthe section's id, for anchor links; "contact" by default
headingLevel1, 2 or 3: the heading's tag; 2 by default
classNameon the <section>, for spacing

Accessibility

  • Every field has its visible label; an empty field or a malformed address says so under it, and the form does not send.
  • The subjects are a radio group, every choice visible.