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 & Examples

Default

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

Props API

24 props
Columns
Form Group props API
Default
Description
aria-describedbystringNoariaOptional override for the wrapper aria-describedby.
aria-labelstringNoariaOptional aria-label for the wrapper group.
aria-labelledbystringNoariaOptional override for the wrapper aria-labelledby.
childrenReactElement<unknown, string | JSXElementConstructor<any>> | ReactElement<unknown, string | JSXElementConstructor<...>>[]YespropsThe form element or component (input, textarea, etc.).
classNamestringNostylingAdditional class names for styling.
controllerReactNodeNopropsOptional controller element (e.g., button, icon) beside input.
controllerClassNamestringNopropsAdditional class names for the optional controller wrapper.
data-testidstringNotestingBackward-compatible alias for test ID attributes.
descriptionstringNopropsOptional helper text displayed below the input.
descriptionClassNamestringNopropsAdditional class names for the helper description.
errorstringNopropsOptional error message shown below the input.
errorMessageClassNamestringNopropsAdditional class names for the error message.