Fieldset
A set of form controls optionally grouped under a common name.
Examples
The Fieldset component provides contexts such as invalid and disabled for form elements. While most Ark UI
components natively support these contexts, you can also use the Field component with standard HTML form elements.
Basic Usage
Learn how to use the Fieldset component in your project. Let's take a look at the most basic example:
Example not foundExample not foundExample not foundExample not foundField
This example demonstrates how to use the Field component with a standard input field within a Fieldset.
Example not foundExample not foundExample not foundExample not foundCheckbox
This example shows how to use the Fieldset component with other Ark UI form elements like Checkbox.
Example not foundExample not foundExample not foundExample not foundRoot Provider
The RootProvider component provides a context for the fieldset. It accepts the value of the useFieldset hook. You
can leverage it to access the component state and methods from outside the fieldset.
Example not foundExample not foundExample not foundExample not foundIf you're using the
RootProvidercomponent, you don't need to use theRootcomponent.
Input with Select
This example shows how to use the Fieldset component with Field.Input and Select to create a interactive phone
input component.
Example not foundExample not foundExample not foundExample not foundAPI Reference
Root
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. | |
invalid | booleanIndicates whether the fieldset is invalid. |
ErrorText
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
HelperText
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
Legend
| Prop | Default | Type |
|---|---|---|
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
RootProvider
| Prop | Default | Type |
|---|---|---|
value | { refs: { rootRef: RefObject<HTMLFieldSetElement | null>; }; disabled: boolean; invalid: boolean; getRootProps: () => Omit<DetailedHTMLProps<FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref">; getLegendProps: () => Omit<...>; getHelperTextProps: () => Omit<...>; getErrorTextProps: () => Omit<.... | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |