A vertically stacked set of interactive headings that each reveal an associated section of content.
Installation
Install the packages
Add the shadcn-vue component
Animate it
The CLI finds your shadcn-vue components through components.json, swaps their primitive imports for Animate UI's and removes the CSS animation classes Motion replaces.
Usage
<script setup lang="ts">
import {
AccordionContent,
AccordionHeader,
AccordionItem,
AccordionRoot,
AccordionTrigger,
} from '@animate-ui/vue/primitives/reka-ui';
</script>
<template>
<AccordionRoot type="single" collapsible>
<AccordionItem value="item-1">
<AccordionHeader>
<AccordionTrigger>Is it accessible?</AccordionTrigger>
</AccordionHeader>
<AccordionContent>
Yes. It adheres to the WAI-ARIA design pattern.
</AccordionContent>
</AccordionItem>
</AccordionRoot>
</template>Animation
- Content unfolds: its height grows from 0 while the content fades in from a 2px blur, over 350ms on a soft ease-out. While it moves, its bottom edge fades (over 16px, or over the part still hidden): the content never meets what follows it, an item's border, with a hard cut. It folds back the same way, in reverse, then unmounts.
- Opening another item while one is closing retargets smoothly.
- An item open by default animates open on mount (page load).
- With
force-mount, closed content stays in the DOM, collapsed andinert. <AnimateUIProvider :tempo>paces both transitions.- Under reduced motion, the height changes at once; the fade and the blur still play.
API Reference
Every part takes exactly the props of reka-ui's Accordion. Animate UI adds the animation props below.
AccordionRoot, AccordionItem, AccordionHeader, AccordionTrigger
reka-ui props only. They are not animated.
AccordionContent
reka-ui props, plus:
| Prop | Type | Default |
|---|---|---|
transition? | Transition | { duration: 0.35, ease: [0.215, 0.61, 0.355, 1] } |
exit-transition? | Transition | transition |