Hooks

Reusable React hooks exported from @repo/ui for common UI patterns.

Import

import { useKeyboardShortcut, useMediaQuery, useCopyToClipboard } from "@repo/ui";
HookDescription
useClickHandlersProvides onClick and onDoubleClick handlers that don't conflict with each other.
useColumnVisibilityManages column visibility state for table components.
useCopyToClipboardCopy text to clipboard with a copied state that resets after a timeout.
useIntersectionObserverLow-level IntersectionObserver hook for custom viewport detection logic.
useKeyboardShortcutRegister global keyboard shortcuts with modifier key support.
useLocalStoragePersist state to localStorage with automatic JSON serialization.
useMediaQueryReact to CSS media query changes (e.g. responsive breakpoints, dark mode).
useRemoveGaParamsAutomatically strip Google Analytics UTM parameters from the URL.
useResizeObserverObserve element size changes via the ResizeObserver API.
useScrollTrack the window scroll position for scroll-based UI effects.
useScrollProgressTrack scroll progress as a percentage (0-100) of a container or the page.
useToastWithUndoShow a toast notification with an undo action that reverts the operation.