Z
Zyeon-AI
/
zyeon-ui-components
/
hooks
Files
Code
Info
useAsync
use-async
A one-call async state machine with last-call-wins race protection, AbortSignal cancellation and unmount-safe resolves.
useBroadcastChannel
use-broadcast-channel
Broadcasts messages between same-origin tabs over BroadcastChannel, with SSR-safe capability detection, an optional local echo and structured-clone diagnostics.
useClickOutside
use-click-outside
A hook that runs a handler when a pointer interaction lands outside one or more referenced elements.
useClipboardPaste
use-clipboard-paste
Catches pasted images, files and rich text — page-wide or scoped to a ref — draining clipboardData synchronously, gating files through accept/maxFiles with an itemised rejection list, plus an optional permission-checked active read.
useControllableState
use-controllable-state
A useState-shaped hook that lets one component serve both controlled (value/onChange) and uncontrolled (defaultValue) callers, with a stable setter and prop-accurate updaters.
useCopyToClipboard
use-copy-to-clipboard
A clipboard-copy hook with a timed copied state and a non-throwing error channel.
useCountdown
use-countdown
A duration-based countdown state machine with start/pause/reset controls and a once-only onComplete callback.
useDebounceValue
use-debounce-value
A generic hook that returns a value only after it has stopped changing for a delay, with no flash on first render.
useDocumentTitle
use-document-title
Sets document.title for as long as a component is mounted and restores the pre-mount title on unmount.
useDragScroll
use-drag-scroll
Grab-to-scroll any overflow container with pointer drags — momentum glide, grabbing cursor, and click suppression so dragging over a card never fires its onClick.
useEventListener
use-event-listener
A type-safe window/document/element event listener hook with a latest-ref handler — zero rebinds on handler change, never stale.
useEventSource
use-event-source
Subscribe to a Server-Sent Events stream with a four-state connection machine, capped exponential-backoff reconnects, named-event subscriptions and callbacks that never re-open the stream.
useFocusTrap
use-focus-trap
A hook that keeps keyboard focus inside a container: moves focus in, cycles Tab both ways, only the innermost trap reacts, and focus returns to the trigger on release.
useFullscreen
use-fullscreen
A hook that requests/exits native fullscreen on a single element via a callback ref, keeping a fullscreen boolean in sync (including Esc) through useSyncExternalStore.
useGeolocation
use-geolocation
Reads or continuously watches the browser's geolocation behind an explicit request()/stop() pair, with hydration-safe capability detection, a queried permission state, and separate denied / timeout / position-unavailable / unsupported outcomes.
useHash
use-hash
An SSR-safe hook that reads and writes the URL hash as shareable UI state, writing through pushState/replaceState and broadcasting to every instance on the page.
useHover
use-hover
A callback-ref hover hook that exposes a hovered boolean via pointerenter/pointerleave, for hover-driven side effects like prefetching — not for CSS-replaceable visual hover styling.
useIdle
use-idle
Flips a boolean idle state after a period with no pointer, keyboard, wheel, or touch activity, with a throttled reset and SSR-safe cleanup.
useIndexedDb
use-indexed-db
An async IndexedDB-backed store hook: loading state, versioned upgrades, blocked-deadlock handling, quota errors, key-range queries and cross-tab invalidation.
useIntersectionObserver
use-intersection-observer
A callback-ref hook reporting whether an element is intersecting its viewport, with an optional one-shot reveal-once mode.
useInterval
use-interval
A declarative setInterval hook with a nullable delay, an always-fresh callback, and pause/resume controls.
useKeyboardShortcut
use-keyboard-shortcut
A hook that binds human-readable key combos like mod+k to a handler, with platform-aware modifiers and an input-focus guard.
useList
use-list
Array state with every mutation you keep hand-writing — push, insertAt, move, swap and keyed upsert, all batch-safe, out-of-range-safe, and reference-stable.
useLocalStorage
use-local-storage
An SSR-safe localStorage-backed state hook, kept in sync across same-tab instances and other tabs.
useLongPress
use-long-press
A press-and-hold gesture hook returning spreadable pointer/keyboard handlers plus isPressing and 0–1 progress — pointer-captured, cancels past a move tolerance, works with held Space/Enter.
useMediaQuery
use-media-query
An SSR-safe hook that subscribes to a CSS media query and returns whether it currently matches.
useMousePosition
use-mouse-position
A hook that tracks pointer position, optionally relative to an element, with clamped 0..1 normalized coordinates.
useMutationObserver
use-mutation-observer
A callback-ref hook that watches DOM changes with MutationObserver — filtered attributes, rAF-batched records, and a disconnect/write/observe guard against self-feeding loops.
useNotification
use-notification
Sends desktop notifications behind a gesture-gated requestPermission() that never throws, keeps the permission state live via the Permissions API, registers each notification by tag so close(tag) works, and skips notifications while the page is visible.
useOnline
use-online
An SSR-safe hook that tracks the browser's online/offline status via useSyncExternalStore.
useOptimistic
use-optimistic
Keyed optimistic updates for plain props and event handlers: props always reclaim a stale overlay so counters cannot drift, sync throws become rejections, repeat clicks on a pending key are refused, out-of-order resolves lose, and failures roll back with a readable error.
usePageVisibility
use-page-visibility
Subscribes to page visibility via useSyncExternalStore so polling, timers and video pause when the tab is hidden, with onVisible/onHidden callbacks and the away duration.
usePagination
use-pagination
Headless pagination state — clamped page, page count, item range, client-side slice() and the ellipsis page sequence, controlled or uncontrolled.
usePermission
use-permission
Subscribes to navigator.permissions for one name or a whole panel of them — query only, never request — folding Firefox's rejections, Safari's gaps, unknown names and insecure origins into one honest unsupported state with a reason, plus change-event updates and a manual query().
usePrevious
use-previous
A hook that returns the value from one render ago, via render-time state adjustment instead of a ref+effect.
useQueryParam
use-query-param
An SSR-safe hook that keeps a piece of state in a URL query parameter, with typed codecs, defaults kept out of the link, replace-by-default history and every instance on the page in sync.
useResizeObserver
use-resize-observer
A callback-ref hook that measures an element's own size with ResizeObserver — selectable box model, rAF-batched or debounced commits, and no resize-loop errors.
useRovingTabindex
use-roving-tabindex
A roving-tabindex hook that gives a control group one Tab stop and arrow-key navigation inside it — horizontal / vertical / grid lanes, disabled-item skipping, loop or stop, Home/End and typeahead.
useScrollDirection
use-scroll-direction
A scroll-direction hook that only re-renders on up/down flips, with a displacement threshold to ignore jitter.
useScrollLock
use-scroll-lock
A controlled body-scroll lock hook with scrollbar-width compensation and a reentrant lock counter for multiple simultaneous callers.
useSelection
use-selection
A list multi-selection state machine with Shift range, platform-aware cmd/ctrl toggle, tri-state select-all flags, and automatic pruning when items change.
useSessionStorage
use-session-storage
An SSR-safe sessionStorage-backed state hook, kept in sync across same-tab instances only.
useSpeechRecognition
use-speech-recognition
Speech-to-text on the Web Speech API: prefixed-constructor detection, interim vs settled transcripts, a continuous mode that re-arms itself after the engine's silence timeout yet always stops on stop(), and errors split into benign / recoverable / blocked.
useStep
use-step
A step machine for multi-step flows — async can-go-next gates with a pending flag, visited/completed sets, loop, and clamping when steps change.
useSwipe
use-swipe
A Pointer Events swipe hook with axis/direction locking, distance-or-velocity commit and live follow-the-finger deltas — spread its props, animate the offset yourself.
useThrottleValue
use-throttle-value
A generic hook that throttles a fast-changing value with leading + trailing emission, ticking at most once per interval.
useTimeout
use-timeout
A declarative one-shot setTimeout hook with a latest-ref callback, a null-to-pause delay, and reset/clear controls.
useToggle
use-toggle
A boolean-state hook with a fixed toggle/setTrue/setFalse/set action set that keeps a stable reference across renders.
useUndoRedo
use-undo-redo
A state container with linear undo/redo history — keystroke coalescing, forced breakpoints, a bounded stack, and stable callbacks.
useWakeLock
use-wake-lock
Keeps the screen awake for the length of a task and re-acquires the wake lock the browser silently takes away whenever the tab is hidden, with gesture-safe requests and distinguishable refusal errors.
useWebShare
use-web-share
Opens the native share sheet with typed outcomes — a cancelled sheet is dismissed rather than an error, files are gated behind canShare, and the fallback reports its own success or failure.
useWindowSize
use-window-size
A hook that tracks the viewport size with per-frame or debounced commits and an explicit not-ready state before hydration.
Select a component to view its code
Click on any item in the sidebar to get started
Select a component to view its information
useAsync
use-async
A one-call async state machine with last-call-wins race protection, AbortSignal cancellation and unmount-safe resolves.
useBroadcastChannel
use-broadcast-channel
Broadcasts messages between same-origin tabs over BroadcastChannel, with SSR-safe capability detection, an optional local echo and structured-clone diagnostics.
useClickOutside
use-click-outside
A hook that runs a handler when a pointer interaction lands outside one or more referenced elements.
useClipboardPaste
use-clipboard-paste
Catches pasted images, files and rich text — page-wide or scoped to a ref — draining clipboardData synchronously, gating files through accept/maxFiles with an itemised rejection list, plus an optional permission-checked active read.
useControllableState
use-controllable-state
A useState-shaped hook that lets one component serve both controlled (value/onChange) and uncontrolled (defaultValue) callers, with a stable setter and prop-accurate updaters.
useCopyToClipboard
use-copy-to-clipboard
A clipboard-copy hook with a timed copied state and a non-throwing error channel.
useCountdown
use-countdown
A duration-based countdown state machine with start/pause/reset controls and a once-only onComplete callback.
useDebounceValue
use-debounce-value
A generic hook that returns a value only after it has stopped changing for a delay, with no flash on first render.
useDocumentTitle
use-document-title
Sets document.title for as long as a component is mounted and restores the pre-mount title on unmount.
useDragScroll
use-drag-scroll
Grab-to-scroll any overflow container with pointer drags — momentum glide, grabbing cursor, and click suppression so dragging over a card never fires its onClick.
useEventListener
use-event-listener
A type-safe window/document/element event listener hook with a latest-ref handler — zero rebinds on handler change, never stale.
useEventSource
use-event-source
Subscribe to a Server-Sent Events stream with a four-state connection machine, capped exponential-backoff reconnects, named-event subscriptions and callbacks that never re-open the stream.
useFocusTrap
use-focus-trap
A hook that keeps keyboard focus inside a container: moves focus in, cycles Tab both ways, only the innermost trap reacts, and focus returns to the trigger on release.
useFullscreen
use-fullscreen
A hook that requests/exits native fullscreen on a single element via a callback ref, keeping a fullscreen boolean in sync (including Esc) through useSyncExternalStore.
useGeolocation
use-geolocation
Reads or continuously watches the browser's geolocation behind an explicit request()/stop() pair, with hydration-safe capability detection, a queried permission state, and separate denied / timeout / position-unavailable / unsupported outcomes.
useHash
use-hash
An SSR-safe hook that reads and writes the URL hash as shareable UI state, writing through pushState/replaceState and broadcasting to every instance on the page.
useHover
use-hover
A callback-ref hover hook that exposes a hovered boolean via pointerenter/pointerleave, for hover-driven side effects like prefetching — not for CSS-replaceable visual hover styling.
useIdle
use-idle
Flips a boolean idle state after a period with no pointer, keyboard, wheel, or touch activity, with a throttled reset and SSR-safe cleanup.
useIndexedDb
use-indexed-db
An async IndexedDB-backed store hook: loading state, versioned upgrades, blocked-deadlock handling, quota errors, key-range queries and cross-tab invalidation.
useIntersectionObserver
use-intersection-observer
A callback-ref hook reporting whether an element is intersecting its viewport, with an optional one-shot reveal-once mode.
useInterval
use-interval
A declarative setInterval hook with a nullable delay, an always-fresh callback, and pause/resume controls.
useKeyboardShortcut
use-keyboard-shortcut
A hook that binds human-readable key combos like mod+k to a handler, with platform-aware modifiers and an input-focus guard.
useList
use-list
Array state with every mutation you keep hand-writing — push, insertAt, move, swap and keyed upsert, all batch-safe, out-of-range-safe, and reference-stable.
useLocalStorage
use-local-storage
An SSR-safe localStorage-backed state hook, kept in sync across same-tab instances and other tabs.
useLongPress
use-long-press
A press-and-hold gesture hook returning spreadable pointer/keyboard handlers plus isPressing and 0–1 progress — pointer-captured, cancels past a move tolerance, works with held Space/Enter.
useMediaQuery
use-media-query
An SSR-safe hook that subscribes to a CSS media query and returns whether it currently matches.
useMousePosition
use-mouse-position
A hook that tracks pointer position, optionally relative to an element, with clamped 0..1 normalized coordinates.
useMutationObserver
use-mutation-observer
A callback-ref hook that watches DOM changes with MutationObserver — filtered attributes, rAF-batched records, and a disconnect/write/observe guard against self-feeding loops.
useNotification
use-notification
Sends desktop notifications behind a gesture-gated requestPermission() that never throws, keeps the permission state live via the Permissions API, registers each notification by tag so close(tag) works, and skips notifications while the page is visible.
useOnline
use-online
An SSR-safe hook that tracks the browser's online/offline status via useSyncExternalStore.
useOptimistic
use-optimistic
Keyed optimistic updates for plain props and event handlers: props always reclaim a stale overlay so counters cannot drift, sync throws become rejections, repeat clicks on a pending key are refused, out-of-order resolves lose, and failures roll back with a readable error.
usePageVisibility
use-page-visibility
Subscribes to page visibility via useSyncExternalStore so polling, timers and video pause when the tab is hidden, with onVisible/onHidden callbacks and the away duration.
usePagination
use-pagination
Headless pagination state — clamped page, page count, item range, client-side slice() and the ellipsis page sequence, controlled or uncontrolled.
usePermission
use-permission
Subscribes to navigator.permissions for one name or a whole panel of them — query only, never request — folding Firefox's rejections, Safari's gaps, unknown names and insecure origins into one honest unsupported state with a reason, plus change-event updates and a manual query().
usePrevious
use-previous
A hook that returns the value from one render ago, via render-time state adjustment instead of a ref+effect.
useQueryParam
use-query-param
An SSR-safe hook that keeps a piece of state in a URL query parameter, with typed codecs, defaults kept out of the link, replace-by-default history and every instance on the page in sync.
useResizeObserver
use-resize-observer
A callback-ref hook that measures an element's own size with ResizeObserver — selectable box model, rAF-batched or debounced commits, and no resize-loop errors.
useRovingTabindex
use-roving-tabindex
A roving-tabindex hook that gives a control group one Tab stop and arrow-key navigation inside it — horizontal / vertical / grid lanes, disabled-item skipping, loop or stop, Home/End and typeahead.
useScrollDirection
use-scroll-direction
A scroll-direction hook that only re-renders on up/down flips, with a displacement threshold to ignore jitter.
useScrollLock
use-scroll-lock
A controlled body-scroll lock hook with scrollbar-width compensation and a reentrant lock counter for multiple simultaneous callers.
useSelection
use-selection
A list multi-selection state machine with Shift range, platform-aware cmd/ctrl toggle, tri-state select-all flags, and automatic pruning when items change.
useSessionStorage
use-session-storage
An SSR-safe sessionStorage-backed state hook, kept in sync across same-tab instances only.
useSpeechRecognition
use-speech-recognition
Speech-to-text on the Web Speech API: prefixed-constructor detection, interim vs settled transcripts, a continuous mode that re-arms itself after the engine's silence timeout yet always stops on stop(), and errors split into benign / recoverable / blocked.
useStep
use-step
A step machine for multi-step flows — async can-go-next gates with a pending flag, visited/completed sets, loop, and clamping when steps change.
useSwipe
use-swipe
A Pointer Events swipe hook with axis/direction locking, distance-or-velocity commit and live follow-the-finger deltas — spread its props, animate the offset yourself.
useThrottleValue
use-throttle-value
A generic hook that throttles a fast-changing value with leading + trailing emission, ticking at most once per interval.
useTimeout
use-timeout
A declarative one-shot setTimeout hook with a latest-ref callback, a null-to-pause delay, and reset/clear controls.
useToggle
use-toggle
A boolean-state hook with a fixed toggle/setTrue/setFalse/set action set that keeps a stable reference across renders.
useUndoRedo
use-undo-redo
A state container with linear undo/redo history — keystroke coalescing, forced breakpoints, a bounded stack, and stable callbacks.
useWakeLock
use-wake-lock
Keeps the screen awake for the length of a task and re-acquires the wake lock the browser silently takes away whenever the tab is hidden, with gesture-safe requests and distinguishable refusal errors.
useWebShare
use-web-share
Opens the native share sheet with typed outcomes — a cancelled sheet is dismissed rather than an error, files are gated behind canShare, and the fallback reports its own success or failure.
useWindowSize
use-window-size
A hook that tracks the viewport size with per-frame or debounced commits and an explicit not-ready state before hydration.
Select a component to view its code
Click on any item in the sidebar to get started
Select a component to view its information