Form
A form wrapper with native HTML5 validation, powered by Radix.
form-demo.app
Installation
terminal.sh
npx y2kui@latest add formUsage
import {
Form,
FormField,
FormLabel,
FormControl,
FormMessage,
FormSubmit,
} from "@/components/ui/form";
<Form>
<FormField name="email" serverInvalid>
<FormLabel>Email</FormLabel>
<FormControl>
<Input type="email" required />
</FormControl>
<FormMessage>Please enter a valid email.</FormMessage>
</FormField>
<FormSubmit asChild>
<Button type="submit">Submit</Button>
</FormSubmit>
</Form>;Props
| Prop | Type | Default | Description |
|---|---|---|---|
FormField | { name: string } | — | Wraps a single form field. |
FormLabel | ReactNode | — | Styled label (uses Label component). |
FormControl | ReactNode | — | Wraps the input as a child. |
FormMessage | string | — | Validation error message. |
FormSubmit | ReactNode | — | Submit button. |