npui
DocsHooksUtilitiesExamplesLearnContributePlaygroundDeveloperProduction ReadyAboutContactGitHub

Custom Hooks

Explore a collection of useful React hooks designed to simplify common patterns and enhance your application's functionality. Click on a hook to view its detailed documentation and live examples.

Available Hooks

useDebounce
Debounces a value, delaying its update until a specified time has passed without further changes.
useLocalStorage
Persists and retrieves state from the browser's local storage.
useOutsideClick
Detects clicks outside of a specified DOM element, useful for closing modals or dropdowns.
useMediaQuery
Reactively tracks the state of a CSS media query.
usePrevious
Stores and returns the previous value of a given state or prop.
useCopyToClipboard
Provides a function to copy text to the clipboard and tracks the copied state.
useEventListener
A declarative way to attach event listeners to the window or a specific DOM element.
useIsomorphicLayoutEffect
A `useLayoutEffect` equivalent that works safely in both client-side and server-side rendering environments.
useWindowSize
Provides the current width and height of the browser window, updating on resize.
useScrollPosition
Tracks the current scroll position (X and Y coordinates) of the window.
npui

© 2025 npui. All rights reserved.

PrivacyTerms