motion-solidjs·77 examples

Motion for SolidJS, by example.

A live gallery of every gesture, transition, layout trick, drag constraint, scroll effect and motion value pattern — running on motion-solidjs, TanStack Start and SolidJS.

Gestures

hover, tap, focus and pan interactions
whileFocus
Focus ring
whileFocus animates a glow ring on keyboard focus.
whileHover
Hover
whileHover springs the box up and changes its background.
compound
Hover + tap stack
A row of chips that lift on hover and depress on tap, with a per-item spring.
onPan
Pan gesture
Track pointer offset across pan events.
whileTap
Tap
Press-and-hold shrinks the button, release springs it back.

Animations

transitions, keyframes, springs
imperative
animate()
The imperative animate() function — drive a DOM element from a click handler.
initial / animate
Animate on mount
initial → animate runs once when the element mounts.
shadow
Box-shadow
Soft, breathing drop-shadow on a hovering disc.
createAnimateMini
createAnimateMini
WAAPI-only sibling of createAnimate — smallest bundle for transform & opacity sequences.
createAnimationFrame
createAnimationFrame
Run a callback every frame — drive a signal and a motion value from one rAF loop.
reducedMotion
createReducedMotionConfig
Read the resolved reduced-motion preference — combines the OS setting with MotionConfig.
--props
CSS variables
Animate any custom property — color, length, anything.
utility
delay()
A cancellable, frame-aware setTimeout — returns a cancel function.
auto-height
Height: auto
A collapsible drawer with smooth height animation.
keyframes
Keyframes
Pass an array of values to interpolate through keyframes.
generator
spring()
Use the spring generator with animate() — switch stiffness on the fly.
imperative
stagger()
Imperative stagger — pass stagger() to animate() to cascade selectors.
transition.path
Transition along an arc
Set `transition.path = arc()` to follow a curved bezier path between keyframes instead of the default straight line.
tween
Tween easing
A linear tween with custom cubic-bezier easing.
utility
wrap()
Wrap a number into [min, max) — perfect for circular indices.

Variants

orchestration and staggering
createCycle
createCycle
Step through a fixed set of variants — each click advances and wraps around.
custom
Dynamic variants
Variants can be functions that receive a per-item custom value.

AnimatePresence

mount and unmount animations
pagination
Image gallery
Directional slide-and-fade as you page through.
modal
Modal
Backdrop fade + sheet slide, with coordinated exit.

Layout

layout and shared layout animations
layout
Expandable card
A card grows to reveal more content with shared layout.
layout
Layout — shuffle
A list of items reshuffles every second; layout springs them into place.
layoutId
Shared layout
layoutId animates between two elements as one.

Drag

draggable elements, constraints, reorder
drag
Drag — basic
A draggable block with momentum and a soft spring back.
Reorder
Reorder list
Drag the rows to reorder them — values stay in sync.

Scroll

scroll-linked animations and viewport
createInView
createInView
A boolean accessor — flip any UI from the imperative IntersectionObserver primitive.
createTransform
Parallax layers
Two shapes drift at different speeds as you scroll the box.
imperative
scroll()
Imperative scroll() — drive a progress bar with a callback.
createScroll
Scroll progress
A spring-smoothed scrollYProgress on the inner container.
whileInView
While in view
Each card animates as it enters the viewport.

Motion Values

hooks for fine-grained reactivity
imperative
createAnimate
Imperative animation — chain steps inside a click handler.
createComputed
createComputed
Derive a motion value from a getter — dependencies are auto-tracked.
createFollowValue
createFollowValue
Trail a source value with a tween — no spring physics, no overshoot.
createMotionValueEvent
createMotionValueEvent
Subscribe to every change of a motion value — drag and watch the readout.
createSpring
createSpring
Smooth any motion value with a spring — fingers track lag.
createTime
createTime
A motion value that ticks with the document — drive any prop.
createVelocity
createVelocity
Skew the dragged element by its instantaneous velocity.
RowValue
RowValue counter
Animate a MotionValue and read it inline with <RowValue>.

SVG

paths, morphing and SVG transforms
pathLength
SVG path draw
Animate pathLength to draw the checkmark on mount.

Showcase

polished UI components built with motion
states
Animated button
A submit button that morphs through pending and success.
springs
Cursor trail
A chain of springs follows the pointer with growing lag.
layout
Toggle switch
Layout animates the knob, color crossfades the track.