Getting started
motion-solidjs brings the Motion API to SolidJS: motion.div, AnimatePresence, variants, gestures,
and Solid-native primitives such as createMotionValue, createTransform, and createSpring.
Install
pnpm add motion-solidjsmotion-solidjs ships compiled output, so vite-plugin-solid does not need to process the package
again. Install it like a normal dependency in Solid 1.x or 2.x projects.
Hello, motion
import { motion } from 'motion-solidjs'
export function App() {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
whileHover={{ scale: 1.05 }}
transition={{ type: 'spring', stiffness: 320, damping: 18 }}
/>
)
}
What to read next
- Variants - name states and orchestrate children
- Layout animations -
layoutandlayoutId createMotionValue- the value type behind most primitives- Drag - gestures with constraints, momentum, and reorder