fn
usePreferredReducedMotion
v0.0.14testeddemoReactive prefers-reduced-motion media query, resolving to
'reduce' when the user requests reduced motion and 'no-preference'
otherwise. SSR-safe via useMediaQuery.
Examples
ts
const motion = usePreferredReducedMotion();
// motion.value === 'reduce' | 'no-preference'ts
watchEffect(() => {
transitionDuration.value = motion.value === 'reduce' ? 0 : 200;
});Demo
Loading demo…
Signature
ts
export function usePreferredReducedMotion(
options: UsePreferredReducedMotionOptions ={ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
options? | UsePreferredReducedMotionOptions | Options (custom window) |
Returns
UsePreferredReducedMotionReturnReadonly ref of the current motion preference