Accordion
<details> / <summary>, so opening,
closing, the keyboard and the announced state come from the browser — no JavaScript. The same markup works in server
HTML with no client React.When to use
- Related topics where the reader needs only some at a time: services, FAQs, settings groups.
- Collapsing secondary detail keeps a long page short.
- A static or server-rendered page must stay interactive without client JavaScript.
- Switching between peer views of one object — use
Tabs. - Two or three short items, or content every reader must see — show it.
- The row title needs a link or a button — the whole row is already the control.
Usage
All rows start closed; any number can be open (type="multiple", the default).
Shipping
Returns
import { Accordion } from '@apollion-dsi/core/data-display/accordion';
<Accordion
items={[
{ value: 'shipping', title: 'Shipping', content: <Text>Orders ship within two business days.</Text> },
{ value: 'returns', title: 'Returns', content: <Text>Returns are free within 30 days.</Text> },
]}
/>;defaultValue opens rows in the initial markup (string[] here). It is uncontrolled: changing it later re-applies the
open state over the reader's choice. onItemToggle(value, open) reports every open and close the reader makes.
One open at a time
type="single" puts every row in a native <details name> group, so the browser keeps at most one open. name is
required and must be unique on the page: two accordions sharing a name behave as one group. defaultValue takes one
string.
Coaching
One-to-one
Workshops
Half-day
<Accordion type="single" name="services" defaultValue="workshops" indicator="plus" items={services} />Look
variant="divided"(default) is one surface with hairlines between rows;"separated"makes each row a surface.indicator="chevron"(default) rotates;"plus"turns into ×.- Surface props (
bgColor,borderColor,borderRadius,borderWidth,borderPosition) override one instance.
Set a brand look for every accordion in the theme, never in className:
createTheme({
component: {
accordion: {
surface: { borderRadius: 'sm', borderColor: 'main' },
title: { fontSize: 'medium', color: 'main' },
indicator: { color: 'main' },
},
},
});Rows animate open and closed where the browser supports ::details-content, and toggle instantly elsewhere; reduced
motion turns the transition off. With a CSS purge tool, keep [open] selectors and the ::details-content /
::marker pseudo-elements.
Accessibility
- Each title is a real heading inside the
<summary>: setheadingLevel(default3) to fit the page outline. - Titles and descriptions take phrasing content only — no links or buttons inside the row header.
- Some screen-reader and browser pairs do not list headings inside a
<summary>; the row itself is always announced with its expanded state.
Properties
colorstringnonecontainmentstringnonecqPartial<Record<ContainerSizeTypes, ContainerQueryable>>nonedefaultValuestringstring[]undefined
undefinedenableBreakpoint"xs""xl""sm""md""lg"noneheadingLevel234563ignoreResponsivebooleannoneindicator"chevron""plus"'chevron'items *AccordionItem[]nonelegibility"on-photo"nonelineClampnumbernonemotion"none""fade""scale""slide-up""slide-down""slide-left""slide-right""collapse""sheet""sheet-top""drawer-left""drawer-right""push-left""push-right"nonenamestringnoneonItemToggle((value: string, open: boolean) => void)nonepageShellbooleannonereadablenumberbooleannonetransformstringnonetype"single""multiple"'multiple'variant"divided""separated"'divided'viewportMediasPartial<Record<keyof BreakPoint<any>, ContainerQueryable>>noneBeyond the props above, the component accepts the surface props (spacing, background, border) — not repeated here.