Accordion

Collapsible panels that unfold with height, opacity and a quiet blur.

accordion.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/accordion.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/accordion.json

3

Turn on the motion

npx @prequelui/cli@latest animate accordion

The 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.

accordion.tsx
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.
disclosure 350 mssoft easeblur 2 pxchevron 180°

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

PropTypeDefault
type"single" | "multiple""single"
valuestring | string[]—
defaultValuestring | string[]—
onValueChange(value: string | string[]) => void—
collapsiblebooleantrue
transitionTransitioncomponent spring or tween
classNamestring—

AccordionTrigger

PropTypeDefault
hideChevronbooleanfalse
disabledbooleanfalse
classNamestring—

AccordionPanel

PropTypeDefault
durationnumber0.35
blurnumber2
keepMountedbooleanfalse
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026