Skip to content
satin

Accordion

Folds sections of content under their titles, one or many open at a time.

Open Settings → Billing and pick a new plan. The change applies from the next billing date.

Installation

Terminal
npm i @uisatin/ui
Import
import { Accordion, AccordionItem } from '@uisatin/ui/accordion'

About 19.2 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.

First time with Satin? Set it up once, styles and fonts included, with the installation guide.

API Reference

The Accordion component wraps the Radix accordion in a div that holds AccordionItems; each item renders a button header with aria-expanded and its content under it. The item.* props belong to AccordionItem.

PropTypeDefault
type
"single""multiple"
—
collapsible
boolean
false
defaultValue
stringstring[]
—
item.value
string
—
item.title
ReactNode
—
item.icon
ReactNode
—
item.children
ReactNode
—
className
string
—
ref
Ref<HTMLElement>
—
...props
ComponentProps<typeof Accordion.Root>

Other attributes go to the Radix Accordion.Root part

—

Accessibility

Each header is a button inside a heading, with aria-expanded and aria-controls pointing at its section, which is a region labelled by the header. A closed section leaves the accessibility tree. The chevron and the icon are hidden from screen readers.

KeyAction
EnterorSpaceOpens or closes the focused section. With type="single", the open one closes only when collapsible.
↓Moves focus to the next header, wrapping to the first.
↑Moves focus to the previous header, wrapping to the last.
HomeMoves focus to the first header.
EndMoves focus to the last header.