Launch sale — 60% off Pro
Contact
Input OTPBehavior

Not affiliated with official shadcn/ui. Visit ui.shadcn.com for official docs.

React Input OTP - Auto-submit OTP

A React OTP input that automatically submits the form when all 6 digits are entered using shadcn/ui InputOTP with React Hook Form

Looking to implement shadcn/ui patterns?

Join our Discord community for help from other developers.


Users expect OTP codes to submit automatically—no submit button needed. This React pattern watches InputOTP value length with onChange triggering form.handleSubmit when 6 digits entered—instant verification flow. Built with shadcn/ui InputOTP, React Hook Form, Zod validation, and Sonner toast, it's perfect for two-factor authentication, phone verification, email confirmation codes, or any security flow where immediate submission improves UX and matches user expectations from SMS auto-fill behavior.

Form will auto-submit when all digits are entered.

Pattern created by @haydenbleasel

Installation

Questions you might have