FormField
FormField is a convenience wrapper that combines fieldset, fieldset-legend, label (hint), and validator-hint (error) into a single compound component for consistent form layouts.
Import
import { FormField, Input, Textarea, Select } from '@sigx/daisyui';
Basic Usage
Wrap any form input with FormField for a labeled field:
Loading preview...
Required Field
Use the required prop to show a red asterisk indicator after the label:
Loading preview...
Hint Text
Add helper text below the field with the hint prop. Renders as a <p class="label">:
Loading preview...
Error Messages
Show validation errors with the error prop. Renders as a <p class="validator-hint text-error">. When both error and hint are set, the error takes priority:
Loading preview...
With Different Inputs
FormField works with all form components — Input, Textarea, Select, and more:
Loading preview...
Complete Form
A full registration form combining FormField with validation, multiple input types, and layout components:
Loading preview...
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | - | Label text rendered as <legend class="fieldset-legend"> |
required | boolean | false | Shows a red asterisk (*) after the label |
hint | string | - | Helper text rendered as <p class="label"> below the field |
error | string | - | Error message rendered as <p class="validator-hint text-error"> (replaces hint) |
class | string | - | Additional CSS classes on the fieldset container |
Slots
| Slot | Description |
|---|---|
default | The form input component(s) to wrap |