Collapsible panels that unfold with height, opacity and a quiet blur.
Installation
Install the packages
npm install @prequelui/react motion@prequelui/react reuses the primitive library your components already depend on.
Add the component
npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/accordion.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/accordion.json
Turn on the motion
npx @prequelui/cli@latest animate accordionThe CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.
Usage
Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.
import {
Accordion,
AccordionItem,
AccordionTrigger,
AccordionPanel,
} from "@/components/prequelui/accordion";
export default function Demo() {
return (
<Accordion type="single" defaultValue="shipping" collapsible>
<AccordionItem value="shipping">
<AccordionTrigger>When will my order arrive?</AccordionTrigger>
<AccordionPanel>
Standard delivery takes five to seven business days.
</AccordionPanel>
</AccordionItem>
<AccordionItem value="returns">
<AccordionTrigger>What is your return policy?</AccordionTrigger>
<AccordionPanel>
Unused items can be returned within thirty days.
</AccordionPanel>
</AccordionItem>
</Accordion>
);
}import { Accordion } from "@/components/prequelui/accordion";
export function Variant() {
return (
<Accordion tempo={1.2}>
…
</Accordion>
);
}Animation
A panel opens by animating its measured height, then lets opacity and a two-pixel blur resolve the content into place. The bottom edge is masked so the last line never appears to slide under the border.
- Disclosure tween: 350 ms with a soft ease-out on height, opacity and blur.
- The chevron turns 180° on the same window; there is no separate bounce.
- Reopening during the exit continues from the painted height.
- Reduced motion opens the panel instantly and keeps a 200 ms fade.
API Reference
Every part takes exactly the props of the Accordion primitive. The animated surface adds only motion props, so the accessibility tree and keyboard behaviour stay the same.
Accordion
| Prop | Type | Default |
|---|---|---|
| type | "single" | "multiple" | "single" |
| value | string | string[] | — |
| defaultValue | string | string[] | — |
| onValueChange | (value: string | string[]) => void | — |
| collapsible | boolean | true |
| transition | Transition | component spring or tween |
| className | string | — |
AccordionTrigger
| Prop | Type | Default |
|---|---|---|
| hideChevron | boolean | false |
| disabled | boolean | false |
| className | string | — |
AccordionPanel
| Prop | Type | Default |
|---|---|---|
| duration | number | 0.35 |
| blur | number | 2 |
| keepMounted | boolean | false |
| className | string | — |