Overview
The@kuzenbo/hooks package provides 70+ production-ready React hooks for common UI patterns, state management, DOM interactions, and more. All hooks are framework-agnostic and can be used independently of other Kuzenbo packages.
Version 0.0.7 is currently published on npm. These hooks are battle-tested and production-ready.
Installation
Available Hooks
State Management
useToggle
Toggle between boolean states with convenient methods
useDisclosure
Control open/close state for modals, dropdowns, etc.
useCounter
Counter with increment, decrement, and reset
useListState
Array state with helper methods (append, prepend, remove, etc.)
useMap
Map state with set, delete, and clear methods
useSet
Set state with add, delete, and toggle methods
useSetState
Object state with partial updates (like class components)
useQueue
Queue data structure with enqueue/dequeue
useStateHistory
Track state history with undo/redo
useValidatedState
State with validation rules
useInputState
Simplified input state management
useUncontrolled
Manage controlled/uncontrolled component state
Performance & Timing
useDebouncedValue
Debounce a value
useDebouncedState
Debounced state setter
useDebouncedCallback
Debounce a callback function
useThrottledValue
Throttle a value
useThrottledState
Throttled state setter
useThrottledCallback
Throttle a callback function
useTimeout
Execute callback after delay
useInterval
Execute callback on interval
DOM & Browser
useClickOutside
Detect clicks outside an element
useEventListener
Attach event listeners safely
useWindowEvent
Attach window event listeners
useResizeObserver
Observe element size changes
useMutationObserver
Observe DOM mutations
useIntersection
Intersection Observer API
useInViewport
Check if element is in viewport
useHover
Track hover state
useFocusWithin
Track focus within an element
useFocusTrap
Trap focus within an element
useScrollIntoView
Scroll element into view
useScrollSpy
Track scroll position for navigation
Media & Device
useMediaQuery
Match CSS media queries
useIsMobile
Detect mobile devices
useViewportSize
Track viewport dimensions
useColorScheme
Detect light/dark color scheme
useReducedMotion
Detect prefers-reduced-motion
useOrientation
Track screen orientation
useNetwork
Monitor network status
useOs
Detect operating system
User Input
useHotkeys
Register keyboard shortcuts
useMouse
Track mouse position
useMove
Track mouse movement with constraints
useLongPress
Detect long press events
useTextSelection
Track text selection
usePageLeave
Detect when cursor leaves page
Storage
useLocalStorage
Sync state with localStorage
useSessionStorage
Sync state with sessionStorage
Utilities
useClipboard
Copy to clipboard with status
useIdle
Detect user idle state
useFetch
Fetch data with loading states
useEyeDropper
Color picker from screen
useFullscreen
Control fullscreen mode
useDocumentTitle
Update document title
useFavicon
Update favicon dynamically
useHash
Sync with URL hash
useId
Generate unique IDs (SSR-safe)
useMergedRef
Merge multiple refs
useLogger
Debug component lifecycle
Usage Examples
State Management
Debounce & Throttle
DOM Interactions
Keyboard Shortcuts
Media Queries
Peer Dependencies
TypeScript
All hooks are fully typed:Next Steps
Core Components
Use hooks with Kuzenbo components