Follows the WAI-ARIA Disclosure Pattern.This remains the case when only one item can be open. Collapsed content stays on the page so it can animate, and is hidden from assistive technology.
An AccordionItem, by default, manages its own state internally, and several items can be open at once. If you’d like to take control of an individual item, you can do so using the expanded and onToggle props. When the accordion is managing which items are open, set a value on each AccordionItem instead.
If only one item should be open at a time, set multiple to false. Opening an item closes the others, and the open item can still be collapsed. Give each AccordionItem a value so the accordion can tell them apart.
To have an item open when the accordion first appears, set defaultValue to that item’s value. You can pass more than one value when several items should start open. If only one item can be open, pass a single value.
If you’d like to manage which items are open yourself, pass value and onChange. Give each AccordionItem a value, rather than setting expanded on the item. When multiple is false, value is a string and onChange receives a string. Use an empty string when no item is open. Otherwise they are an array of strings.
Braid components are very explicit about the properties they accept, which makes providing arbitrary data attributes not possible. Instead, a data prop can be provided as a single collection of data attributes.