StartFoundationsComponentsContent

Accordion

An accordion is a stack of sections. Each section has a header that shows or hides its content.

Stable Figma
OverviewUsageAPIAccessibility
Shipping

Standard shipping arrives in 3 to 5 business days.

Returns

Return any unworn item within 30 days for a full refund.

<tk-accordion>
  <tk-accordion-item open>
    <span slot="header">Shipping</span>
    <p>Standard shipping arrives in 3 to 5 business days.</p>
  </tk-accordion-item>
  <tk-accordion-item>
    <span slot="header">Returns</span>
    <p>Return any unworn item within 30 days for a full refund.</p>
  </tk-accordion-item>
</tk-accordion>

Anatomy

Part What it is
tk-accordion the stack; adds no Tab stop
tk-accordion-item one section
header slot the section title
default slot the content, shown when the section is open
header part the heading around the trigger
trigger part the header button, with a chevron on the right; one Tab stop
panel part the content region

The open section works as one card: a click anywhere on its content closes it. Links, buttons, form controls, and selected text inside keep working as usual.

Single or multiple open

By default, several sections can be open at once. Add single to keep only one open: opening a section closes the others. Closing the open one is always allowed.

Can I change my plan?

Yes, at any time.

Can I cancel?

Yes, from Billing.

<tk-accordion single>
  <tk-accordion-item open><span slot="header">Can I change my plan?</span><p>Yes, at any time.</p></tk-accordion-item>
  <tk-accordion-item><span slot="header">Can I cancel?</span><p>Yes, from Billing.</p></tk-accordion-item>
</tk-accordion>

Don't use single when people need to compare two sections.

States

Profile

Name, photo, and bio.

Team settings

Roles and invites.

<tk-accordion>
  <tk-accordion-item open><span slot="header">Profile</span><p>Name, photo, and bio.</p></tk-accordion-item>
  <tk-accordion-item disabled><span slot="header">Team settings</span><p>Roles and invites.</p></tk-accordion-item>
</tk-accordion>

Hover and press shade the header row, or the whole card when the section is open. Keyboard focus shows a ring inside the header row.

  • open: the section starts open. The accordion toggles it from then on; read or set the open property from code.
  • disabled: the section can't be opened or closed, and its header leaves the Tab order. Say why it's unavailable in the header.

Controlling it yourself

To load content first or guard a toggle, listen for tk-toggle and call preventDefault(), then set open when you're ready. event.detail.open is the state the section is moving to.

<tk-accordion-item id="reports"><span slot="header">Reports</span><div id="reports-body"></div></tk-accordion-item>
<script>
  const item = document.getElementById('reports');
  item.addEventListener('tk-toggle', async (e) => {
    if (!e.detail.open) return;
    e.preventDefault();
    await loadReports();
    item.open = true;
  });
</script>

Heading level

Each header is a real heading, level 3 by default. Set heading-level on tk-accordion so the headings fit your page's outline: under an <h2>, use 3. Set it on one item to override it for that section.

Billing address

Used on invoices.

<tk-accordion heading-level="4">
  <tk-accordion-item><span slot="header">Billing address</span><p>Used on invoices.</p></tk-accordion-item>
</tk-accordion>