Skip to content

Fieldset

Groups separately labeled fields under a native legend with normal vertical layout and disabled cascading to both native and silver-ui controls. `className`, `style`, and `hidden` apply to the outer wrapper so they cover the fieldset and its detached status summary together; the remaining native props, `data-testid`, and `ref` target the fieldset element.

Profile details
function ProfileFields(): React.JSX.Element {
const [name, setName] = useState('Ada Lovelace');
const [email, setEmail] = useState('ada@example.com');
const [organization, setOrganization] = useState('Analytical Engines');
return (
<>
<TextInput label="Full name" onChange={setName} value={name} />
<TextInput
label="Email address"
onChange={setEmail}
type="email"
value={email}
/>
<TextInput
label="Organization"
onChange={setOrganization}
value={organization}
/>
</>
);
}
<Fieldset {...args}>
<ProfileFields />
</Fieldset>
Profile details

This information appears on your public profile.

function ProfileFields(): React.JSX.Element {
const [name, setName] = useState('Ada Lovelace');
const [email, setEmail] = useState('ada@example.com');
const [organization, setOrganization] = useState('Analytical Engines');
return (
<>
<TextInput label="Full name" onChange={setName} value={name} />
<TextInput
label="Email address"
onChange={setEmail}
type="email"
value={email}
/>
<TextInput
label="Organization"
onChange={setOrganization}
value={organization}
/>
</>
);
}
<Fieldset {...args}>
<ProfileFields />
</Fieldset>
Billing detailsRequired
Secondary contactOptional
function ProfileFields(): React.JSX.Element {
const [name, setName] = useState('Ada Lovelace');
const [email, setEmail] = useState('ada@example.com');
const [organization, setOrganization] = useState('Analytical Engines');
return (
<>
<TextInput label="Full name" onChange={setName} value={name} />
<TextInput
label="Email address"
onChange={setEmail}
type="email"
value={email}
/>
<TextInput
label="Organization"
onChange={setOrganization}
value={organization}
/>
</>
);
}
<VStack gap={8}>
<Fieldset isRequired legend="Billing details">
<ProfileFields />
</Fieldset>
<Fieldset isOptional legend="Secondary contact">
<ProfileFields />
</Fieldset>
</VStack>
Profile details
function ProfileFields(): React.JSX.Element {
const [name, setName] = useState('Ada Lovelace');
const [email, setEmail] = useState('ada@example.com');
const [organization, setOrganization] = useState('Analytical Engines');
return (
<>
<TextInput label="Full name" onChange={setName} value={name} />
<TextInput
label="Email address"
onChange={setEmail}
type="email"
value={email}
/>
<TextInput
label="Organization"
onChange={setOrganization}
value={organization}
/>
</>
);
}
<Fieldset {...args}>
<ProfileFields />
</Fieldset>
Profile details
function ProfileFields(): React.JSX.Element {
const [name, setName] = useState('Ada Lovelace');
const [email, setEmail] = useState('ada@example.com');
const [organization, setOrganization] = useState('Analytical Engines');
return (
<>
<TextInput label="Full name" onChange={setName} value={name} />
<TextInput
label="Email address"
onChange={setEmail}
type="email"
value={email}
/>
<TextInput
label="Organization"
onChange={setOrganization}
value={organization}
/>
</>
);
}
<Fieldset {...args}>
<ProfileFields />
<MultiSelect
label="Notification channels"
onChange={() => {}}
options={['Email', 'SMS', 'Push']}
value={['Email']}
/>
</Fieldset>
Profile details
function ProfileFields(): React.JSX.Element {
const [name, setName] = useState('Ada Lovelace');
const [email, setEmail] = useState('ada@example.com');
const [organization, setOrganization] = useState('Analytical Engines');
return (
<>
<TextInput label="Full name" onChange={setName} value={name} />
<TextInput
label="Email address"
onChange={setEmail}
type="email"
value={email}
/>
<TextInput
label="Organization"
onChange={setOrganization}
value={organization}
/>
</>
);
}
<Fieldset {...args}>
<ProfileFields />
<MultiSelect
label="Notification channels"
onChange={() => {}}
options={['Email', 'SMS', 'Push']}
value={['Email']}
/>
</Fieldset>

Groups separately labeled fields under a native legend with normal vertical layout and disabled cascading to both native and silver-ui controls. `className`, `style`, and `hidden` apply to the outer wrapper so they cover the fieldset and its detached status summary together; the remaining native props, `data-testid`, and `ref` target the fieldset element.

When isOptional: false, isRequired: false

PropTypeDefaultDescription
isOptionalfalse
isRequiredfalse
children*ReactNodeSeparately labeled fields grouped by the fieldset.
data-testidstringTest ID applied to the native fieldset element.
descriptionReactNodeSupporting text rendered below the legend.
isDisabledbooleanfalseWhether form controls in the fieldset are disabled. Native controls are disabled through the fieldset element; silver-ui inputs also receive the state through context.
isReadOnlybooleanfalseWhether silver-ui form controls in the fieldset are read-only.
legend*stringText used by the native legend to name the fieldset.
refRef<HTMLFieldSetElement>Ref forwarded to the native fieldset element.
statusInputStatusValidation summary displayed below the fieldset. The status is not propagated to child controls.

When isOptional: true, isRequired: false

PropTypeDefaultDescription
isOptional*true
isRequiredfalse
children*ReactNodeSeparately labeled fields grouped by the fieldset.
data-testidstringTest ID applied to the native fieldset element.
descriptionReactNodeSupporting text rendered below the legend.
isDisabledbooleanfalseWhether form controls in the fieldset are disabled. Native controls are disabled through the fieldset element; silver-ui inputs also receive the state through context.
isReadOnlybooleanfalseWhether silver-ui form controls in the fieldset are read-only.
legend*stringText used by the native legend to name the fieldset.
refRef<HTMLFieldSetElement>Ref forwarded to the native fieldset element.
statusInputStatusValidation summary displayed below the fieldset. The status is not propagated to child controls.

When isOptional: false, isRequired: true

PropTypeDefaultDescription
isOptionalfalse
isRequired*true
children*ReactNodeSeparately labeled fields grouped by the fieldset.
data-testidstringTest ID applied to the native fieldset element.
descriptionReactNodeSupporting text rendered below the legend.
isDisabledbooleanfalseWhether form controls in the fieldset are disabled. Native controls are disabled through the fieldset element; silver-ui inputs also receive the state through context.
isReadOnlybooleanfalseWhether silver-ui form controls in the fieldset are read-only.
legend*stringText used by the native legend to name the fieldset.
refRef<HTMLFieldSetElement>Ref forwarded to the native fieldset element.
statusInputStatusValidation summary displayed below the fieldset. The status is not propagated to child controls.