Skip to Content

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.

We never share it.
This username is taken.
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, DatePicker and other picker components already include their own label / hint / error chrome — FormField is for wrapping bare inputs.

Props

PropTypeDefaultDescription
labelReactNode
hintReactNode
errorReactNodeerror message; when set the field is in the error state
requiredboolean
htmlForstringid of the control the label points at; omit to auto-wire the single child
classNamestring
children*ReactNodecontent rendered inside the component

* required · generated from packages/ui/src/input/FormField/FormField.tsx