Form Field

The FormField component is a controlled input component with a label, helper text, and validation error. It provides a consistent structure for form inputs and helps to manage their state and validation.

Usage & Examples

Default

Enter your email.
default.tsx
         <FormField
            label="Email"
            helperText="Enter your email."
            error="This is a validation error."
          >
            <TextInput
              title="email"
              type="email"
              placeholder="name@example.com"
            />
          </FormField>

Props API

16 props
Columns
Form Field props API
Default
Description
childrenReactElement<Record<string, unknown>, string | JSXElementConstructor<any>>YespropsContent rendered inside the component.
classNamestringNostylingAdditional CSS class names for the component root.
controlClassNamestringNopropsAdditional CSS class names for the control section.
data-testidstringNotestingTest id used to identify the component in tests.
errorReactNodeNopropsError message or error state displayed with the component.
errorClassNamestringNopropsAdditional CSS class names for the error section.
helperTextReactNodeNopropsHelper text displayed with the field.
helperTextClassNamestringNopropsAdditional CSS class names for the helper text section.
idstringNopropsHTML id applied to the relevant element.
labelReactNodeNopropsVisible label content for the component.
labelClassNamestringNopropsAdditional CSS class names for the label section.
labelPositionLabelPositionTypeNoprops"top"Label Position.