GitHub

/ accordion

Accordion

@kumiki/components/accordion

Compound <Root> / <Item> / <Trigger> / <Panel> for stacked disclosure regions. Generic over item value V; single or multiple expansion modes.

This component, layer by layer

Styled, copy-paste presets (preview). Run pnpm kumiki add to drop the source into your project, then edit freely.

Live preview

Live preview…

Install
pnpm add @kumiki/atelier
FAQ accordion
<script lang="ts">
  import { Tailwind as Accordion } from '@kumiki/atelier/accordion';
  import type { AccordionItem } from '@kumiki/components/accordion';

  type Q = { question: string; answer: string };
  const items: AccordionItem<Q>[] = [
    { id: 'q1', value: { question: 'Why Svelte 5?',         answer: '…' } },
    { id: 'q2', value: { question: 'How are styles split?', answer: '…' } },
  ];
</script>

<Accordion.Root {items} mode="single" collapsible>
  {#each items as q (q.id)}
    <Accordion.Item value={q}>
      <Accordion.Trigger value={q}>{q.value.question}</Accordion.Trigger>
      <Accordion.Panel value={q}>{q.value.answer}</Accordion.Panel>
    </Accordion.Item>
  {/each}
</Accordion.Root>

/ accessibility

Accessibility

axe-core — run on every PR (LTR + RTL × every documented state).

Keyboard

KeyEffect
Arrow ↑ / ↓Move focus to previous / next trigger.
Home / EndFirst / last trigger.
Space, EnterToggle the focused panel.
TabMove focus out of the accordion.

Test discipline

  • axe-core — run on every PR (LTR + RTL × every documented state).
  • APG keyboard tests — Playwright, hand-written per pattern.
  • VoiceOver / NVDA — Guidepup nightly schedule.
  • Type-level required names — title / aria-label / aria-labelledby.
Read the W3C ARIA APG pattern ↗