A group of disclosures, built with React Aria's DisclosureGroup.
We offer standard (5-7 days), express (2-3 days), and overnight shipping. Free shipping on international orders.
Installation
Install the packages
Add the shadcn/ui component
Animate it
The CLI finds your shadcn/ui components through components.json, swaps their primitive imports for Animate UI's and removes the CSS animation classes Motion replaces.
Usage
Import from Animate UI instead of react-aria-components: it re-exports all of React Aria, with an animated DisclosurePanel. Everything else stays the same.
import {
Button,
Disclosure,
DisclosureGroup,
DisclosurePanel,
Heading,
} from '@animate-ui/react/primitives/react-aria';
export function FAQ() {
return (
<DisclosureGroup defaultExpandedKeys={['accessible']}>
<Disclosure id="accessible">
<Heading>
<Button slot="trigger">Is it accessible?</Button>
</Heading>
<DisclosurePanel>
Yes. It adheres to the WAI-ARIA design pattern.
</DisclosurePanel>
</Disclosure>
</DisclosureGroup>
);
}Animation
- DisclosurePanel 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.
- Opening another disclosure while one is closing retargets smoothly.
- A disclosure expanded by default animates open on mount (page load), as in v1.
- React Aria keeps closed panels mounted with
hidden="until-found": the panel stays visible (andinert) while it collapses, then getshidden="until-found"back, so find-in-page can still reveal it. A panel revealed by find-in-page opens at once, as in React Aria. - Motion animates the panel itself: shadcn/ui's
h-(--disclosure-panel-height) transition-[height]classes are no longer needed (the CLI removes them).--disclosure-panel-heightand--disclosure-panel-widthreadauto. <AnimateUIProvider tempo>paces both transitions.- Under reduced motion, the height changes at once; the fade and the blur still play.
API Reference
Every component takes exactly the props of React Aria's DisclosureGroup. Animate UI adds the animation props below.
DisclosureGroup, Disclosure, Heading, Button
React Aria props only. They are not animated.
DisclosurePanel
React Aria props, plus:
| Prop | Type | Default |
|---|---|---|
transition? | Transition | { duration: 0.35, ease: [0.215, 0.61, 0.355, 1] } |
exitTransition? | Transition | transition |