Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DX/UX] Lack of Documentation #70

Closed
shehza-d opened this issue Sep 27, 2024 · 2 comments
Closed

[DX/UX] Lack of Documentation #70

shehza-d opened this issue Sep 27, 2024 · 2 comments
Labels
invalid This doesn't seem right
Milestone

Comments

@shehza-d
Copy link

I'm unhappy with documentation design choice, im still confused how would i use this with a simple form and how will i use it and how will use it with react-hook-form and get the value of textbox

my code

import useVerifyOtp from "@/hooks/auth/useVerifyOtp";
import {
  InputOTP,
  InputOTPGroup,
  InputOTPSlot,//shadcn
} from "@/components/other/OtpInput";

export default function OptForm() {
  const { onSubmit, register, errors, isLoading } = useVerifyOtp();

  return (
    <form noValidate onSubmit={onSubmit}>
      <h3 className="text-2xl text-secondary">Verification</h3>

      <p className="text-dark">
        Enter 4 digit OTP we sent you via email to continue
      </p>
      
      <InputOTP name="otp" maxLength={4}>
        <InputOTPGroup   name="pin" className="justify-center w-full">
          <InputOTPSlot className="min-w-14 md:min-w-20 w-full" index={0} />
          <InputOTPSlot className="min-w-14 md:min-w-20 w-full" index={1} />
          <InputOTPSlot className="min-w-14 md:min-w-20 w-full" index={2} />
          <InputOTPSlot className="min-w-14 md:min-w-20 w-full" index={3} />
        </InputOTPGroup>
      </InputOTP>
      
      <Button isLoading={isLoading} type="submit" className="w-full">
        Verify
      </Button>
  </form>
  );
}
@shehza-d shehza-d added the invalid This doesn't seem right label Sep 27, 2024
@guilhermerodz
Copy link
Owner

I do agree the documentation now deserves a rework. The library has grown a lot in the past 4 months.

@guilhermerodz guilhermerodz added this to the 1.3 milestone Oct 17, 2024
@guilhermerodz
Copy link
Owner

guilhermerodz commented Nov 1, 2024

Hi @shehza-d I've just added an example for react-hook-form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants