structyl

Accordion

stable

A vertically stacked set of interactive headings that each reveal a section of content.

Basic usage

Examples

Multiple panels

Allow several panels to be open simultaneously.

Multiple open panels

Use type="multiple" for FAQ and settings pages where several sections can stay open.

Invoices, payment methods and tax details.

Two-factor authentication and audit logs.

Features

  • Full keyboard navigation.
  • Supports single or multiple expanded panels.
  • Can be controlled or uncontrolled.
  • Spring-eased height animation.

Installation

bash
pnpm dlx structyl add accordion

API Reference

Accordion API reference

Full props, types, defaults, and all 5 parts.

View API

Keyboard interactions

Adheres to the WAI-ARIA design pattern .

KeyDescription
Space / EnterExpands / collapses the focused panel.
ArrowDown / ArrowUpMoves focus between headers.
Home / EndMoves focus to the first / last header.
Accordion | structyl