import {InputOtp} from "@nextui-org/react"; import {useForm, Controller, SubmitHandler} from "react-hook-form"; import {Button} from "@nextui-org/react"; interface FormValues { otp: string; } export default function App() { const { handleSubmit, control, formState: {errors}, } = useForm({ defaultValues: { otp: "", }, }); const onSubmit: SubmitHandler = (data) => { alert(JSON.stringify(data)); }; return (
( )} rules={{ required: "OTP is required", minLength: { value: 4, message: "Please enter a valid OTP", }, }} /> ); }