Accordion
Stacked sections that expand one at a time, or several at once.
You do. Shelf copies plain React and StyleX source into your app, so you can read and change every line.
When to use
- Use when
- Several related sections where people usually need one or two at a time, such as FAQs or settings groups.
- Avoid when
- The content is short enough to show at once, or people need to compare sections side by side.
Installation
The source lands in src/components/ui/accordion.tsx, along with any Shelf items it builds on, and .shelf/lock.json records what was installed. It's yours to edit.
Usage
Examples
Multiple
Several sections can stay open at once.
Orders ship within two business days.
Return anything within 30 days for a full refund.
Built on
Verified
- Size
- 2.0 kB gzipped on its own, 13 kB with the Shelf items and packages it builds on. JS and CSS in a production build, without React.
- Accessibility
- Axe passes on 2 stories
- Behavior
- 2 interaction tests in Storybook
- React Compiler
- Compiles with React Compiler
- React Doctor
- React Doctor finds nothing