Coordinate disclosures in single or multiple expansion mode.
<script type="module" src="/assets/components/accordion/qds-accordion.js"></script>
<qds-accordion id="accordion-single"><qds-disclosure heading="Production" value="production" expanded>Production summary</qds-disclosure><qds-disclosure heading="Costs" value="costs">Cost summary</qds-disclosure><qds-disclosure heading="Forecast" value="forecast" disabled>Forecast unavailable</qds-disclosure></qds-accordion>
| API | Contract |
|---|---|
multiple |
Boolean property/attribute. False permits at most one open item; all may be closed. |
values |
String array property of expanded identities. Setting an empty array collapses all; single mode uses the first requested identity. |
| Default slot | Direct qds-disclosure children with unique values. |
Importing qds-accordion.js also registers disclosure. Item heading, heading-level, expanded, disabled, region, slots and methods follow the disclosure API. Without explicit values, zero-based string indices are used. Programmatic changes, insertion and removal are reconciled; nested accordions remain independent.
All enabled heading buttons remain in the regular Tab sequence. ArrowUp/Down wrap between enabled headings; Home/End jump to the first/last. Enter/Space toggle the focused header. Arrow keys inside panel inputs are not intercepted. Expanding one item in single mode collapses the previous item.
User toggles emit bubbling/composed qds-change with { component, values }; programmatic changes are silent. Listen to an item’s cancelable qds-before-toggle to prevent a user toggle. Use headings appropriate to the page hierarchy and enable region only when useful.
The component uses native Web Components with an open shadow root, existing QDS CSS custom properties, and no framework runtime. Base CSS is loaded once. Set data-theme="dark" or data-theme="light" on a containing element or use the documentation toolbar. Event listeners and observers are removed on disconnect; reconnecting is supported.
Interactive demo · P0 contracts and verification
Generated Quangular wrappers expose the same attributes/properties and events using the q-qds- prefix. For child composition, use the documented native child elements inside the wrapper when the native parent requires direct children. See the Quangular catalog for generated type signatures.