Accordion
interlace-ui/accordionFreeComponent
A disclosure stack: a column of headers whose panels open and close. Wraps @base-ui/react/accordion — Base UI owns the open state (single or multiple), the keyboard model and every piece of the accordion ARIA.
Install it
npx shadcn@latest add https://ds.interlace.tools/r/accordion.jsonSource
1'use client';23import * as React from 'react';45// @interlace/accordion v1.2.0 — Interlace design system.6// Docs, props and live preview: https://ds.interlace.tools/c/accordion7// What changed since: https://ds.interlace.tools/c/accordion#history8// Generated banner — keep it, the upgrade diff reads this version.910/**11 * @interlace/ui — Accordion12 *13 * A disclosure stack: a column of headers whose panels open and close. Wraps14 * @base-ui/react/accordion — Base UI owns the open state (single or multiple),15 * the keyboard model and every piece of the accordion ARIA.16 *17 * We own the item divider, the trigger row, and the chevron that rotates on18 * `data-panel-open`.19 *20 * ## Anatomy21 *22 * Accordion (Base UI Accordion.Root — data-min-viewport=320)23 * └─ AccordionItem (border-b, dropped on the last item)24 * ├─ AccordionTrigger (Accordion.Header > Accordion.Trigger + ChevronDownIcon)25 * └─ AccordionContent (Accordion.Panel > div)26 *27 * Every node above carries a `data-slot`, including the two that used not to:28 * the `Accordion.Header` around the trigger button (`accordion-header`) and the29 * padding `div` inside the panel (`accordion-content-inner`).30 *31 * ## Where `className` lands32 *33 * `AccordionContent` forwards the caller's `className` to the `Panel` — the box34 * that owns `overflow-hidden` and the open/close animation — not to the inner35 * padding `div`. It used to be the other way round, which left the animated box36 * unreachable from a call site. `primitive-api-contract-lock` pins it.37 *38 * ## MIN_VIEWPORT — 32039 *40 * A disclosure stack is full-width by construction: the trigger row is41 * `flex-1` and the chevron is `shrink-0`, so a long heading wraps inside the42 * row instead of pushing the chevron off a 320px screen.43 *44 * | Rule | Concept | Where in this file |45 * | ---- | -------------------------------- | ----------------------------------------------------------- |46 * | R4 | Extends Base UI part props | every wrapper is `React.ComponentProps<typeof BaseAccordion.*>` |47 * | R6 | data-slot per part | accordion / -item / -header / -trigger / -content / -content-inner |48 * | R7 | cn + ...rest | `cn('border-b last:border-b-0', className)` + `{...props}` |49// … truncated
More from interlace-ui
All 140 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| A11y Startera11y-starter | interlace-ui | Components | Free | no deps | |
| Alertalert | interlace-ui | Components | Free | no deps | |
| Alert Dialogalert-dialog | interlace-ui | Components | Free | no deps | |
| Animated Gradient Textanimated-gradient-text | interlace-ui | Components | Free | no deps | |
| Animated Grid Patternanimated-grid-pattern | interlace-ui | Components | Free | no deps | |
| Animated Listanimated-list | interlace-ui | Components | Free | no deps | |
| Article Cardarticle-card | interlace-ui | Components | Free | no deps | |
| Article List Gridarticle-list-grid | interlace-ui | Components | Free | no deps |
