Documentation
Base form field component with label and error handling. Integrates with react-hook-form.
import { FormField } from "@/components/forms"
;<FormField name="custom" label="Custom Field">
{({ value, onChange, onBlur, error }) => (
<YourCustomInput value={value} onChange={onChange} onBlur={onBlur} />
)}
</FormField>
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | - | Field name (required) |
label | string | - | Field label |
required | boolean | - | Show required indicator |
description | string | - | Helper text below label |
className | string | - | Additional CSS classes |
children | function | - | Render function receiving field props |
The children function receives:
value: Current field valueonChange: Change handleronBlur: Blur handlererror: Error message stringname: Field name<FormField name="phone" label="Phone Number" required>
{({ value, onChange, onBlur, error }) => (
<Input
type="tel"
value={value}
onChange={(e) => onChange(e.target.value)}
onBlur={onBlur}
className={error ? "border-destructive" : ""}
/>
)}
</FormField>