React hooks
LazyKit currently includes 42 React hooks. Their source files are flat and copyable; the groups below come from each page’s frontmatter.
State
useBooleanManages a boolean with explicit true, false, and toggle controls.
useControllableStateSupports controlled and uncontrolled component state through one API.
useCounterManages a bounded numeric counter with configurable steps.
useHistoryStateAdds bounded undo and redo history to a piece of React state.
useListManages an immutable dense list with common editing controls.
useMapManages an immutable Map with stable update controls.
useObjectStateManages plain-object state with type-safe shallow patches and key updates.
usePreviousReads the value from the preceding committed render.
useSetManages an immutable Set with add, remove, and toggle controls.
useStepNavigates a finite sequence of steps with optional wrapping.
useToggleToggles between two values while preserving their exact union type.
Async
useAsyncTaskRuns abort-aware work on demand and exposes the state of its latest invocation.
Timing
useCountdownRuns a controllable count-up or countdown with clamped steps and optional looping.
useDebouncedCallbackDelays a callback until calls have stopped while always invoking its latest implementation.
useDebouncedValuePublishes the latest generic value after it remains unchanged for a delay.
useIntervalRepeatedly invokes the latest callback and cleans up whenever its delay changes.
useThrottledCallbackRuns a callback on the leading edge and drops calls during a fixed interval.
useThrottledValuePublishes the latest generic value at most once during each interval.
useTimeoutSchedules the latest callback once with reset, cancel, and pending controls.
Functional
useEventCallbackReturns a stable callback that always delegates to the latest function.
useMergedRefsCombines callback and object refs into one React ref callback.
DOM
useClickOutsideRuns a handler when a pointer event occurs outside supplied elements.
useElementSizeMeasures an element with ResizeObserver and follows node swaps.
useEventListenerSubscribes to a typed DOM event while always calling the latest handler.
useFocusWithinTracks whether focus is on an element or one of its descendants.
useFullscreenControls standards-based fullscreen mode for an element or the page.
useHotkeyRuns a callback for one or more keyboard shortcuts.
useHoverTracks pointer hover for an element assigned through a callback ref.
useIntersectionObserverObserves whether an element intersects a root or the viewport.
useLongPressRecognizes a pointer press held for a configured duration.
useMutationObserverObserves DOM mutations for an element assigned through a callback ref.
useScrollLockLocks scrolling on the document body or a supplied element.
Storage
useStorageStateSynchronizes generic React state with local or session storage across same- and cross-document updates.
Web APIs
useBeforeUnloadRequests the browser's standard leave-page confirmation when unsaved work should block navigation.
useClipboardCopies text through the Clipboard API and tracks the latest request safely.
useDocumentTitleCoordinates the browser document title across mounted hook instances.
useDocumentVisibilityReturns the current document visibility state.
useIdleDetects inactivity from configurable window events and resets cleanly on new activity.
useMediaQuerySubscribes to a CSS media query with a hydration-safe fallback.
useOnlineStatusTracks browser online and offline status with an SSR-safe snapshot.
useWindowScrollTracks the window scroll position and exposes a typed scroll control.
useWindowSizeReturns a concurrent-safe snapshot of the viewport dimensions.