Accordion
A native details and summary disclosure. The summary is a row one square high: its words at the start on the sixteen, the library’s chevron-down (16px, in the title grey) at its end, turned over while open. The pointer fills the row 4px past its words and chevron, keyboard focus rings it, and the details start on the square below, a line to a square.
| Measure | Size |
|---|---|
| The summary | One square high, the words 4px from the fill’s edge, standing where the details’ words start. |
| The chevron | chevron-down, 16px, on the sixteen at the end; it turns over in transform alone (none with reduced motion). |
| The details | From the square below the summary, every line one square; wrapping text is a paragraph, never a row one square high. |
| The width | Twelve squares (--ds-accordion-width). |
The React Accordion draws the same chevron on its trigger.
Design examples
Section titled “Design examples”Related questions remain compact until opened.
<section class="specimen">
<ds-accordion summary="When is the gallery open?"><p slot="details" class="ds-text">Tuesday to Sunday, from 10:00 to 18:00.</p></ds-accordion><ds-accordion summary="Can I bring a sketchbook?"><p slot="details" class="ds-text">Yes. Pencils and small sketchbooks are welcome.</p></ds-accordion><ds-accordion summary="Is there a quiet hour?"><p slot="details" class="ds-text">The first hour on Thursday is kept quiet.</p></ds-accordion>
</section>
<style>
.specimen { width: 100%; min-width: 0; --cell: calc(20px * var(--sf, 1)); }
.specimen .line { width: 100%; }
.specimen .grow { flex: 1; min-width: 0; }
.specimen .muted { color: var(--ds-text-color-muted); }
.specimen .mono { --ds-typeface-regular: var(--ds-typeface-mono); font-variant-numeric: tabular-nums; }
.specimen .value { width: calc(4 * var(--cell)); text-align: right; }
.specimen .mark { display: inline-flex; align-items: flex-end; width: var(--cell); height: var(--ds-control-height); flex: 0 0 var(--cell); }
.specimen .columns { display: flex; flex-wrap: wrap; gap: var(--cell); }
.specimen .columns > * { min-width: 0; }
.specimen fieldset { border: 0; padding: 0; margin: 0; }
.specimen legend { padding: 0; }
.specimen label { display: flex; align-items: flex-end; gap: calc(var(--cell) / 2); min-height: var(--cell); }
.specimen ds-panel { height: calc(10 * var(--cell)); }
</style> A heading and duration remain visible while longer notes are tucked away.
<section class="specimen">
<style>.specimen .notes { margin: 0; }</style><ds-row class="line" ><span class="mark"><ds-icon type="music" size="large" aria-hidden="true"></ds-icon></span><ds-text literal class="grow">Rain in the courtyard</ds-text><ds-text literal class="mono">06:18</ds-text></ds-row><ds-accordion summary="Recording notes"><div slot="details"><ds-row class="line" ><ds-text literal strong>Recorded at dawn</ds-text></ds-row><p class="ds-text ds-text--muted notes">Two microphones beside the east window.</p></div></ds-accordion>
</section>
<style>
.specimen { width: 100%; min-width: 0; --cell: calc(20px * var(--sf, 1)); }
.specimen .line { width: 100%; }
.specimen .grow { flex: 1; min-width: 0; }
.specimen .muted { color: var(--ds-text-color-muted); }
.specimen .mono { --ds-typeface-regular: var(--ds-typeface-mono); font-variant-numeric: tabular-nums; }
.specimen .value { width: calc(4 * var(--cell)); text-align: right; }
.specimen .mark { display: inline-flex; align-items: flex-end; width: var(--cell); height: var(--ds-control-height); flex: 0 0 var(--cell); }
.specimen .columns { display: flex; flex-wrap: wrap; gap: var(--cell); }
.specimen .columns > * { min-width: 0; }
.specimen fieldset { border: 0; padding: 0; margin: 0; }
.specimen legend { padding: 0; }
.specimen label { display: flex; align-items: flex-end; gap: calc(var(--cell) / 2); min-height: var(--cell); }
.specimen ds-panel { height: calc(10 * var(--cell)); }
</style> Try it
Section titled “Try it”Click the summary or focus it and press Enter.
<ds-accordion summary="How does this work?">
<div slot="details">The summary opens and closes this content.</div>
</ds-accordion> Attributes and slots
Section titled “Attributes and slots”| Attribute | Type | Default | What it does |
|---|---|---|---|
summary | string | Empty | The summary text or translation key. |
details | string | Empty | Detail text when no named-slot content is supplied. |
literal | boolean | false | The summary and details are what someone wrote, such as a template’s name: shown as they stand and never translated. |
open | boolean | false | Initially expands the disclosure. |
Without literal, summary and details are translation keys, as in Text:
<ds-accordion literal summary="Ideas for spring" details="Plant the bulbs in October"></ds-accordion>For rich detail content, use slot="details" as in the example. The summary can be activated with the pointer, Enter or Space. Native <details> owns opening and closing.
Controlled sections in React
Section titled “Controlled sections in React”The source-owned react/accordion binding accepts summary, open,
onOpenChange and optional actions. Actions sit beside the disclosure trigger,
outside its button, and wrap below it on narrow surfaces. They remain available
while details are collapsed. Use shared Button controls for those actions.
The product decides whether to accept an open request; DS1 owns visibility,
the disclosure icon, accessible relationships and focus return on collapse.