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#

TSX
import { FormField, Input, Textarea, Select } from '@sigx/daisyui';

Basic Usage#

Wrap any form input with FormField for a labeled field:

TSX
Loading preview...

Required Field#

Use the required prop to show a red asterisk indicator after the label:

TSX
Loading preview...

Hint Text#

Add helper text below the field with the hint prop. Renders as a <p class="label">:

TSX
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:

TSX
Loading preview...

With Different Inputs#

FormField works with all form components — Input, Textarea, Select, and more:

TSX
Loading preview...

Complete Form#

A full registration form combining FormField with validation, multiple input types, and layout components:

TSX
Loading preview...

Props#

PropTypeDefaultDescription
labelstring-Label text rendered as <legend class="fieldset-legend">
requiredbooleanfalseShows a red asterisk (*) after the label
hintstring-Helper text rendered as <p class="label"> below the field
errorstring-Error message rendered as <p class="validator-hint text-error"> (replaces hint)
classstring-Additional CSS classes on the fieldset container

Slots#

SlotDescription
defaultThe form input component(s) to wrap