diff --git a/.specs/accordion.md b/.specs/accordion.md new file mode 100644 index 00000000..c348551c --- /dev/null +++ b/.specs/accordion.md @@ -0,0 +1,208 @@ +--- +name: accordion +category: content +structure: composition +status: implemented +spec_version: 2 +figma: + url: https://www.figma.com/design/t97pXRs7xME3SJDs5iZ5RF/Webkit?node-id=480-876 + node_id: "480:876" +checksum: 228238eb66de5c316dc42923e807a87ac550d3b351134e5ae64deb356827f793 +created: 2026-06-26 +last_updated: 2026-07-02 +--- + +# Accordion — Component Spec + +## Purpose + +A vertically stacked set of disclosure items: each item has a clickable header that expands or collapses its content panel. Use it to condense long content into scannable sections. Unlike `tab-view` (mutually-exclusive panels shown in place), an accordion can keep one item open at a time (`type="single"`) or several at once (`type="multiple"`), and its content expands inline below each header. + +## Usage + +```vue + + + +``` + +Tree-shaking alternative — the same sub-components as standalone imports: + +```vue + +``` + +## Sub-components + +The root ships a **compound API**: an `index.ts` (beside `accordion.vue`) attaches every sub-component to the root so `` / `` / `` resolve from one import; the standalone imports above remain the tree-shaking path. The root is a disclosure component with `data-state="open|closed"`, so `Trigger` / `Content` are the correct anatomy names. Shared open-state flows through `provide`/`inject` (`injection-key.ts`), so the consumer wires nothing. + +- `accordion-item/accordion-item.vue` — One disclosure row. Registers itself with the root by `value`, derives its own open/closed state from the injected context, and groups a `Trigger` + a `Content`. + - Props: `value: string` (**required** — unique identifier used by the open-state model), `disabled?: boolean` (default `false` — prevents this item from toggling; from the Figma component description). + - Slot: `default` — the item's `Accordion.Trigger` and `Accordion.Content`. +- `accordion-trigger/accordion-trigger.vue` — The clickable header row (Figma "Header"): renders the title plus the `pi pi-chevron-down` glyph, toggles the item through the injected context, and exposes `aria-expanded` / `aria-controls`. To satisfy the ARIA accordion pattern, the `