Contact Form
ProNewName, email, phone and message with real validation and a confirmation, shown inline, in a side pane behind a floating button, or beside your contact details.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
| Prop | Type | Default |
|---|---|---|
| onSubmit* | (values: ContactFormValues) => void | Promise<unknown>Called with the values once they pass validation. Return a promise to show the sending state; reject with an `Error` to show its message above the button. | — |
| layout | "inline" | "floating" | "split"`inline` sits in the page, `floating` is a corner button that opens a side pane, `split` puts your details beside the form. | "inline" |
| fieldStyle | "outline" | "filled" | "underline"Look of the inputs: bordered boxes, soft filled pills, or a single underline. | "outline" |
| title | string | "Get in touch" |
| description | string | "Leave your message and we'll get back to you shortly." |
| fields | ContactField[]Which fields to show, in a fixed order. | ORDER |
| required | ContactField[]Fields that cannot be left empty. | ["email", "message"] |
| maxLength | numberLongest message accepted; a counter appears as it fills up. | 1000 |
| submitLabel | string | "Send" |
| accent | stringAny CSS color, for the button, focus rings and the split panel. | "#1672f3" |
| successTitle | string | "Message sent" |
| successMessage | string | "Thanks for reaching out. We'll reply within one business day." |
| errorMessage | stringShown when `onSubmit` rejects without a message of its own. | "We couldn't send your message. Please try again." |
| launcherLabel | stringAccessible name and tooltip of the floating button. | "Contact us" |
| details | ContactDetail[]Rows for the side panel of the `split` layout: address, phone, hours. | [] |
| disabled | boolean | false |
| className | string | — |
Accessibility
- Every input has a visible label; errors are tied to their field with aria-describedby and focus jumps to the first one.
- A live region says how many fields need attention, then announces sending and success.
- The floating pane is a dialog: it traps focus, closes on Escape and returns focus to the button.
- The confirmation takes focus when it replaces the form, and “Send another message” brings the form back.
- The pane slides and the check draws only when motion is allowed.