Open GitHub repository

Field

Groups a form control with its label, supporting description, and validation message.

Installation

bunx @swift-rust/ui add field

Usage

tsx
1import { Field, FieldDescription, FieldError, FieldLabel } from "@/components/ui/field";
2 
3import { Input } from "@/components/ui/input";
4 
5<Field>
6 <FieldLabel htmlFor="email">Email</FieldLabel>
7 <Input id="email" type="email" />
8 <FieldDescription>We will only use this for receipts.</FieldDescription>
9 <FieldError>Please enter a valid email.</FieldError>
10</Field>

Composition

Field is composed of these parts:

FieldGroup
└── Field
├── FieldLabel
├── Control
├── FieldDescription
└── FieldError