Accordion
Each row carries a bud. Open the row and the bud blooms into a sakura, the row rises onto a candy edge with a jelly wobble, and petals fall into the panel as it unfolds. Close it and the flower folds back up. ふわっ
Installation
❯ npx shadcn@latest add https://yan.moe/r/accordion.jsonUsage
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"<Accordion type="single" collapsible>
<AccordionItem value="one">
<AccordionTrigger>Can I freeze it?</AccordionTrigger>
<AccordionContent>Yes. Wrap each piece first.</AccordionContent>
</AccordionItem>
</Accordion>Use type="multiple" to let several rows stay open. For other bursts, pass a
recipe from Effects: <Accordion fx={fxRecipes.petals}>.
Accessibility
- Built on Radix Accordion: each trigger is a button inside a heading, with arrow keys, Home and End moving between rows.
- The flower is decoration: open and closed are announced through
aria-expanded. - With
prefers-reduced-motion: reduce, panels open without the unfold, the wobble or the petals.
API
| Prop | Type | Default |
|---|---|---|
intensitySet on Accordion. kawaii: the bud blooms, the row wobbles, petals fall into the panel. subtle: bloom and unfold with a few sparkles. off: it just opens. | "kawaii" | "subtle" | "off" | "kawaii" |
fxSet on Accordion. Overrides for the burst that falls from the flower when a row opens. | BurstOptions | - |
typeSet on Accordion. One open row at a time, or many. | "single" | "multiple" | - |
collapsibleSet on Accordion with type="single". Lets the open row close again. | boolean | false |
value / defaultValueSet on Accordion. Controlled and uncontrolled open rows. | string | string[] | - |