A drop-in JavaScript utility that adds smooth list and layout transitions with one line of code.
Overview
AutoAnimate is a small animation helper that watches a parent DOM node and smoothly animates when immediate children are added, removed, or moved. It needs no transition CSS classes and can be applied retroactively to existing markup, including third-party components.
The core API is a single autoAnimate function on a parent element. React, Vue, Solid, Svelte, Preact, Angular, and Marko integrations provide hooks, directives, or actions; Nuxt module support is available for Vue apps.
Default motion settings aim to improve perceived UX without extra implementation time or a heavy performance cost. Optional configuration and plugins can adjust behavior; the utility honors prefers-reduced-motion and disables animations when users request reduced motion.
Install via npm, yarn, pnpm, or bun as the @formkit/auto-animate package. Parent elements may receive position relative automatically, and flex layouts with flex-grow may need explicit sizing for reliable motion.
Key features
- Single-function DOM animations
- Add, remove, and move detection
- React, Vue, and Solid bindings
- Svelte action and attachment
- prefers-reduced-motion support
- Optional duration configuration
- Plugin customization
- Works on existing markup
Use cases
- Animated todo or list UIs
- Dropdown open and close motion
- Sortable lists without custom CSS
- Retrofit transitions in legacy apps
- Framework-agnostic layout shifts