hoxa
Version:
A comprehensive collection of 100+ production-ready React hooks for state management, UI effects, forms, animations, and more. Carefully curated and optimized for performance and developer experience.
20 lines (19 loc) • 576 B
TypeScript
type ValidationRules = {
required?: boolean;
minLength?: number;
maxLength?: number;
pattern?: RegExp;
validate?: (value: string) => boolean;
};
export declare function useInputValidation(initialValue?: string, rules?: ValidationRules): {
value: string;
setValue: import("react").Dispatch<import("react").SetStateAction<string>>;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
onBlur: () => void;
errors: string[];
isValid: boolean;
dirty: boolean;
validate: () => boolean;
reset: () => void;
};
export {};