Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

AccordionItem

  • Stable
  • WCAG 2.2 evidence
  • RTL

One collapsible section of an FAQ or settings page. Built on React Aria Disclosure: the title is a heading (level) that contains a button with aria-expanded and aria-controls; Enter and Space toggle it, a disabled item leaves the tab order, and the panel is hidden while collapsed (WCAG 2.1.1, 4.1.2). The whole header is the target (2.5.8), keyboard focus draws the 2 px ring inside it (2.4.7), and the state is shown by the leading toggle turning from a plus into a minus, not by colour alone (1.4.1). State: isExpanded / defaultExpanded / onExpandedChange and isDisabled (State=Disabled); Hover and Focused come from the pointer and keyboard. Inside an Accordion give each item an id. Do not hide content most people need, and do not use it for required form fields. Consumer duties: the title wording (specific, not truncated) and the heading level.

import { AccordionItem } from "@nexera-ui/react";
Loading example…
10
examples
14
props
4
live controls
1
platform
10
WCAG criteria
4
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
children
variant
isDisabled
isExpanded
Generated code
import { AccordionItem } from "@nexera-ui/react";

<AccordionItem />

Examples 9

The same examples as Storybook, rendered live. Open Code to copy one.

Expanded

Figma State=Expanded: defaultExpanded (or isExpanded to control it).

Loading example…

Disabled

Figma State=Disabled: isDisabled takes the header out of the tab order.

Loading example…

Variants

Figma Variant: Divider, Card and Filled, each collapsed and expanded.

Loading example…

With icon subtitle and meta

Optional parts: icon, subtitle and meta appear when provided.

Loading example…

In an accordion

An Accordion shares the variant and lets one item stay open (allowsMultipleExpanded allows several).

Loading example…

Cards in an accordion

Cards and filled items in a group are 8 px apart.

Loading example…

Long content

Long and translated titles wrap in the header; nothing is truncated.

Loading example…

Right to left

Right-to-left: the toggle, icon and title sit at the start (right) and the meta at the end (left).

Loading example…

Narrow container

A 14 rem container: the header wraps and keeps the full width as its target.

Loading example…

Props 14

Press "Try it" on a card to load that prop into the playground.

14 props shown

title*Nexera
VisibleContent

The question or topic. It is the text of the heading and the accessible name of the trigger button. Wraps instead of truncating.

Default –
levelNexera
1 | 2 | 3 | 4 | 5 | 6

Heading level of the title, so the accordion fits the page's outline (WCAG 1.3.1, 2.4.6). Use the level below the section heading that contains the accordion.

Default 3
subtitleNexera
ReactNode

Second line under the title. Shown when provided.

Default –
metaNexera
ReactNode

Short text at the end of the header. Shown when provided.

Default –
iconNexera
ReactNode

Icon before the title. 20 px, decorative: the title names the item. Shown when provided.

Default –
childrenNexera
ReactNode

Content of the panel. Plain text is shown in Body/Default and text/secondary; for several blocks wrap them in elements. Hidden while collapsed.

Default –
variantNexera
"divider" | "card" | "filled"

Visual style. Defaults to the enclosing Accordion's variant, else divider.

Default "divider"
classNameNexera
string

Extra classes for the item, merged last so they win over the defaults.

Default –
styleNexera
CSSProperties

Inline style for the item.

Default –
isDisabledReact Aria
boolean

Whether the disclosure is disabled.

Default –
onExpandedChangeReact Aria
(isExpanded: boolean) => void

Handler that is called when the disclosure's expanded state changes.

Default –
isExpandedReact Aria
boolean

Whether the disclosure is expanded (controlled).

Default –
defaultExpandedReact Aria
boolean

Whether the disclosure is expanded by default (uncontrolled).

Default –
idReact Aria
Key

An id for the disclosure when used within a DisclosureGroup, matching the id used in expandedKeys.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

7 direct · 3 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.4.1Use of ColorLevel A · tested directly
  • 1.4.4Resize TextLevel AA · supporting test
  • 1.4.11Non-text ContrastLevel AA · supporting test
  • 1.4.12Text SpacingLevel AA · supporting test
  • 2.1.1KeyboardLevel A · tested directly
  • 2.4.6Headings and LabelsLevel AA · tested directly
  • 2.4.7Focus VisibleLevel AA · tested directly
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

  • data-disabled
  • data-expanded
  • data-hovered
Usage
<AccordionItem className="data-disabled:opacity-90 shadow-sm" />

Used in blocks

Related components