Report a problem or share feedback← Catalog
AnimateView: Toggle
freemotion/animate-view-toggle
An example of using AnimateView to animate a toggle switch with smooth update animations using Motion for React.
$
pnpm add motion # then adapt the free source from https://motion.dev/examples/react-animate-view-togglenpm deps: motion

- Source
- Motion (motion.dev)
- Kind
- transition
- Categories
- transition, input
- Use as
- recipe — technique you apply to your own markup
- Applies to
- input
- Motion
- on state · subtle · motion · medium cost
- Tags
- motion, spring, AnimateView
- Licence
- motion / motion/react / motion-v are MIT. Motion+ (premium components, example source, AI Kit pro tools) is paid — one-time Personal licence or per-seat Business.
- Live demo
- motion.dev
- Docs
- motion.dev
Similar
Compare all 4 →- CSS springmotion/css-springAn example of generating a spring animation in CSS using Motion's spring function.
- Checkbox checktransitions/checkbox-checkCheckboxes, to-do completion, multi-select rows — any boolean control where the checked state should feel earned. The box's background fills first, then the checkmark draws itself via stroke-dashoffset after a short delay; unchecking reverses quickly with no draw.
- Toggletransitions/toggleOn/off switches — settings rows, theme toggles, feature flags. The thumb travels across the track with a two-step overshoot (past the end, back, settle) while the track color cross-fades on its own clock.