{ "$schema": "https://ui.shadcn.com/schema/registry.json", "items": [ { "name": "use-local-storage", "type": "registry:hook", "title": "useLocalStorage", "description": "SSR-safe localStorage hook with typed values, cross-tab sync via the storage event, and a state-style setter (value or updater). Returns [value, setValue, remove].", "files": [ { "path": "use-local-storage.ts", "type": "registry:hook", "target": "~/hooks/use-local-storage.ts" } ] }, { "name": "use-media-query", "type": "registry:hook", "title": "useMediaQuery + useBreakpoint", "description": "Reactive media-query hook plus a named-breakpoint helper (isMobile / isTablet / isDesktop) tuned to Tailwind v4 defaults. SSR-safe.", "files": [ { "path": "use-media-query.ts", "type": "registry:hook", "target": "~/hooks/use-media-query.ts" } ] }, { "name": "use-clipboard", "type": "registry:hook", "title": "useClipboard", "description": "Copy hook with a 'copied' flag that auto-resets after a configurable timeout. Falls back to document.execCommand for older browsers without the Clipboard API.", "files": [ { "path": "use-clipboard.ts", "type": "registry:hook", "target": "~/hooks/use-clipboard.ts" } ] }, { "name": "use-debounce", "type": "registry:hook", "title": "useDebounce + useDebouncedCallback", "description": "Value-debouncing hook and a callback-debouncing companion (with a cancel() method). Latest fn / args win. Universal for search inputs, autosave, expensive computations.", "files": [ { "path": "use-debounce.ts", "type": "registry:hook", "target": "~/hooks/use-debounce.ts" } ] }, { "name": "use-throttle", "type": "registry:hook", "title": "useThrottle + useThrottledCallback", "description": "Value-throttling and callback-throttling hooks for scroll/mouse-rate signals where every change isn't worth a render or invocation.", "files": [ { "path": "use-throttle.ts", "type": "registry:hook", "target": "~/hooks/use-throttle.ts" } ] }, { "name": "use-event-listener", "type": "registry:hook", "title": "useEventListener", "description": "Typed event listener hook with auto-cleanup. Overloads for window / document / element-ref targets. Captures the latest handler in a ref so consumers never need to memoise.", "files": [ { "path": "use-event-listener.ts", "type": "registry:hook", "target": "~/hooks/use-event-listener.ts" } ] }, { "name": "use-intersection-observer", "type": "registry:hook", "title": "useIntersectionObserver", "description": "Generic visibility hook returning { ref, entry, isIntersecting }. Optional freezeOnceVisible for one-shot reveals (lazy-load, scroll-triggered animations, view tracking).", "files": [ { "path": "use-intersection-observer.ts", "type": "registry:hook", "target": "~/hooks/use-intersection-observer.ts" } ] }, { "name": "use-previous", "type": "registry:hook", "title": "usePrevious", "description": "Returns the previous render's value. Tiny but constantly needed (compare props, animate on change, log transitions).", "files": [ { "path": "use-previous.ts", "type": "registry:hook", "target": "~/hooks/use-previous.ts" } ] }, { "name": "use-keyboard-shortcuts", "type": "registry:hook", "title": "useKeyboardShortcuts + formatShortcut", "description": "Register keyboard shortcuts with a typed API. Auto-cleans on unmount. Supports `mod` (Cmd/Ctrl), modifier combos, ignores input/textarea/contenteditable by default. Includes `formatShortcut` for pretty-printing in help dialogs.", "files": [ { "path": "use-keyboard-shortcuts.ts", "type": "registry:hook", "target": "~/hooks/use-keyboard-shortcuts.ts" } ] }, { "name": "use-async", "type": "registry:hook", "title": "useAsync (one-off promise → { data, error, loading, refetch })", "description": "Run a one-off async function and track loading / error / data. For smaller cases where pulling in React Query is overkill (autocomplete probe, lazy Drawer content, settings-page lookup). Latest-call-wins so stale results never flash back.", "files": [ { "path": "use-async.ts", "type": "registry:hook", "target": "~/hooks/use-async.ts" } ] }, { "name": "use-mounted", "type": "registry:hook", "title": "useIsMounted + useMountedRef", "description": "SSR-safe 'am I on the client?' hooks. `useIsMounted()` returns `false` until after `useEffect` fires — a lighter alternative to `` for one-off dodges. `useMountedRef()` returns a ref for async callbacks that need to check 'am I still here?' before calling setState.", "files": [ { "path": "use-mounted.ts", "type": "registry:hook", "target": "~/hooks/use-mounted.ts" } ] }, { "name": "use-toggle", "type": "registry:hook", "title": "useToggle", "description": "Boolean state with `{ value, toggle, on, off, set }`. Stable references so it's safe to pass into memoised children. Used everywhere — dialog open state, sidebar collapse, 'show advanced', filter panels.", "files": [ { "path": "use-toggle.ts", "type": "registry:hook", "target": "~/hooks/use-toggle.ts" } ] } ] }