Form

Forms

A form wrapper component that provides validation context and submission handling. Works with FormField components for structured form layouts.

Import

import {
  Form,
  FormField,
  FormLabel,
  FormDescription,
  FormMessage,
  FormSubmit
} from "@/components/ui/form";

Usage

Interactive Contact Form

A responsive form with validation. On mobile, the 2-column layout stacks into a single column for better usability on smaller screens.

We'll never share your email.

API Reference

onSubmitundefined
(data: FormData) => void | Promise<void>

Callback when form is submitted

onValidateundefined
(data: FormData) => Record<string, string>

Validation function returning errors object

children*
ReactNode

Form content including FormField components