import { ZodSchema } from './types'; import { default as IFormProps } from './IFormProps'; /** * Form component that integrates react-hook-form with Zod validation * @param props {@link IFormProps} - Props for the Form component * @template TSchema - The Zod schema type * @returns The rendered Form component * * @example * ```tsx * // Default * function App() { * const loginFormSchema = z.object({ * email: z.string().email({ message: 'Please enter a valid email address' }), * password: z.string().min(6, { message: 'Password must be at least 6 characters' }), * }); * * const form = useForm({ * resolver: zodResolver(loginFormSchema), * defaultValues: { * email: '', * password: '', * }, * }); * * const onSubmit = (data: z.infer) => { * console.log(data); * alert('Login form submitted successfully!'); * }; * * return ( *
* * * Email * * * * * * Password * * * * *