BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/zyeon/use-debounce-value

useDebounceValue

zyeon/use-debounce-value
FreeHook

A generic hook that returns a value only after it has stopped changing for a delay, with no flash on first render.

See it running

Open the demo on zyeon

ui.zyeon.ai/r/use-debounce-value
Open
This registry sends X-Frame-Options, so its page cannot be embedded here. The link is the same page the frame would have shown.

Install it

npx shadcn@latest add https://ui.zyeon.ai/r/use-debounce-value.json

Source

src/registry/hooks/use-debounce-value.tsxui.zyeon.ai/r/use-debounce-value.json
1"use client"
2
3import * as React from "react"
4
5/**
6 * Debounces a fast-changing value. The first render returns `value` as-is
7 * (no flash-to-empty), then `debouncedValue` only catches up to the latest
8 * `value` once `delay` ms have passed without `value` changing again — every
9 * new `value` restarts the wait. Changing `delay` also restarts the timer
10 * with the new duration. The pending timer is cleared on unmount (and before
11 * every re-run), so no stray `setState` fires after the consumer is gone.
12 */
13export function useDebounceValue<T>(value: T, delay = 300): T {
14 const [debouncedValue, setDebouncedValue] = React.useState(value)
15
16 React.useEffect(() => {
17 const timeout = setTimeout(() => {
18 setDebouncedValue(value)
19 }, delay)
20
21 return () => clearTimeout(timeout)
22 }, [value, delay])
23
24 return debouncedValue
25}
26
27export default useDebounceValue

Files it writes

  • src/registry/hooks/use-debounce-value.tsx

Facts

Registry
zyeon
Type
registry:hook
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-04
Last confirmed
today

Go to the source

Docs on zyeon ui.zyeon.ai Zyeon-AI/zyeon-ui-components on GitHub Raw registry item This item as JSON

More from zyeon

All 517 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
useAsyncuse-asynczyeonHooksFreeno deps
useBroadcastChanneluse-broadcast-channelzyeonHooksFreeno deps
useClickOutsideuse-click-outsidezyeonHooksFreeno deps
useClipboardPasteuse-clipboard-pastezyeonHooksFreeno deps
useControllableStateuse-controllable-statezyeonHooksFreeno deps
useCopyToClipboarduse-copy-to-clipboardzyeonHooksFreeno deps
useCountdownuse-countdownzyeonHooksFreeno deps
useDocumentTitleuse-document-titlezyeonHooksFreeno deps
BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex