Hooks
Reusable React hooks exported from @repo/ui for common UI patterns.
Import
import { useKeyboardShortcut, useMediaQuery, useCopyToClipboard } from "@repo/ui";| Hook | Description |
|---|---|
useClickHandlers | Provides onClick and onDoubleClick handlers that don't conflict with each other. |
useColumnVisibility | Manages column visibility state for table components. |
useCopyToClipboard | Copy text to clipboard with a copied state that resets after a timeout. |
useIntersectionObserver | Low-level IntersectionObserver hook for custom viewport detection logic. |
useKeyboardShortcut | Register global keyboard shortcuts with modifier key support. |
useLocalStorage | Persist state to localStorage with automatic JSON serialization. |
useMediaQuery | React to CSS media query changes (e.g. responsive breakpoints, dark mode). |
useRemoveGaParams | Automatically strip Google Analytics UTM parameters from the URL. |
useResizeObserver | Observe element size changes via the ResizeObserver API. |
useScroll | Track the window scroll position for scroll-based UI effects. |
useScrollProgress | Track scroll progress as a percentage (0-100) of a container or the page. |
useToastWithUndo | Show a toast notification with an undo action that reverts the operation. |