Motion v skilld

From skilld-dev/vue-ecosystem-skills · View interactive version

Motion v skilld is an AI agent skill from the GitHub repository skilld-dev/vue-ecosystem-skills. ALWAYS load when writing or debugging code that imports "motion-v" (Motion for Vue, motion-vue). Covers the motion component, AnimatePresence, variants, gestures, layout, scroll, motion values, the v-motion directive, and the Nuxt module for version 2.4.4. Provides API facts, recipes, best practices

How to use this skill

Skill file

motion-v (Motion for Vue) 2.4.4

Motion for Vue is the Vue port of Motion (formerly Framer Motion).

It animates DOM and SVG through props, motion values, and a hybrid engine.

Facts, all verified from the prepared source:

Quick start

npm install motion-v
<script setup>
import { motion } from 'motion-v'
</script>

<template>
  <motion.div :initial="{ opacity: 0 }" :animate="{ opacity: 1, x: 100 }" />
</template>

motion is a namespace of typed components for every HTML and SVG tag

(dist/es/components/motion/index.d.ts:3-182). motion.div, motion.svg, motion.path and so on.

Core model

Full prop and hook listing: references/api-surface.md

Hard rules

These rules prevent the most common bugs. Each cites its source.

  1. Use m plus LazyMotion instead of motion when bundle size matters.

motion ships all features, about 34 kb. m starts near 6 kb.

Load domAnimation for variants, gestures, exit. Load domMax for drag and layout.

Set strict to catch stray motion usage in dev.

https://motion.dev/docs/vue-lazymotion, dist/es/components/lazy-motion/index.d.ts:4-13

  1. Never put v-if on AnimatePresence itself. If it unmounts, it cannot intercept child exits.

Put the condition on the direct child instead:

```vue

<AnimatePresence>

<motion.div v-if="isVisible" :exit="{ opacity: 0 }" />

</AnimatePresence>

```

https://motion.dev/docs/vue-animate-presence

  1. For layout animations, apply changing CSS to :style, never to :animate.

The layout prop animates the measured change. Values in :animate fight the FLIP measurement.

https://motion.dev/docs/vue-layout-animations

  1. Set borderRadius and boxShadow as inline styles on layout elements.

Motion corrects scale distortion for these two only when they are motion values in :style.

https://motion.dev/docs/vue-layout-animations#scale-correction

  1. Add layoutScroll on scrollable ancestors and layoutRoot on fixed position ancestors.

Without them, layout measurement is wrong when scroll or viewport offset is non zero.

dist/es/components/motion/props.d.ts:71-78

  1. Set reducedMotion="user" on a root MotionConfig.

The default is "never", so animations ignore the OS accessibility setting unless you opt in.

dist/es/components/motion-config/types.d.ts:5-20

  1. Use dynamic variants with custom for stagger, not computed delays in reactive state.

Pass :custom="index" and resolve delay inside the variant function.

https://motion.dev/docs/vue-animation

  1. Render live motion values with <RowValue :value="mv" /> in demos and readouts.

It writes innerHTML directly and keeps fast values off the Vue render path.

dist/es/components/RowValue.d.ts:1-15

  1. Use v-motion for plain elements when a wrapper component does not fit.

Register it globally with app.use(MotionPlugin), or create presets with createPresetDirective.

The directive supports SSR through getSSRProps and defaults to domMax features.

dist/es/directive/index.mjs:153-172

  1. Gesture shorthand props focus, hover, press, inView were removed in v2.0.0.

Use whileFocus, whileHover, whilePress, whileInView for animation, and event props like onHoverStart for logic.

See references/migration.md

Common tasks

Enter and exit, stagger, drag, scroll linked, imperative useAnimate, shared layout, Reorder lists, directive usage, LazyMotion, and Nuxt setup, each with a runnable snippet: references/recipes.md

Changes since the 2.2.1 baseline

Details and links: references/migration.md

Version specific notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.