motion
Every HTML and SVG tag has a motion.* counterpart. These components accept normal element props
plus animation props such as initial, animate, transition, whileHover, whileTap,
whileInView, drag, layout, and variants.
import { motion } from 'motion-solidjs'
function Demo() {
return (
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
whileHover={{ scale: 1.05 }}
transition={{ type: 'spring', stiffness: 320, damping: 18 }}
/>
)
}
Props
motion accepts every HTML/SVG attribute plus motion-specific props:
initial- starting style; passfalseto skip the mount animationanimate- target style or variant labelexit- style applied when leaving an<AnimatePresence>treetransition-tween,spring, orinertiaoptionswhileHover/whileTap/whileFocus/whileInView- gesture variantsdrag-true,'x', or'y'to make the element draggablelayout/layoutId- opt into layout animationsvariants- named variant map for parent-child orchestration
See also
m- tree-shakeable variant for use withLazyMotionAnimatePresence- animate elements as they leave the treeuseMotion- the primitive behindmotion.*