FormField
Wraps any control with a label, hint and error message. When the field has a single child
and no htmlFor, the label is wired to it automatically. Setting error also puts the
child control into its error state.
import { FormField, TextInput } from '@gg-software/ui';
<FormField label="Email" hint="We never share it." required>
<TextInput type="email" placeholder="you@example.com" />
</FormField>
<FormField label="Username" error="This username is taken.">
<TextInput defaultValue="admin" />
</FormField>Note:
Select,DatePickerand other picker components already include their ownlabel/hint/errorchrome — FormField is for wrapping bare inputs.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | — | |
hint | ReactNode | — | |
error | ReactNode | — | error message; when set the field is in the error state |
required | boolean | — | |
htmlFor | string | — | id of the control the label points at; omit to auto-wire the single child |
className | string | — | |
children* | ReactNode | — | content rendered inside the component |
* required · generated from packages/ui/src/input/FormField/FormField.tsx