Contact Form
A modern, production-ready contact form component built for flexibility and great user experience. It supports real-time validation, async submissions, toast feedback, file uploads, and multiple layout variants like default, background, and split views.
Designed to be composable, accessible, and easy to integrate into any application.
Example Usageâ
- Preview
- Code
import { ContactForm } from "@ignix-ui/contact-form";
import { ToastProvider } from "@ignix-ui/toast";
<ToastProvider>
<ContactForm
variant="default"
onSubmit={async (data) => {
console.log(data);
}}
>
<ContactForm.Header />
<ContactForm.Content>
<ContactForm.Field name="name" label="Name" />
<ContactForm.Field name="email" label="Email" />
<ContactForm.Field name="subject" label="Subject" />
<ContactForm.Textarea name="message" />
<ContactForm.FileUpload />
</ContactForm.Content>
<ContactForm.Actions />
</ContactForm>
</ToastProvider>
đĻ Installationâ
- CLI
ignix add component contact-form
Propsâ
ContactForm Propsâ
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | Required | Form content (Header, Content, Fields, etc.) |
variant | "default" | "background" | "split" | "default" | Layout variant of the form |
backgroundImage | string | â | Background image URL (used in background variant) |
sideImage | string | â | Side image URL (used in split variant) |
sideImagePosition | "left" | "right" | "left" | Position of the side image in split layout |
onSubmit | (data: FormData) => Promise<void> | void | â | Called when form is submitted successfully |
onError | (err: unknown) => void | â | Called when submission fails |
onSuccess | () => void | â | Called after successful submission (overrides default toast) |
ContactForm.Header Propsâ
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | "Contact Us" | Form title |
description | string | "We would love to hear from you" | Subtitle/description text |
ContactForm.Content Propsâ
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | Required | Form fields and content |
ContactForm.Field Propsâ
| Prop | Type | Default | Description |
|---|---|---|---|
name | "name" | "email" | "subject" | Required | Field name used for validation and data |
label | string | Required | Input placeholder/label |
type | string | "text" | Input type (e.g. text, email) |
ContactForm.Textarea Propsâ
| Prop | Type | Default | Description |
|---|---|---|---|
name | "message" | Required | Field name |
maxMessageLength | number | â | Maximum allowed message length |
ContactForm.FileUpload Propsâ
| Prop | Type | Default | Description |
|---|---|---|---|
| â | â | â | Uses underlying FileUpload component props |
âšī¸ This component internally uses the
FileUploadcomponent. You can extend or customize it by modifying the source if needed.
ContactForm.Actions Propsâ
| Prop | Type | Default | Description |
|---|---|---|---|
| â | â | â | Submit button section (no configurable props currently) |
ContactForm.Base Propsâ
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | Required | Form content |
onSubmit | (data: FormData) => Promise<void> | void | â | Submit handler |
onError | (err: unknown) => void | â | Error handler |
onSuccess | () => void | â | Success handler |