Skip to content
SENVENLI UI

Accordion

Sections that expand and collapse; Disclosure is a single expandable section.
Questions and answers
import { Accordion, Disclosure } from "@senvenli/react/navigation";

Examples

Several open at once

For sections people compare; some start expanded.

Composed from Disclosures

`Disclosure` children with an `id` each: a section can hold anything, here a list and a link.

A single Disclosure

One expandable section on its own, here controlled.

Guidelines

When to use it

  • Long content people scan by heading, like an FAQ.

Use something else when

  • Views are parallel and only one shows at a time. Tabs
  • The sections nest more than one level. Tree

Accessibility

Keyboard

KeysWhat happens
Enter, SpaceExpands or collapses a section.

Built in

  • Each header is a button with aria-expanded inside a heading.

You provide

  • A heading level that fits the page.
  • With children: an id on every Disclosure inside an Accordion (expandedKeys uses it).

API reference

Accordion

items
readonly AccordionItem[]

FAQ entries, settings groups, long-form sections. Leave it out to compose Disclosures as children instead.

children
React.ReactNode

With no items: Disclosures, each with an id (the key expandedKeys uses).

expandedKeys
Iterable<Key>
defaultExpandedKeys
Iterable<Key>
onExpandedChange
(keys: Set<Key>) => void
allowsMultipleExpanded
boolean

Several open at once; by default opening one closes the others.

headingLevel
4 | 2 | 3 | 5 | 6
motion
ComponentMotion

auto (follow the device), reduce or none, for this component; the provider's setting otherwise.

Disclosure

titleRequired
React.ReactNode

A full question or a clear section name ("When is my deposit refunded?").

childrenRequired
React.ReactNode
isExpanded
boolean
defaultExpanded
boolean
onExpandedChange
(isExpanded: boolean) => void
headingLevel
4 | 2 | 3 | 5 | 6

The heading level of the title in the page outline; the Accordion's, or 3 by default.

id
Key

Inside an Accordion: its key.

motion
ComponentMotion

auto (follow the device), reduce or none, for this component; the provider's setting otherwise.