Skip to content
Focsd homeFocsd homeFocsd
Forms

Accordion

Stacked sections that expand one (or several) at a time.

  • Tag: focsd-accordion
  • Pattern: Accordion
  • Category: Disclosure

Example

Invoices are sent on the 1st of each month.

Up to 10 seats on this plan.

Managed by your organization.

Exports include all files.

HTML
<div class="full">
<focsd-accordion>
<focsd-accordion-item heading="Billing" open
><p>Invoices are sent on the 1st of each month.</p></focsd-accordion-item
>
<focsd-accordion-item heading="Members"
><p>Up to 10 seats on this plan.</p></focsd-accordion-item
>
<focsd-accordion-item heading="Security" disabled
><p>Managed by your organization.</p></focsd-accordion-item
>
<focsd-accordion-item heading="Data export"
><p>Exports include all files.</p></focsd-accordion-item
>
</focsd-accordion>
</div>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-accordion.js';
</script>
<focsd-accordion>…</focsd-accordion>

API

Attributes

AttributePropertyTypeDefault
multiplemultiplebooleanfalse

Slots

SlotDescription
(default)Default content.

Accessibility

  • Items with the same name form an exclusive group, like <details name> (the accordion does this for its own items unless multiple).
  • Each item renders a heading (level from level, default 3) wrapping a <button aria-expanded aria-controls>, and a role="region" panel labeled by the button.
  • Set multiple to allow several open items.

Keyboard

KeyAction
Enter / SpaceToggle the section
Arrow Up / DownPrevious / next header (wrapping)
Home / EndFirst / last header