Stop Rebuilding UI

Shadcn.io is not affiliated with official shadcn/ui

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

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.

Auto-submit OTP preview

Scroll to load preview

Installation

FAQ

Was this page helpful?

Sign in to leave feedback.