|Kit

useReducedMotion

Tracks the visitor's prefers-reduced-motion setting, for motion that is driven from JavaScript.

useReducedMotion tracks whether the visitor has asked their OS for less motion, updating live if they change the setting mid-session.

import { useReducedMotion } from '@42-central/ui-react';

const reduced = useReducedMotion();
el.scrollTo({ left, behavior: reduced ? 'auto' : 'smooth' });

Reach for it when the motion lives in JavaScript — a smooth scroll, an autoplay, a timed transition you start yourself. Motion written in CSS doesn't need it: Tailwind's motion-reduce: variant covers that with no hydration step. See Motion for the kit-wide contract.

SSR-safe, on top of useMediaQuery: the server and the first client render both read false, then the real setting arrives just after mount. Motion is the default and reducing it is opted into, so that first render must not depend on it — don't start a JS animation during render.

Usage

Toggle "Reduce motion" in your OS accessibility settings.

Full motion

Code

const reduced = useReducedMotion();

<p>{reduced ? 'Reduced motion requested' : 'Full motion'}</p>

API

Takes no arguments. Returns a boolean — true while prefers-reduced-motion: reduce matches.

On this page