Components/Form
Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/fieldset
A field set wraps a group of related components in a form, has a title (legend), and can include a tooltip for extra information.
<FormField/> instead.A field set consists of legend, suffix and children areas.
Children and suffix areas can include any actions or form components.
Control the legend position with the legendPlacement. It supports 4 options:
top (default).left or right to save vertical space in less spacious layouts. This only works well with short legends. When using, be mindful of localization.none to visually hide the legend. It will still be available for screen readers.When legend is placed on the side, its vertical position can be controlled with legendAlignment. It supports 2 options:
top (default).middle for single line inputs.Mark mandatory field sets with an asterisk by using required.
To change the status and display a message below the field set, use status and statusMessage.
status to error.status to warning.statusMessage with no status.Note: to set the status and message for individual child components, use the same props within that component's FormField.
Use a tooltip to provide users with more information about the field set and what they need to input.
To add info icon content use infoContent.
Add a custom element in the top-right corner of the field set to add extra actions or information. Any component can be used in this area.
Or use charCount to show how many characters are left in a text input.
Note: Choose either charCount or a custom element inside suffix; using both together is not possible.
Choose how child components are arranged in the field set:
horizontal (default) arranges them in a row.vertical arranges them in a column.Choose how child components are aligned using alignment.
In horizontal:
start (default) aligns to the top.center aligns to the middle.end to aligns to the bottom.In vertical:
start (default) aligns to the left.center aligns to the center.end to aligns to the right.Use columns to control the width of each field set child component. Check developer examples for more guidelines.
Note: columns only works with horizontal direction.
Control the space between field set child components with gap:
small (default).medium in more spacious layouts.large for extra space between components.Set the width of each child component using columns.
min-content to make the child component as narrow as possible.auto to make the child component fill in all available space.px to set the component's width.fr to set the column proportions. For example, use 1fr 1fr for equal width child components and 1fr 3fr to make the first child fill 25% and second to fill 75% of available width.Note: Do not use percentage values as they will cause child components to exceed the field set width.
Use field sets to group related form components together and give them a title.
When individual component labels are descriptive enough, set field set legendPlacement to none.
Provide extra information within the legend for screen reader users.
To hide this information on screen, set the legendPlacement to none.
When using FieldSet with FormField, the status message is connected to Input element automatically. If it's a FieldSet message without status, it applies to all Inputs under that FieldSet and if message has a status, it only applies the message to the FormField of matching status.
If more control is required over status message linking, set FieldSet statusId and Input aria-describedby to the same value. This disables the automatic linking.
| Name | Type | Default | Description |
|---|---|---|---|
alignment | "center" | "end" | "start" | — | Controls the alignment of all field set child components. |
charCount | number | — | Sets the maximum length for the field value inside field set child input. Character count is displayed in the top right corner of a component. |
children (required) | ReactNode | — | Accepts any kind of components as child elements. A child component should be a form element like an Input, InputArea, Dropdown or RichTextArea. |
columns | string | — | Controls the width of each field set child component. Works only with horizontal direction. |
dataHook | string | — | Applies a data-hook HTML attribute to be used in the tests. |
direction | "horizontal" | "vertical" | — | Controls if field set child components are rendered horizontally or vertically. |
ellipsis | boolean | — | Truncates legend that is longer than its parent container and displays ellipsis at the end of the last line. Enabled by default legend placement is set to top. |
gap | "small" | "medium" | "large" | — | Controls the gap between all field set child components. |
infoContent | ReactNode | — | Displays a passed info message in a tooltip next to field set legend. Default value is a text string, but it can also be overridden with any other component. |
infoTooltipProps | TooltipCommonProps | — | Allows control over the tooltip style and behaviour by passed tooltip properties. |
legend (required) | ReactNode | — | Sets a field set legend, which is a descriptive title for a group of components. Its default value is a text string, but it can be overridden with any other component. |
legendAlignment | "top" | "middle" | — | Controls the vertical alignment of the legend. |
legendPlacement | "none" | "right" | "left" | "top" | — | Controls the position of the legend, in terms of field set child components. |
legendSize | "small" | "tiny" | — | Controls the size of the legend. |
maxLines | number | 1 | Truncates legend text at a specific number of lines when using ellipsis. |
required | boolean | — | Marks the field set as mandatory with an asterisk (*) at the end of the legend. |
status | "error" | "warning" | — | Sets the type (color, icon) of a status message for the whole field set. |
statusId | string | — | Adds an id to a field set status message. Use with aria-describedby attribute on specific input to connect it with FieldSet status message for accessibility. |
statusMessage | ReactNode | — | Sets the field set status message. It is displayed bellow all field set child components. |
suffix | ReactNode | — | Adds a custom element at the end of the legend row (it overrides the charCount in case it's provided). |
Import the driver matching your test environment:
| Method | Description |
|---|---|
getLegendText | get legend text |
getLegendSize | returns legend size |
getLegendPlacement | returns legend placement |
getLegendAlignment | returns legend alignment |
isRequired | returns true whether field set is required |
getCharCount | returns the length left |
isLengthExceeded | returns whether the field set length is exceeded |
getInfoContent | returns tooltip text of the info content |
getAlignment | — |
getDirection | — |
getGap | — |
getStatusMessage | returns status message text |
hasStatus | return true if it has a given status |
exists | Checks whether the component found with the given data hook. |
element | Gets the component root element. |
click | Clicks on the component root element. |
base | Returns UniDriver for the base element. |
Last updated: 22 October 2026