Skip to main content
Pricing

Accordion Item

Free

An expandable/collapsible section that reveals or hides content when its header is activated. Used in groups to organise large amounts of content into scannable sections — FAQs, settings categories, and navigation trees. Each item has an expand/collapse chevron indicator and supports smooth height animation. The trigger uses aria-expanded and aria-controls for full accessibility.

6 variants

State
What is Lexicon?
How do I install it?
Is it free?

Variants

VariantDescriptionWhen to use
DefaultStandard accordion item with text header and chevron indicator.Use for FAQ sections, settings groups, and any list of collapsible content blocks.
With IconAccordion item with a leading icon in the header for visual categorisation.Use when each section represents a distinct category that benefits from an icon identifier.
BorderedAccordion item with visible borders separating sections.Use when multiple accordion items are stacked and need clear visual separation.

Usage Guidelines

Do

Use a native <button> element for the accordion trigger — never a <div> or <span>.

Don't

Nest more than two levels of accordions — the hierarchy becomes confusing.

Do

Allow multiple items to be open simultaneously unless the context demands single-open.

Don't

Force single-open behaviour when users might need to compare sections.

Do

Animate the expand/collapse transition for smooth visual feedback.

Don't

Hide critical content behind an accordion that users must find and open.

Do

Show a clear visual indicator (chevron) of the expanded/collapsed state.

Don't

Use an accordion for a single collapsible section — use a Disclosure instead.

Code

HTML
<div class="lex-accordion">
  <div class="lex-accordion-item">
    <h3>
      <button class="lex-accordion-item__trigger"
        aria-expanded="true" aria-controls="accordion-panel-1">
        ...
CSS Custom Properties
.lex-accordion-item__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
...
React
// Using Lexicon CSS classes with React

<Accordion>
  <AccordionItem title="What is your refund policy?">
    ...

Design Tokens

TokenValue (dark)Value (light)CSS property
--lex-accordion-borderborder
--lex-accordion-header-paddingpadding
--lex-accordion-content-paddingpadding
--lex-accordion-icon-sizesize

Accessibility

  • The trigger must be a native <button> element wrapped in an appropriate heading level.
  • Use aria-expanded="true" or "false" on the trigger to reflect the panel state.
  • Use aria-controls on the trigger pointing to the panel id.
  • The panel should have role="region" and aria-labelledby pointing to the trigger.
  • Focus must return to the trigger on close.

Keyboard Interactions

Enter/SpaceToggles the accordion item open or closed.
TabMoves focus to the next focusable element.
ArrowDownMoves focus to the next accordion trigger (when in a group).
ArrowUpMoves focus to the previous accordion trigger (when in a group).
HomeMoves focus to the first accordion trigger in the group.
EndMoves focus to the last accordion trigger in the group.