Skip to content

FormField

FormField wraps inputs with a consistent label, error, and helper text layout. FormGroup stacks fields with uniform spacing.

import { FormField, FormGroup, Input, TextArea } from '@truongdq01/ui';
<FormGroup gap="md">
<FormField label="Email" required>
<Input placeholder="you@example.com" />
</FormField>
<FormField label="Bio" helperText="Optional">
<TextArea placeholder="Tell us about yourself" />
</FormField>
</FormGroup>;
PropTypeDefaultDescription
labelstring-Field label
requiredbooleanfalseShow required indicator
errorstring-Error text (replaces helper text)
helperTextstring-Supporting hint text
labelTrailingReactNode-Trailing content next to label
childrenReactNode-Input element

| Prop | Type | Default | Description | | ---------- | ----------- | ------- | --------------- | ------ | ------------------------------- | | children | ReactNode | - | Fields to stack | | gap | "sm" | "md" | "lg" | "md" | Vertical spacing between fields |