Motion for Solid
Repo motiondivision/motion-solid, read from GitHub 3 h ago. motiondivision has not joined Take My Repo.
motiondivision/motion-solid is a public repo on GitHub by motiondivision. Motion for Solid. It declares the MIT license on GitHub. It is written mainly in TypeScript, has 7 stars and last changed on 2026-11-23. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-24.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
Motion for Solid is an open source animation library for Solid 2.0. It brings the Motion engine (springs, keyframes, gestures, layout and scroll animations) to Solid components, with reactive props and create* primitives that clean up with their owner.
It's the only animation library with a hybrid engine, combining the power of JavaScript animations with the performance of native browser APIs.
It looks like this:
<motion.div animate={{ x: 100 }} />
It does all this:
...and a whole lot more.
Not published yet. The name
motion-solidon npm belongs to a different library (a Solid 1.x package), sonpm install motion-solidinstalls that one, not this. Until this package is published under its final name, use it from a clone of this repository: runpnpm installandpnpm build, thenpnpm playto try it in the playground. The examples below import frommotion-solid; that specifier changes if the published name does.
motion-solid needs solid-js >=2 and @solidjs/web >=2 as peer dependencies. Solid 1.x is not supported.
Then import the motion component:
import { motion } from 'motion-solid'
export function Box() {
return <motion.div animate={{ x: 100 }} />
}
Props are read reactively, so animate re-runs when a signal it reads changes:
import { createSignal } from 'solid-js'
import { motion } from 'motion-solid'
export function Toggle() {
const [open, setOpen] = createSignal(false)
return (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1, x: open() ? 200 : 0 }}
transition={{ type: 'spring', stiffness: 200 }}
onClick={() => setOpen(value => !value)}
/>
)
}
Variants propagate from a motion component to its motion children, so one animate label can orchestrate a whole tree.
import { For } from 'solid-js'
import { motion } from 'motion-solid'
const list = {
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { staggerChildren: 0.1 } },
}
const item = {
hidden: { opacity: 0, y: 20 },
visible: { opacity: 1, y: 0 },
}
export function Menu() {
return (
<motion.ul variants={list} initial="hidden" animate="visible">
<For each={['One', 'Two', 'Three']}>
{label => <motion.li variants={item}>{label}</motion.li>}
</For>
</motion.ul>
)
}
import { motion } from 'motion-solid'
export function Button() {
return (
<motion.button
whileHover={{ scale: 1.1 }}
whileTap={{ scale: 0.95 }}
onHoverStart={() => console.log('hover start')}
>
Click me
</motion.button>
)
}
export function Draggable() {
return <motion.div drag="x" dragConstraints={{ left: -100, right: 100 }} />
}
Wrap children that come and go. A Show branch or a keyed For item runs its exit animation before it leaves the DOM.
import { createSignal, Show } from 'solid-js'
import { AnimatePresence, motion } from 'motion-solid'
export function Modal() {
const [visible, setVisible] = createSignal(true)
return (
<>
<button onClick={() => setVisible(value => !value)}>Toggle</button>
<AnimatePresence>
<Show when={visible()}>
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
/>
</Show>
</AnimatePresence>
</>
)
}
AnimatePresence takes mode ("sync", "popLayout" or "wait"), initial, custom, onExitComplete, propagate and as (render a wrapper element). Components that are not motion elements opt in with createPresence:
import { createPresence } from 'motion-solid'
export function Toast() {
let el!: HTMLDivElement
const [isPresent, safeToRemove] = createPresence({ element: () => el })
// isPresent() turns false when the exit starts; call safeToRemove() when your exit is done.
return <div ref={el} onTransitionEnd={() => !isPresent() && safeToRemove()} />
}
import { createSignal, For } from 'solid-js'
import { Reorder } from 'motion-solid'
export function List() {
const [items, setItems] = createSignal(['a', 'b', 'c'])
return (
<Reorder.Group values={items()} onReorder={setItems}>
<For each={items()}>
{item => <Reorder.Item value={item}>{item}</Reorder.Item>}
</For>
</Reorder.Group>
)
}
Reorder.Group renders a ul and Reorder.Item an li (change them with as). Items can also be reordered with the keyboard: Space grabs, arrows move, Escape cancels.
import { createSignal, For, Show } from 'solid-js'
import { LayoutGroup, motion } from 'motion-solid'
export function Tabs() {
const [selected, setSelected] = createSignal(0)
return (
<LayoutGroup>
<For each={[0, 1, 2]}>
{tab => (
<motion.button layout onClick={() => setSelected(tab)}>
Tab {tab}
<Show when={selected() === tab}>
<motion.div layoutId="underline" />
</Show>
</motion.button>
)}
</For>
</LayoutGroup>
)
}
Primitives are named create*. Reactive inputs are accessors (() => value), and primitives return MotionValues that you pass straight to style.
import { createMotionValue, createScroll, createSpring, createTransform, motion } from 'motion-solid'
export function ProgressBar() {
const { scrollYProgress } = createScroll()
const scaleX = createSpring(scrollYProgress, { stiffness: 100, damping: 30 })
return <motion.div style={{ scaleX, originX: 0 }} />
}
export function Fade() {
const x = createMotionValue(0)
const opacity = createTransform(x, [-200, 0, 200], [0, 1, 0])
return <motion.div drag="x" style={{ x, opacity }} />
}
createScroll returns scrollX, scrollY, scrollXProgress, scrollYProgress, scrollXLength and scrollYLength. To track an element, pass options as an accessor:
import { createScroll, createTransform, motion } from 'motion-solid'
export function Section() {
let target!: HTMLDivElement
const { scrollYProgress } = createScroll(() => ({
target: () => target,
offset: ['start end', 'end end'],
}))
const y = createTransform(scrollYProgress, [0, 1], [100, 0])
return (
<div ref={target}>
<motion.div style={{ y }} />
</div>
)
}
The other primitives are createVelocity, createMotionTemplate, createMotionValueEvent, createTime, createAnimationFrame, createReducedMotion, createDragControls, createAnimationControls, createPresenceData and createCycle. Pure helpers keep their plain names: animate, scroll, inView, stagger, spring, cubicBezier.
ref on a motion component is a normal Solid ref (a callback, a variable, or an array of them). createDomRef gives you the element as an accessor, for primitives that need one:
import { createDomRef, createInView, motion } from 'motion-solid'
export function Reveal() {
const [el, ref] = createDomRef<HTMLDivElement>()
const visible = createInView(el, { once: true })
return <motion.div ref={ref} animate={{ opacity: visible() ? 1 : 0 }} />
}
import { onSettled } from 'solid-js'
import { createAnimate } from 'motion-solid'
export function Items() {
const [scope, animate] = createAnimate()
onSettled(() => {
animate('li', { opacity: 1 })
})
return (
<ul ref={scope}>
<li style={{ opacity: 0 }} />
</ul>
)
}
Animations stop when the owner is disposed.
MotionConfig sets defaults for every motion component below it: transition, reducedMotion, skipAnimations, nonce and inViewOptions.
import { MotionConfig, motion } from 'motion-solid'
export function App() {
return (
<MotionConfig transition={{ duration: 0.4 }} reducedMotion="user">
<motion.div animate={{ opacity: 1 }} />
</MotionConfig>
)
}
LazyMotion loads a feature bundle (domAnimation or domMax) once, and the m component reads it. features can be an object or a function returning a promise, such as () => import('./features'). With strict, rendering a full motion component below it throws.
import { LazyMotion, domAnimation, m } from 'motion-solid'
export function App() {
return (
<LazyMotion features={domAnimation} strict>
<m.div animate={{ opacity: 1 }} />
</LazyMotion>
)
}
Solid 2 has no use: directives, so motion is attached to elements that are not motion components through a ref factory: call attachMotion in a component body and pass the result as ref. Give it an accessor when the options change over time. It does not inherit variants from a parent and does not run on the server (use getMotionSSRStyle(options, tag) for the initial style; it returns dash-case keys, and for SVG tags only the style, not the attributes motion moves out of it).
import { createSignal } from 'solid-js'
import { attachMotion, createPresetMotion } from 'motion-solid'
const fadeIn = createPresetMotion({ initial: { opacity: 0 }, animate: { opacity: 1 } })
export function Attached() {
const [x, setX] = createSignal(0)
return (
<>
<div ref={attachMotion({ initial: { opacity: 0 }, animate: { opacity: 1 } })} />
<div ref={attachMotion(() => ({ animate: { x: x() } }))} onClick={() => setX(100)} />
<div ref={fadeIn({ transition: { duration: 1 } })} />
</>
)
}
For an element you create or receive yourself, such as a third-party widget, makeMotion attaches motion to it immediately and returns a function that removes it. It follows the make* convention of Solid Primitives (compare makeEventListener): the options are a plain object, and it is removed automatically when the owner it was called in is disposed.
import { makeMotion } from 'motion-solid'
export function Widget() {
const el = document.createElement('div')
el.textContent = 'Hello'
// Removed when Widget is disposed. Outside a component, keep the returned function and call it to stop.
makeMotion(el, { initial: { opacity: 0 }, animate: { opacity: 1 }, whileHover: { scale: 1.1 } })
return el
}
Call makeMotion from a component body, a computation, or an event handler, not from onSettled or an effect's apply callback: Solid 2 does not allow registering cleanup there. To change the options of an attached element, use attachMotion with an accessor.
style and SVG attributes from its frame loop. Solid sets your style prop once and only re-applies it when the prop changes, so do not drive the same property from both style and animate.jsx: preserve with jsxImportSource: "@solidjs/web" (the Solid 2 Vite plugin does this for you).Learn, Design, Build. Motion+ is a one-time fee, lifetime update membership that provides:
alphaMotion Studio is a versatile suite of developer tools allowing you to:
Get started with Motion Studio.
pnpm install, pnpm build and pnpm test. The playground (pnpm play) has a demo for each feature.motiondivision/motion-solid is a public repo on GitHub by motiondivision. Motion for Solid.
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-23. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run motion-solid. What is known comes from GitHub. It declares the MIT license on GitHub. Its last change was on 2026-11-23. It has 7 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.