Basic Variants
Define variants as an object with named animation states:animate prop accepts a variant name (string) instead of animation values.
Propagation
Variants automatically propagate down the component tree:ul animates to “visible”, all children with matching variant names automatically animate to their “visible” states.
Orchestration
Control animation timing across variants:delayChildren: Delay before children animatestaggerChildren: Delay between each child’s animationwhen: Control when children animate ("beforeChildren"or"afterChildren")
Gesture Variants
Variants work seamlessly with gesture events:Gesture Propagation
Gesture variants also propagate to children:Dynamic Variants
Variants can be functions that receive custom data:custom prop passes data to variant functions.
With Animation Controls
Variants work with imperative controls:Exit Variants
Define exit animations for AnimatePresence:Variant Labels
Animate to multiple variants simultaneously:Transition Overrides
Override variant transitions:Best Practices
Keep Variants Consistent
Use the same variant names across parent and child components:Define Variants Outside Components
Avoid recreating variant objects on every render:Use Meaningful Names
Choose descriptive variant names:Advanced Example
Here’s a complete example with staggered list animations:API Reference
For complete API details, see:Next Steps
Gestures
Add interactive animations
AnimatePresence
Animate components entering and leaving