UnflowUI
Components

Accordion

Expandable sections for settings and detail pages, with single or multiple open items and full keyboard support.

Overview

Accordion renders a list of sections whose bodies expand and collapse under their headers. Pass the sections as items. With type="single" (the default) at most one item is open; with type="multiple" any number can stay open. The open state works controlled (value + onValueChange) or uncontrolled (defaultValue).

Import

import { Accordion } from '@unflowio/ui/components/Accordion';

Props

PropTypeDefaultDescription
itemsAccordionItem[]—Required. The sections, in order
type'single' | 'multiple''single'single keeps at most one item open; multiple lets any number stay open
valuestring | null (single) / string[] (multiple)—Open item(s), controlled. null means none is open
defaultValuestring | null (single) / string[] (multiple)—Initially open item(s), uncontrolled
onValueChange(value: string | null) => void (single) / (value: string[]) => void (multiple)—Called when an item opens or closes
collapsiblebooleantrueSingle only. Lets the open item be closed again, leaving none open
headingLevel2 | 3 | 4 | 5 | 63Heading level that wraps each header button

AccordionItem:

FieldTypeDescription
valuestringRequired. Unique key, used by value / defaultValue
titleReactNodeRequired. Header text
descriptionReactNodeSecondary line under the title
contentReactNodeRequired. Body shown while the item is open
disabledbooleanPrevents the item from opening or closing

Basic usage

Workspace name, default language and time zone.

Choose which events send an email and which only show in the app.

Connect GitHub, Linear and Slack to this workspace.
<Accordion items={items} defaultValue="general" />

Multiple

Set type="multiple" to let several items stay open. value and defaultValue become arrays.

Workspace name, default language and time zone.

Choose which events send an email and which only show in the app.

Connect GitHub, Linear and Slack to this workspace.
<Accordion type="multiple" items={items} defaultValue={['general', 'integrations']} />

Descriptions and disabled items

description adds a secondary line under the title. A disabled item stays visible but can't be toggled.

main · 3 ignore globs

Two reviewers, one from the owning team.

You do not have access to billing.

Controlled

Open item: notifications

Workspace name, default language and time zone.

Choose which events send an email and which only show in the app.

Connect GitHub, Linear and Slack to this workspace.
const [open, setOpen] = useState<string | null>('notifications');

<Accordion items={items} value={open} onValueChange={setOpen} />

Set collapsible={false} on a single accordion to keep one item always open.

Customization (slots & slotProps)

SlotTypeDescription
iconReactNodeReplaces the chevron. It rotates with the open state unless you style it otherwise
Slot PropPropsDescription
itemBaseHTMLProps<HTMLDivElement>Each item wrapper
triggerBaseHTMLProps<HTMLButtonElement>Each header button
panelBaseHTMLProps<HTMLDivElement>Each body panel

Accessibility

  • Each header is a <button> inside a heading (headingLevel), with aria-expanded and aria-controls pointing at its panel.
  • Each panel is a role="region" labelled by its header.
  • ArrowDown/ArrowUp move focus between headers, and Home/End jump to the first/last.