auto-animate
π―Skillfrom ovachiever/droid-tings
Automatically adds zero-config, accessible animations to lists, forms, and UI elements across multiple JavaScript frameworks with minimal setup and error prevention.
Part of
ovachiever/droid-tings(370 items)
Installation
git clone https://github.com/ovachiever/droid-tings.gitSkill Details
|
Overview
# AutoAnimate - Error Prevention Guide
Package: @formkit/auto-animate@0.9.0 (Sept 2025)
Frameworks: React, Vue, Solid, Svelte, Preact
Last Updated: 2025-11-22
---
SSR-Safe Pattern (Critical for Cloudflare Workers/Next.js)
```tsx
// Use client-only import to prevent SSR errors
import { useState, useEffect } from "react";
export function useAutoAnimateSafe
const [parent, setParent] = useState
useEffect(() => {
if (typeof window !== "undefined" && parent) {
import("@formkit/auto-animate").then(({ default: autoAnimate }) => {
autoAnimate(parent);
});
}
}, [parent]);
return [parent, setParent] as const;
}
```
Why this matters: Prevents Issue #1 (SSR/Next.js import errors). AutoAnimate uses DOM APIs not available on server.
---
Known Issues Prevention (10 Documented Errors)
This skill prevents 10+ documented issues:
Issue #1: SSR/Next.js Import Errors
Error: "Can't import the named export 'useEffect' from non EcmaScript module"
Source: https://github.com/formkit/auto-animate/issues/55
Why It Happens: AutoAnimate uses DOM APIs not available on server
Prevention: Use dynamic imports (see templates/vite-ssr-safe.tsx)
Issue #2: Conditional Parent Rendering
Error: Animations don't work when parent is conditional
Source: https://github.com/formkit/auto-animate/issues/8
Why It Happens: Ref can't attach to non-existent element
Prevention:
```tsx
// β Wrong
{showList && ...
}
// β Correct
{showList && items.map(...)}
```
Issue #3: Missing Unique Keys
Error: Items don't animate correctly or flash
Source: Official docs
Why It Happens: React can't track which items changed
Prevention: Always use unique, stable keys (key={item.id})
Issue #4: Flexbox Width Issues
Error: Elements snap to width instead of animating smoothly
Source: Official docs
Why It Happens: flex-grow: 1 waits for surrounding content
Prevention: Use explicit width instead of flex-grow for animated elements
Issue #5: Table Row Display Issues
Error: Table structure breaks when removing rows
Source: https://github.com/formkit/auto-animate/issues/7
Why It Happens: Display: table-row conflicts with animations
Prevention: Apply to Error: "Cannot find module '@formkit/auto-animate/react'" Source: https://github.com/formkit/auto-animate/issues/29 Why It Happens: Jest doesn't resolve ESM exports correctly Prevention: Configure Error: "Path '.' not exported by package" Source: https://github.com/formkit/auto-animate/issues/36 Why It Happens: ESM/CommonJS condition mismatch Prevention: Configure esbuild to handle ESM modules properly Error: Layout breaks after adding AutoAnimate Source: Official docs Why It Happens: Parent automatically gets Prevention: Account for position change in CSS or set explicitly Error: "Failed to resolve directive: auto-animate" Source: https://github.com/formkit/auto-animate/issues/43 Why It Happens: Plugin not registered correctly Prevention: Proper plugin setup in Vue/Nuxt config (see references/) Error: Build fails with "ESM-only package" Source: https://github.com/formkit/auto-animate/issues/72 Why It Happens: CommonJS build environment Prevention: Configure ng-packagr for Angular Package Format --- β
Use unique, stable keys - β
Keep parent in DOM - Parent ref element always rendered β
Client-only for SSR - Dynamic import for server environments β
Respect accessibility - Keep β
Test with motion disabled - Verify UI works without animations β
Use explicit width - Avoid flex-grow on animated elements β
Apply to tbody for tables - Not individual rows β Conditional parent - β Index as key - β Ignore SSR - Will break in Cloudflare Workers/Next.js β Force animations - β Animate tables directly - Use tbody or div-based layout β Skip unique keys - Required for proper animation β Complex animations - Use Motion instead Note: AutoAnimate respects --- Latest: @formkit/auto-animate@0.9.0 (Sept 5, 2025) ```json { "dependencies": { "@formkit/auto-animate": "^0.9.0" } } ``` Framework Compatibility: React 18+, Vue 3+, Solid, Svelte, Preact --- --- See bundled resources: nextjs-shadcn-builder skill from ovachiever/droid-tings security-auditor skill from ovachiever/droid-tings threejs-graphics-optimizer skill from ovachiever/droid-tings api-documenter skill from ovachiever/droid-tings secret-scanner skill from ovachiever/droid-tings readme-updater skill from ovachiever/droid-tings applying-brand-guidelines skill from ovachiever/droid-tings Configures Tailwind v4 with shadcn/ui, automating CSS variable setup, dark mode, and preventing common initialization errors. deep-reading-analyst skill from ovachiever/droid-tings dependency-auditor skill from ovachiever/droid-tings instead of individual rows, or use div-based layoutsIssue #6: Jest Testing Errors
moduleNameMapper in jest.config.jsIssue #7: esbuild Compatibility
Issue #8: CSS Position Side Effects
position: relativeIssue #9: Vue/Nuxt Registration Errors
Issue #10: Angular ESM Issues
Critical Rules (Error Prevention)
Always Do
key={item.id} not key={index}disrespectUserMotionPreference: falseNever Do
{show && }
key={index} breaks animationsdisrespectUserMotionPreference: true breaks accessibilityprefers-reduced-motion automatically (never disable this).Package Versions
Official Documentation
Templates & References
templates/ - Copy-paste examples (SSR-safe, accordion, toast, forms)references/ - CSS conflicts, SSR patterns, library comparisonsMore from this repository10