Form Group

The Form Group component helps to structure and manage form input elements by providing a label, description, error message, and additional controls.

Usage

Default

<FormGroup label="Vertical" id="layout-vertical" layout="vertical">
  <TextInput value={value} onChange={(e) => setValue(e.target.value)} />
</FormGroup>
<FormGroup label="Horizontal" id="layout-horizontal" layout="horizontal">
  <TextInput value={value} onChange={(e) => setValue(e.target.value)} />
</FormGroup>

Props

Sortable data table
PropTypeDefaultDescription
labelstring-Label for the form group. Required unless `hideLabel` is set.
descriptionstring-Additional description or help text displayed below the inputs.
errorstring-Error message to show below the inputs. If provided, shows in place of description.
idstring-Unique id for accessibility, used for ARIA labelling.
requiredbooleanfalseMarks the field as required, adds a visual indicator and aria-required.
layout"vertical" | "horizontal""vertical"Layout direction of the label and children: vertical (default) or horizontal.
spacing"xs" | "small" | "medium" | "large" | "xl""xs"Spacing (gap) between children inside the group.
hideLabelbooleanfalseVisually hides the label but keeps it accessible for screen readers.
controllerReact.ReactNode-JSX element rendered beside the first input (e.g., button, icon).
childrenReact.ReactNode-Inputs or elements to render inside the form group.
classNamestring-Custom CSS class for the wrapper.
data-testidstring"form-group"Custom test id for the root element.