BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/Sora UI/hooks-use-prefers-reduced-motion

usePrefersReducedMotion

sora-ui/hooks-use-prefers-reduced-motion
FreeHook

A hook that tracks the OS-level Reduced Motion setting live, so GSAP-driven primitives can skip or shortcut their animations.

Install it

npx shadcn@latest add https://ui.soralabs.io.vn/r/hooks-use-prefers-reduced-motion.json

Source

registry/hooks/use-prefers-reduced-motion/index.tsxui.soralabs.io.vn/r/hooks-use-prefers-reduced-motion.json
1"use client";
2
3import { useEffect, useLayoutEffect, useState } from "react";
4
5const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
6
7// useLayoutEffect is a no-op (with a console warning) during SSR — fall back
8// to useEffect there since there's no window/matchMedia to read anyway.
9const useIsomorphicLayoutEffect =
10 typeof window === "undefined" ? useEffect : useLayoutEffect;
11
12/**
13 * Tracks the OS-level Reduced Motion setting, live. Unlike a one-time
14 * `matchMedia(...).matches` check, this updates if the user toggles the
15 * setting while the page is open (no reload needed).
16 *
17 * Defaults to `true`, not `false`. A consumer that mounts a GSAP
18 * ScrollTrigger off this value reads it during its *first* render's effects
19 * no matter which effect phase either hook uses — React doesn't re-render
20 * mid-flush just because this hook's own effect called setState. Defaulting
21 * to `false` meant every mount briefly created a real, pinned ScrollTrigger
22 * before correcting a render later; anyone scrolling in that window saw the
23 * full animation despite reduced motion being on. Defaulting to `true`
24 * flips which side gets the one-frame guess: a non-reduced-motion user
25 * waits one imperceptible frame for the animation to start, instead of a
26 * reduced-motion user getting a live trigger they were never supposed to.
27 */
28export function usePrefersReducedMotion(): boolean {
29 const [prefersReducedMotion, setPrefersReducedMotion] = useState(true);
30
31 useIsomorphicLayoutEffect(() => {
32 const media = window.matchMedia(REDUCED_MOTION_QUERY);
33 const update = () => {
34 setPrefersReducedMotion(media.matches);
35 };
36 update();
37 media.addEventListener("change", update);
38 return () => {
39 media.removeEventListener("change", update);
40 };
41 }, []);
42
43 return prefersReducedMotion;
44}

Files it writes

  • registry/hooks/use-prefers-reduced-motion/index.tsx

Facts

Registry
Sora UI
Type
registry:hook
Access
Free
Files written
1
Licence
the repository states none
In the index
at or before 2026-08-12
Last confirmed
today

Go to the source

ui.soralabs.io.vn Raw registry item This item as JSON

More from Sora UI

All 97 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
useAutoHeighthooks-use-auto-heightSora UIHooksFreeno deps
useControlledStatehooks-use-controlled-stateSora UIHooksFreeno deps
useIsInViewhooks-use-is-in-viewSora UIHooksFree1 dep

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex