Gestures
Every motion.* element accepts gesture variants. They take precedence over animate while the
gesture is active and return to the base animation when it ends.
<motion.button
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.95 }}
whileFocus={{ boxShadow: '0 0 0 4px var(--ring)' }}
/>
whileHover, whileTap, whileFocus
These props accept the same target shapes as animate: style objects, variant labels, or variant
functions.
whileInView
Animates the element while it is in the viewport. Add a viewport prop to control thresholds,
margins, and one-time playback.
Card 1
Card 2
Card 3
Card 4
Card 5
Card 6
Card 7
Card 8
Pan
For pointer interactions that should not become a draggable element, use onPan, onPanStart,
and onPanEnd.