From skills
Animating Base UI components with Motion for React. Use this skill when implementing animations on Base UI components (Menu, Dialog, Popover, Tooltip, Switch, etc.) with the Motion library. Triggers on: motion animation, base-ui animate, animate dropdown, animate dialog, animate popover, exit animation, spring animation, render prop animation, AnimatePresence base-ui.
How this skill is triggered — by the user, by Claude, or both
Slash command
/skills:motion-base-uiThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
When animating Base UI components with Motion, follow these rules strictly.
When animating Base UI components with Motion, follow these rules strictly.
motion/react, never from framer-motionimport { motion, AnimatePresence } from "motion/react";
Pass a motion component via the Base UI render prop. Never use the function/spread props approach as this causes type errors.
<Menu.Popup
render={<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} />}
>
{/* Children */}
</Menu.Popup>
Some Base UI components (ContextMenu, Popover, Dialog) control their own conditional rendering. To add exit animations:
open state with useStatekeepMounted to the Portal componentPortal in AnimatePresencefunction App() {
const [open, setOpen] = useState(false);
return (
<Dialog.Root open={open} onOpenChange={setOpen}>
<Dialog.Trigger>Open</Dialog.Trigger>
<AnimatePresence>
{open && (
<Dialog.Portal keepMounted>
<Dialog.Backdrop
render={
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
/>
}
/>
<Dialog.Popup
render={
<motion.div
initial={{ opacity: 0, scale: 0.95 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.95 }}
/>
}
>
{/* Content */}
</Dialog.Popup>
</Dialog.Portal>
)}
</AnimatePresence>
</Dialog.Root>
);
}
Note: Portal keeps the tree mounted as long as Base UI detects animations via element.getAnimations(). Motion runs opacity, transform, filter, and clipPath via hardware acceleration, so ensure at least one of these is used for exit animations.
willChange: "transform" when animating transform, x, y, scale, etc.opacity, clipPath, or filter to willChange if animating thosewillChange: transform, opacity, clipPath, filtertransform over independent transforms (x, y, scaleX) for hardware accelerationanimate(element, { x: 100 });
hover(() => {
animate(element, { scale: 1.2 });
return () => animate(element, { scale: 1 });
});
style:<motion.div animate={{ x: 100 }} style={{ scale: 2 }} />
value.on("change", update), never value.onChange(update)value.stop() to end current animation — don't track animation in a variableanimate FunctionThree valid syntaxes:
// Motion value
animate(motionValue, targetValue, options);
// Origin to target (add onUpdate to options)
animate(originValue, targetValue, { onUpdate: (v) => {} });
// Element or object
animate(element, { opacity: 1 }, options);
Use initial/whileHover/whileTap on parent motion.* elements. Children with matching variants keys inherit the active variant automatically — no animate prop needed:
<motion.li initial="idle" whileHover="hover">
<motion.span
variants={{
idle: { scale: 1 },
hover: { scale: 1.2 },
}}
/>
</motion.li>
ease option in camelCase: easeOut, easeInOutlib/springs.ts:import { springs } from "@/lib/springs";
animate(motionX, targetX, springs.moderate);
// or
<motion.div transition={springs.moderate} />;
framer-motionrender prop for Base UI + Motion, never function/spreadAnimatePresence + keepMounted for exit animations on portalled componentswillChange over transform: translateZ(0)easeOut not ease-outnpx claudepluginhub gokulkrishh/skills --plugin skillsProduction-ready UI motion system for React/Next.js with performance, accessibility, and usability focus. Provides motion tokens, animation patterns, and device adaptation guidelines.
Implements Motion (Framer Motion) animations in React for drag-and-drop, gestures, scroll effects, SVG morphing, layout transitions, spring physics, and bundle optimization.
Creates smooth React/JavaScript animations with Motion/Framer Motion: motion components, variants, gestures (hover/tap/drag), layout/exit animations, springs, scroll effects. For interactive UIs, micro-interactions, transitions.