← @crux-kit/hooks
A collection of reusable React hooks for common UI and browser interaction patterns.
Each hook is client-side only and tree-shakeable. Detailed documentation for each hook lives alongside its source file.
Available Hooks
| Hook | Description | Docs |
|---|---|---|
useBodyClass |
Adds CSS classes to document.body while a component is mounted |
Readme.md |
useCopyToClipboard |
Copies text to the clipboard with a timed isCopied flag |
Readme.md |
useCountdown |
Countdown timer that fires a callback on completion | Readme.md |
useDebounceSearch |
Debounced search input with a minimum character threshold | Readme.md |
useDisclosure |
Boolean open/closed state with open, close, and toggle helpers |
Readme.md |
useEffectOnce |
Runs a side-effect exactly once after the initial render | Readme.md |
useEventListener |
Declarative event listener with automatic cleanup | Readme.md |
useIsMobile |
Returns true when the viewport is below a breakpoint |
Readme.md |
useMounted |
Returns true after the component has mounted (SSR-safe) |
Readme.md |
useOutsideClick |
Fires a callback when a click/touch occurs outside a referenced element | Readme.md |
usePageMeta |
Sets page <title> and <meta name="description"> while mounted |
Readme.md |
useScrollPosition |
Tracks vertical scroll position of the window or a specific element | Readme.md |
useViewport |
Returns current viewport [height, width], updates on resize |
Readme.md |