FormField

A standardized wrapper for form inputs that provides consistent label styling, helper text, error state handling, and automatic accessibility via label-input association. Wrap any input component to get unified form field behavior.

Import

import { FormField } from '@wavebooking/aqua-fusion';

Preview

Loading preview...

Usage

<FormField label="Email" error={errors.email?.message} required>
  <Input type="email" {...register('email')} />
</FormField>

<FormField label="Bio" helperText="Write a short description about yourself.">
  <Textarea {...register('bio')} />
</FormField>

Props

PropTypeDefaultDescription
children*ReactNode-The form input element to wrap.
labelstring-Label text displayed above the input.
helperTextstring-Helper text shown below the input. Replaced by error when present.
errorstring-Error message displayed below the input in red. Replaces helperText.
requiredboolean-Whether the field is required. Shows a red asterisk next to the label.
disabledboolean-Whether the field is disabled. Reduces wrapper opacity.
classNamestring-Additional CSS classes for the wrapper div.
idstring-Custom ID for the field. Auto-generated if not provided.