UNPKG

@mirawision/reactive-hooks

Version:

A comprehensive collection of 50+ React hooks for state management, UI interactions, device APIs, async operations, drag & drop, audio/speech, and more. Full TypeScript support with SSR safety.

25 lines (24 loc) 746 B
export interface NumberOptions { min?: number; max?: number; step?: number; } export interface NumberState { value: number; set(value: number): void; inc(step?: number): void; dec(step?: number): void; clamp(): void; } /** * A hook that manages numeric state with optional min/max limits and step size. * All operations (set, inc, dec) automatically clamp the value within limits. * * @param initial Initial numeric value * @param opts Options for limits and step size * @returns Object containing value and control functions * * @example * const { value, inc, dec } = useNumber(0, { min: 0, max: 10, step: 2 }); */ export declare function useNumber(initial?: number, opts?: NumberOptions): NumberState;