Home / Function/ InputOTPForm() — ui Function Reference

InputOTPForm() — ui Function Reference

Architecture documentation for the InputOTPForm() function in input-otp-form.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  23b1aee0_6115_7d50_8f3b_ce0364beaf43["InputOTPForm()"]
  9e8496fa_656a_ceb9_0a25_bb6ef49adcb4["input-otp-form.tsx"]
  23b1aee0_6115_7d50_8f3b_ce0364beaf43 -->|defined in| 9e8496fa_656a_ceb9_0a25_bb6ef49adcb4
  style 23b1aee0_6115_7d50_8f3b_ce0364beaf43 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/registry/new-york/examples/input-otp-form.tsx lines 30–82

export default function InputOTPForm() {
  const form = useForm<z.infer<typeof FormSchema>>({
    resolver: zodResolver(FormSchema),
    defaultValues: {
      pin: "",
    },
  })

  function onSubmit(data: z.infer<typeof FormSchema>) {
    toast({
      title: "You submitted the following values:",
      description: (
        <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
          <code className="text-white">{JSON.stringify(data, null, 2)}</code>
        </pre>
      ),
    })
  }

  return (
    <Form {...form}>
      <form onSubmit={form.handleSubmit(onSubmit)} className="w-2/3 space-y-6">
        <FormField
          control={form.control}
          name="pin"
          render={({ field }) => (
            <FormItem>
              <FormLabel>One-Time Password</FormLabel>
              <FormControl>
                <InputOTP maxLength={6} {...field}>
                  <InputOTPGroup>
                    <InputOTPSlot index={0} />
                    <InputOTPSlot index={1} />
                    <InputOTPSlot index={2} />
                    <InputOTPSlot index={3} />
                    <InputOTPSlot index={4} />
                    <InputOTPSlot index={5} />
                  </InputOTPGroup>
                </InputOTP>
              </FormControl>
              <FormDescription>
                Please enter the one-time password sent to your phone.
              </FormDescription>
              <FormMessage />
            </FormItem>
          )}
        />

        <Button type="submit">Submit</Button>
      </form>
    </Form>
  )
}

Subdomains

Frequently Asked Questions

What does InputOTPForm() do?
InputOTPForm() is a function in the ui codebase, defined in deprecated/www/registry/new-york/examples/input-otp-form.tsx.
Where is InputOTPForm() defined?
InputOTPForm() is defined in deprecated/www/registry/new-york/examples/input-otp-form.tsx at line 30.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free