572

Functions

A simple catalog of package functions.

List

A quick list of available functions.

  • cn: Combines class names from strings, arrays and objects into a single string
  • createContext: Creates a typed context with additional utilities
  • createEventEmitter: Creates a type-safe event emitter
  • createReactiveContext: Creates a typed context selector with optimized updates for state selection
  • createStore: Creates a store with state management capabilities
  • createWebMCP: Creates a registry for WebMCP tools exposed by the current document
  • deepEqual: Performs a deep comparison between two values to determine if they are equivalent
  • makeDestructurable: Makes an object also iterable for array-style destructuring
  • shallowEqual: Performs a shallow comparison between two values to determine if they are equivalent
  • useActiveElement: Hook for tracking the active element
  • useAsync: Hook that provides the state of an async callback
  • useAsyncEffect: Hook that triggers the effect callback on updates
  • useAudio: Hook that manages audio playback with sprite support
  • useAutoScroll: Hook that automatically scrolls a list element to the bottom
  • useBatchedCallback: Hook that batches calls and forwards them to a callback
  • useBattery: Hook for getting information about battery status
  • useBluetooth: Hook for getting information about bluetooth
  • useBoolean: Hook provides opportunity to manage boolean state
  • useBreakpoints: Hook that manages breakpoints
  • useBroadcastChannel: Hook that provides cross-tab/window communication
  • useBrowserLanguage: Hook that returns the current browser language
  • useBrowserLocation: Hook that returns reactive browser location state with navigation controls
  • useClickOutside: Hook to handle click events outside the specified target element(s)
  • useClipboard: Hook that manages a copy to clipboard
  • useCollapse: Hook that animates an element between collapsed and expanded states
  • useCompareEffect: Hook that executes an effect only when the compare function reports a dependency as changed
  • useConst: Hook that returns the constant value
  • useContextMenu: Hook that handles custom context menus on desktop and long press on touch devices
  • useControllableState: Hook that manages both controlled and uncontrolled state patterns
  • useCookie: Hook that manages cookie value
  • useCookies: Hook that manages cookie values
  • useCopy: Hook that manages copying text with status reset
  • useCounter: Hook that manages a counter
  • useCssVar: Hook that returns the value of a css variable
  • useCycleList: Hook that cycles through a list of items
  • useDebounceCallback: Hook that creates a debounced callback
  • useDebounceEffect: Hook that runs an effect after a delay when dependencies change
  • useDebounceState: Hook that creates a debounced state
  • useDebounceValue: Hook that creates a debounced value
  • useDefault: Hook that returns the default value
  • useDeviceList: Hook that returns the list of available media devices
  • useDeviceMotion: Hook that work with device motion
  • useDeviceOrientation: Hook that provides the current device orientation
  • useDevicePixelRatio: Hook that returns the device's pixel ratio
  • useDidUpdate: Hook that triggers the effect callback on updates
  • useDisclosure: Hook that allows you to open and close a modal
  • useDisplayMedia: Hook that provides screen sharing functionality
  • useDocumentEvent: Hook attaches an event listener to the document object for the specified event
  • useDocumentTitle: Hook that manages the document title and allows updating it
  • useDocumentVisibility: Hook that provides the current visibility state of the document
  • useDoubleClick: Hook that defines the logic when double clicking an element
  • useDraggable: Hook that makes an element draggable
  • useDropZone: Hook that provides drop zone functionality
  • useEvent: Hook that creates an event and returns a stable reference of it
  • useEventListener: Hook that attaches an event listener to the specified target
  • useEventSource: Hook that provides a reactive wrapper for event source
  • useEyeDropper: Hook that gives you access to the eye dropper
  • useFavicon: Hook that manages the favicon
  • useField: Hook to manage a form field
  • useFileDialog: Hook to handle file input
  • useFileSystemAccess: Hook for reading and writing local files via the File System Access API
  • useFocus: Hook that allows you to focus on a specific element
  • useFocusTrap: Hook that traps focus within a given element
  • useForm: Hook to manage a form
  • useFps: Hook that measures frames per second
  • useFul: Hook that can be so useful
  • useFullscreen: Hook to handle fullscreen events
  • useGamepad: Hook for getting information about gamepad
  • useGeolocation: Hook that returns the current geolocation
  • useHash: Hook that manages the hash value
  • useHotkeys: Hook that listens for hotkeys
  • useHover: Hook that defines the logic when hovering an element
  • useIdle: Hook that defines the logic when the user is idle
  • useImage: Hook that load an image in the browser
  • useInfiniteScroll: Hook that defines the logic for infinite scroll
  • useIntersectionObserver: Hook that gives you intersection observer state
  • useInterval: Hook that makes and interval and returns controlling functions
  • useIsFirstRender: Hook that returns true if the component is first render
  • useIsomorphicLayoutEffect: Hook conditionally selects either useLayoutEffect or useEffect based on the environment
  • useKeyboard: Hook that helps to listen for keyboard events
  • useKeyPress: Hook that listens for key press events
  • useKeysPressed: Hook that tracks all currently pressed keyboard keys and their codes
  • useLastChanged: Hook for records the timestamp of the last change
  • useLatest: Hook that returns the stable reference of the value
  • useLess: Hook that can be so useless
  • useList: Hook that provides state and helper methods to manage a list of items
  • useLocalStorage: Hook that manages local storage value
  • useLockCallback: Hook that prevents a callback from being executed multiple times simultaneously
  • useLockScroll: Hook that locks scroll on an element or document body
  • useLogger: Hook for debugging lifecycle
  • useLongPress: Hook that defines the logic when long pressing an element
  • useMap: Hook that manages a map structure
  • useMask: Hook to apply an input mask
  • useMeasure: Hook to measure the size and position of an element
  • useMediaControls: Hook that provides controls for HTML media elements (audio/video)
  • useMediaQuery: Hook that manages a media query
  • useMediaStream: Hook that provides reactive access to a mediaDevices.getUserMedia stream
  • useMemory: Hook that gives you current memory usage
  • useMergedRef: Hook that merges multiple refs into a single ref
  • useMount: Hook that executes a callback when the component mounts
  • useMouse: Hook that manages a mouse position
  • useMutation: Hook that defines the logic when mutate data
  • useMutationObserver: Hook that gives you mutation observer state
  • useNetwork: Hook to track network status
  • useNotification: Hook that provides a reactive wrapper around the browser Notifications API
  • useObject: Hook that provides state and helper methods to manage an object
  • useObjectUrl: Hook that creates and revokes an object URL for a Blob or MediaSource
  • useOffsetPagination: Hook that defines the logic when pagination
  • useOnce: Hook that runs an effect only once. Please do not use it in production code!
  • useOnline: Hook that manages if the user is online
  • useOperatingSystem: Hook that returns the operating system of the current browser
  • useOptimistic: Hook that allows get optimistic value before its update
  • useOrientation: Hook that provides the current screen orientation
  • useOtpCredential: Hook that creates an otp credential
  • usePageLeave: Hook what calls given function when mouse leaves the page
  • usePaint: Hook that allows you to draw in a specific area
  • useParallax: Hook to help create parallax effect
  • usePerformanceObserver: Hook that allows you to observe performance entries
  • usePermission: Hook that gives you the state of permission
  • usePictureInPicture: Hook that provides Picture-in-Picture functionality for video elements
  • usePointerLock: Hook that provides reactive pointer lock
  • usePostMessage: Hook that allows you to receive messages from other origins
  • usePreferredColorScheme: Hook that returns user preferred color scheme
  • usePreferredContrast: Hook that returns the contrast preference
  • usePreferredDark: Hook that returns if the user prefers dark mode
  • usePreferredLanguages: that returns a browser preferred languages from navigator
  • usePreferredReducedMotion: Hook that returns the reduced motion preference
  • usePrevious: Hook that returns the previous value
  • useProgress: Hook that creates a lightweight progress bar
  • useQuery: Hook that defines the logic when query data
  • useQueue: Hook that manages a queue
  • useRaf: Hook that defines the logic for raf callback
  • useRafState: Hook that returns the value and a function to set the value
  • useRefState: Hook that returns the state reference of the value
  • useRenderCount: Hook returns count component render times
  • useRenderInfo: Hook for getting information about component rerender
  • useRerender: Hook that defines the logic to force rerender a component
  • useResizeObserver: Hook that gives you resize observer state
  • useScript: Hook that manages a script with onLoad, onError, and removeOnUnmount functionalities
  • useScroll: Hook that allows you to control scroll a element
  • useScrollIntoView: Hook that provides functionality to scroll an element into view
  • useScrollTo: Hook for scrolling to a specific element
  • useSessionStorage: Hook that manages session storage value
  • useSet: Hook that manages a set structure
  • useShare: Hook that utilizes the share api
  • useSize: Hook that observes and returns the width and height of element
  • useSpeechRecognition: Hook that provides a streamlined interface for incorporating speech-to-text functionality
  • useSpeechSynthesis: Hook that provides speech synthesis functionality
  • useStateHistory: Hook that manages state with history functionality
  • useStep: Hook that create stepper
  • useSticky: Hook that allows you to detect that your sticky component is stuck
  • useStopwatch: Hook that creates a stopwatch functionality
  • useStorage: Hook that manages storage value
  • useSwipe: Hook that tracks swipe gestures for touch and pointer events
  • useTextareaAutosize: Hook that automatically adjusts textarea height based on content
  • useTextDirection: Hook that can get and set the direction of the element
  • useTextSelection: Hook that manages the text selection
  • useThrottleCallback: Hook that creates a throttled callback
  • useThrottleEffect: Hook that runs an effect at most once per delay period when dependencies change
  • useThrottleState: Hook that creates a throttled state
  • useThrottleValue: Hook that creates a throttled value
  • useTime: Hook that gives you current time in different values
  • useTimeout: Hook that executes a callback function after a specified delay
  • useTimer: Hook that creates a timer functionality
  • useToggle: Hook that create toggle
  • useUnmount: Hook that defines the logic when unmounting a component
  • useUrlSearchParam: Hook that provides reactive URLSearchParams for a single key
  • useUrlSearchParams: Hook that provides reactive URLSearchParams
  • useValidatedState: Hook that manages a state value together with its validation result
  • useVibrate: Hook that provides vibrate api
  • useVirtualKeyboard: Hook that manages virtual keyboard state
  • useVisibility: Hook that gives you visibility observer state
  • useWakeLock: Hook that provides a wake lock functionality
  • useWebMCP: Registers a WebMCP tool for the component lifecycle
  • useWebSocket: Hook that connects to a WebSocket server and handles incoming and outgoing messages
  • useWebWorker: Hook that provides a reactive wrapper for a web worker
  • useWebWorkerCallback: Hook that runs a callback in a web worker without a separate worker file
  • useWindowEvent: Hook attaches an event listener to the window object for the specified event
  • useWindowFocus: Hook that provides the current focus state of the window
  • useWindowScroll: Hook that manages the window scroll position
  • useWindowSize: Hook that manages a window size
  • useWizard: Hook that manages a wizard