suiss/ui · Component
Accordion
A vertically stacked set of headings that each reveal a section of content.
Accordion is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
Accordion wraps the accordion primitive of the chosen base. An Accordion holds one or more AccordionItem parts; each item pairs an AccordionTrigger with an AccordionContent panel. The trigger renders inside a heading element and shows a caret that flips between down and up as the panel opens and closes.
Use an accordion to shorten long pages of related content, such as FAQs or settings groups, where people only need one or a few sections at a time. For a single show-and-hide region, a collapsible is a lighter fit.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
- Install the dependencies and add the
cnhelper:
- Copy the source into
components/ui/accordion.tsx:
- Update the import paths to match your project.
Usage
Give each AccordionItem a unique value. By default only one panel is open at a time; opening another closes the previous one. Set multiple on Accordion to let several panels stay open.
The open state is an array of item values. Use defaultValue (for example ["shipping"]) for uncontrolled use, or value with onValueChange to control it.
Examples
Filled
The filled variant places the items on a rounded bg-muted surface.
By default
Opens an item on first render with defaultValue.
Multiple
Keeps several panels open at once with multiple.
API Reference
Accordion
The root that groups items and manages which panels are open.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "filled" | "default" | Visual style. default is plain with dividers; filled adds a rounded bg-muted container. |
Also accepts the props of the primitive part it wraps.
AccordionItem
A single section that pairs a trigger with its panel, identified by value.
Also accepts the props of the primitive part it wraps.
AccordionTrigger
The button, inside a heading, that toggles its item's panel and shows the caret indicator.
Also accepts the props of the primitive part it wraps.
AccordionContent
The collapsible panel holding the item's content.
Also accepts the props of the primitive part it wraps.
Accessibility
- Each trigger is a
buttonwitharia-expandedreflecting its panel's state. - Triggers are wrapped in a heading element.
- Triggers are reachable with Tab;
EnterandSpacetoggle the focused panel. - Disabled triggers receive
aria-disabledand are dimmed withopacity-50.
Notes
- Styling hooks:
data-slot="accordion","accordion-item","accordion-trigger","accordion-trigger-icon"and"accordion-content". - The panel animates with
animate-accordion-downandanimate-accordion-upondata-openanddata-closed. classNameonAccordionContentapplies to the inner padded wrapper, not the animated panel.

Accordion groups AccordionItems, each with an AccordionTrigger and an AccordionContent panel. The root and items are Reanimated views with a layout transition, so items below move smoothly as a panel opens or closes, and the trigger's caret rotates as it opens.
The default variant draws items on the page background separated by hairlines. The filled variant puts the whole list on a rounded bg-muted surface, which suits grouped settings or FAQ cards.
Installation
The CLI also adds what it builds on: Icon, Text.
Manual
-
Target iOS 17 or later.
-
Add the Swift package to your app:
- Copy the theme files every view uses:
- Copy the source:
- Add the files to your app target.
- Set
minSdkto 24 or higher and add the dependencies:
- Copy the theme files every view uses:
- Copy the source and every file it uses:
- Update the
com.esuiss.uipackage names to match your project.
Usage
Give each AccordionItem a value. By default only one item is open at a time; set multiple to let several stay open.
Use defaultValue (an array of item values) for uncontrolled state, or value with onValueChange to control it. Set disabled on the root or on a single item to block toggling, and keepMounted to keep closed panels mounted.
accordionVariants is also exported if you need the classes elsewhere.
Examples
Default

Filled
The filled variant on a rounded bg-muted surface.

Multiple
A controlled accordion with multiple, so several items stay open.

API Reference
Accordion
Root that holds the open state and lays out the items.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "filled" | "default" | default or filled. |
Also accepts the props of React.ComponentProps<typeof AccordionPrimitive.Root>.
AccordionItem
One section, separated from the previous one by a hairline.
Also accepts the props of React.ComponentProps<typeof AccordionPrimitive.Item>.
AccordionTrigger
Pressable heading row with a rotating caret.
Also accepts the props of React.ComponentProps<typeof AccordionPrimitive.Trigger>.
AccordionContent
Panel shown while the item is open; fades out upward on close.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - |
Also accepts the props of React.ComponentProps<typeof AccordionPrimitive.Panel>.
Accessibility
- The header row has the
headerrole, and the trigger has thebuttonrole withexpandedanddisabledaccessibility state. - Closed panels are hidden from VoiceOver and TalkBack.
- A disabled trigger is shown at 50% opacity.
Notes
- The trigger label underlines while pressed.
- Animations respect the system Reduce Motion setting.
- Uses
bg-muted,border-borderandtext-foregroundtokens; light and dark follow the system appearance.



