Searching Puzzle Pieces

Type to search Puzzle Pieces.

Accordion

A set of disclosures that coordinate: in single mode opening one closes the rest, in multiple mode they are independent. It is a compound family over the same @magic-spells/collapsible-content web component the Collapsible family wraps, so the exclusivity, the height animation and every ARIA attribute come from the component.

Free carbon-neutral 2-day shipping on every order over $75. Orders placed before 2pm ET ship the same business day.

30 days, no questions. Send them back in any condition for a full refund — return shipping is on us.

Two years against manufacturing defects, extended to three if you register within a month.

value = 'shipping'

Installation

Copy the family into your app. It pulls the collapsible family along with it — Accordion.Trigger and Accordion.Content compose those members:

puzzle add piece accordion

That base has one runtime dependency — the web component it wraps:

npm install @magic-spells/collapsible-content

Then merge its stylesheet into your app's style entry. It is required: the height transition the whole animation runs on lives there.

/* app/styles/styles.css */
@import "tailwindcss";
@import "@magic-spells/collapsible-content/css" layer(components); /* required */

Requires the pieces.css tokens merged into your app styles (see Introduction).

Usage

import Accordion from '@/components/ui/Accordion';
<Accordion value={ open } @change={ setOpen }>
  <Accordion.Item value="shipping">
    <Accordion.Trigger>Shipping</Accordion.Trigger>
    <Accordion.Content>
      <p>Real markup — this is not a text prop.</p>
    </Accordion.Content>
  </Accordion.Item>
</Accordion>

Every row needs a value on its Item. That is how the root identifies its direct members, reads the group's state back off the DOM and drives them. Item renders a single element, so it drops straight into a for block over a list of rows.

Multiple open

40 mm dynamic drivers, adaptive hybrid noise cancellation, 20 Hz – 20 kHz.

38 hours of playback; a ten-minute charge returns roughly five hours.

Multipoint Bluetooth 5.3, USB-C, and a 3.5 mm analogue fallback.

value = ['audio']

Driven from outside

Free carbon-neutral 2-day shipping on every order over $75. Orders placed before 2pm ET ship the same business day.

30 days, no questions. Send them back in any condition for a full refund — return shipping is on us.

Two years against manufacturing defects, extended to three if you register within a month.

Rich panels, disabled rows and nesting

Panel bodies take arbitrary markup — including other pieces.

Its rows join the nearest group, so this one coordinates with its own siblings and never touches the outer accordion.
Opening this closes the row above it, and nothing else.
Collapsible renders its own non-exclusive group, which shields it from this accordion's exclusivity. Open it, then open another row above — it stays open.
A disabled trigger is a real disabled button.

Reference

Accordion

type'single' (default) — one open at a time — or 'multiple'. The shape of value wins where they disagree: an array behaves as multiple whatever type says, and a string under type="multiple" still reports an array back.
valueControlled: a string in single mode ('' = all closed), a string[] in multiple mode.
defaultValueUncontrolled seed, applied once at mount.
classMerged onto the collapsible-group host, after the card chrome.
@change(value)Value-first, fired once per user action with the next value. A nested accordion's rows are filtered out by group.

Accordion.Item

valueThe id this row reports and answers to. Required for a controlled accordion.
classMerged onto the collapsible-component host.

Accordion.Trigger

disabledRenders the disabled attribute on the real button, so the component's click listener never fires. The root can still open the row.
classMerged onto the button, after the row padding. The chevron flips on aria-expanded — pure CSS, no prop.

Accordion.Content

defaultOpenStart this row expanded. Uncontrolled accordions only, and initial only.
speedpx/sec pace feeding the derived duration (component default 900).
minDuration / maxDurationSeconds; floor and ceiling for that duration (0.25 and 0.8).
easingCSS timing function, forwarded as --collapsible-easing.
classMerged onto the panel, after the padding. Never overflow-hidden, a height utility or a transition.

A rejected toggle is not reverted. The component self-manages and then reports; a parent that ignores @change leaves the panel visually open while its own state says closed, and the next real change to value puts it right. Exactly one @change fires per user action, even in single mode where the component closes the previous row first.