Skip to content

Fieldset

Basic Usage

Personal Information
Please provide your basic contact details.

Intent Variants

Default Fieldset
Primary Fieldset
Success Fieldset

Sizes

Small Fieldset
Compact spacing for dense forms
Medium Fieldset
Default spacing for most forms
Large Fieldset
Generous spacing for prominent forms

States

Required Fieldset *
All fields in this group are required
Disabled Fieldset
This fieldset is disabled
Background Fieldset
Subtle background for visual separation

Properties

PropertyTypeDefaultDescription
legendstring-Legend text for the fieldset
descriptionstring-Description text below the legend
intent'default' | 'primary' | 'success' | 'warning' | 'danger''default'Visual intent/state of the fieldset
size'small' | 'medium' | 'large''medium'Size variant affecting padding and spacing
disabledbooleanfalseWhether the fieldset is disabled
requiredbooleanfalseWhether the fieldset content is required (shows asterisk)
backgroundbooleanfalseWhether to show a subtle background
classstring-Additional CSS classes to apply

Accessibility

The Fieldset component follows WCAG 2.1 AA guidelines:

Screen Reader Support

  • Semantic HTML: Uses native <fieldset> and <legend> elements for proper structure
  • Group Identification: Screen readers announce the legend when entering the fieldset
  • Required Indicator: Visual and semantic indication of required fields

Keyboard Navigation

  • Focus Management: Proper focus-within styling for keyboard navigation
  • Disabled State: Prevents interaction when disabled

Visual Accessibility

  • High Contrast: Meets WCAG contrast requirements in all color variants
  • Focus Indicators: Clear focus rings for keyboard navigation
  • Color Independence: Information not conveyed by color alone

ARIA Support

  • Required Fields: Uses aria-label for required field indicators
  • Disabled State: Properly communicates disabled state to assistive technology

Examples

Basic Contact Form

Contact Information
We'll use this information to reach out to you.

Payment Information

Payment Details *

Settings Group

Notification Preferences
Choose how you'd like to be notified.
<!-- Basic Usage -->
<Fieldset legend="Personal Information">
<Input label="Name" placeholder="Enter your name" />
<Input type="email" label="Email" placeholder="your@email.com" />
</Fieldset>
<!-- With Description and Intent -->
<Fieldset
intent="primary"
legend="Account Settings"
description="Manage your account preferences"
required
>
<Input label="Username" required />
<Input type="password" label="Password" required />
</Fieldset>
<!-- Large with Background -->
<Fieldset
size="large"
background
legend="Profile Information"
description="This information will be displayed publicly"
>
<Input label="Display Name" />
<Input type="textarea" label="Bio" rows="4" />
</Fieldset>
<!-- Disabled State -->
<Fieldset
legend="Restricted Section"
disabled
description="You don't have permission to edit these fields"
>
<Input label="Admin Setting" disabled />
</Fieldset>