Fieldset

Fieldset is a grouping component with a content toggle feature.

Shipping Address
Name
Jane Cooper
Phone
(415) 555-0132
Address
1234 Elm Street, Apt 5B
San Francisco, CA 94102
PREVIEW

A simple Fieldset is created with a legend property along with the content as children.

Invoice #1024
Design Service$120.00
Hosting$30.00
Total$150.00
basic-demo

Content of the fieldset can be expanded and collapsed using the toggleable property.

Design Service$120.00
Hosting$30.00
Total$150.00
toggleable-demo

The collapsed property with two-way binding controls the open state programmatically.

Design Service$120.00
Hosting$30.00
Total$150.00
controlled-demo

The toggleicon slot customizes the indicator. It can switch between two icons using the collapsed context variable, or render a single icon that animates purely with CSS by targeting the toggle button's aria-expanded state.

Match open / closed

Design Service$120.00
Hosting$30.00
Total$150.00

CSS-only with data attributes

Design Service$120.00
Hosting$30.00
Total$150.00
indicator-demo

Screen Reader

Fieldset component uses the semantic fieldset element. When toggleable option is enabled, a clickable element with button role is included inside the legend element, this button has aria-controls to define the id of the content section along with aria-expanded for the visibility state. The value to read the button defaults to the value of the legend property and can be customized by defining an aria-label or aria-labelledby via the toggleButtonProps property.

The content uses region, defines an id that matches the aria-controls of the content toggle button and aria-labelledby referring to the id of the header.

Content Toggle Button Keyboard Support

KeyFunction
tabMoves focus to the next the focusable element in the page tab sequence.
shift + tabMoves focus to the previous the focusable element in the page tab sequence.
enterToggles the visibility of the content.
spaceToggles the visibility of the content.
Theme Designer