framer-motion
SKILL.md
Framer Motion Skill
When to use
- Adding page transitions or route animations.
- Creating component enter/exit animations.
- Building gesture interactions (drag, hover, tap).
- Animating lists with stagger effects.
Guardrails
- Keep animations under 300ms for snappiness.
- Always respect
prefers-reduced-motion. - Use
variantsfor complex, coordinated animations (not inline). - Animate transform/opacity only (avoid layout thrash).
Workflow checklist
- Identify what should animate and when (mount, route change, user interaction).
- Define
variantsfor multi-state animations (initial, animate, exit). - Use
motioncomponents (motion.div,motion.span) for animated elements. - Coordinate children with
staggerChildrenin parent variants. - Test with reduced motion to ensure accessible fallbacks.
Common patterns
Page transitions
import { motion } from 'framer-motion'
export function PageTransition({ children }: { children: React.ReactNode }) {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -20 }}
transition={{ duration: 0.3 }}
>
{children}
</motion.div>
)
}
Stagger children
const container = {
hidden: { opacity: 0 },
show: {
opacity: 1,
transition: {
staggerChildren: 0.1
}
}
}
const item = {
hidden: { opacity: 0, y: 20 },
show: { opacity: 1, y: 0 }
}
<motion.div variants={container} initial="hidden" animate="show">
{items.map(item => (
<motion.div key={item.id} variants={item}>
{item.content}
</motion.div>
))}
</motion.div>
Best practices
- ✅ Use
variantsfor readability and reusability - ✅ Keep duration under 300ms for UI responsiveness
- ✅ Animate transform/opacity (GPU-accelerated)
- ✅ Add
layoutprop for automatic layout animations - ❌ Don't animate width/height directly (causes layout thrash)
- ❌ Don't nest many
motioncomponents (performance)
References
- Library patterns: docs/dev-1/docs/16-library-patterns.md#framer-motion
- Design system: docs/dev-1/docs/13-unified-design-system.md (animation tokens)
Tooling
- Use Context7 or web search for framer-motion API details when needed.
Weekly Installs
18
Repository
huynhsang2005/b…tanstackFirst Seen
Jan 21, 2026
Security Audits
Installed on
claude-code11
cursor10
codex10
opencode8
gemini-cli8
antigravity7