Input OTP Examples
20 one-time code fields for verification and sign-in: 4-, 6- and 8-digit codes, grouped slots, paste and resend flows, and error, loading and success states. Each on React, Vue, Svelte and Solid, with Base UI, React Aria, Ark UI or Radix UI on React.
Every input otp example
20 examples.
- Auto-submit OTPBehaviorA one-time password field with a note that the form submits itself once all six digits are entered.

- Controlled OTP InputStandardA six-digit code field that prints the digits under the boxes as they are typed, starting from an empty prompt.

- Different Length OTP VariantsVariantsThree code fields on one page: four digits in a row, six digits in two groups, and eight digits in two groups.

- Disabled OTP InputStatesA six-digit code field that is disabled, with a note under it that says the OTP input is disabled.

- Email Verification FlowUse CasesAn email check screen with a mail icon, a code sent to user@example.com, Verify Email, and Resend code.

- Masked OTP InputVariantsA six-digit code field that stays blurred until an eye button is pressed, with a note about showing the code.

- Numeric Only OTPVariantsA six-digit code field limited to digits, with a note that phones should show the numeric keyboard.

- OTP in Form with ValidationStandardA one-time password form with a label, a note that the code was sent to your phone, and a Submit button.

- OTP with Enhanced Focus ManagementBehaviorA six-digit code field with a note that says a click anywhere on the input focuses it so you can type.

- OTP with Error StateStatesA six-digit code field with a hint to try 123456, which marks any other complete code invalid.

- OTP with Loading StateStatesA six-digit code field that shows a spinner and Verifying code... once all six digits are in.

- OTP with Multiple SeparatorsStandardA six-digit code field split into three pairs, with a separator between each pair of boxes.

Or describe it. With Pro, your AI agent installs the input otp example you describe, on your framework and UI library.
Get ProGalleries
More component examples
8 related galleries, free: open one for its live examples and their code.
Pricing
Input OTP examples MCP, with Pro
Your AI agent installs any of the 1364 examples, and every component, block and icon, with every Pro plan.
4.9/5 out of 5 · 150+ reviewsfrom 150+ founders and developers.
- Secure checkout via Stripe
- Code lives in your repo
- Keep what you've shipped if you cancel
- License terms
FAQ
Frequently asked questions
The code field on every verification screen: a row of boxes, one character per box, that moves to the next box as you type and fills them all when you paste a code. It's shadcn.io's InputOTP, built on Base UI, React Aria, Ark UI and Radix UI for React, and on Ark UI for Vue, Svelte and Solid.
Yes. Every input OTP example is free to use in personal and commercial projects, with no attribution required. Seeing the code and installing an example takes a free shadcn.io account.
The boxes show how long the code is and how much is left, a grouped code like 123-456 is easier to copy by eye, and phones can fill the code from an SMS. Typing, Backspace, the arrow keys and paste all work as people expect.
For fixed-length codes: verification codes, two-factor tokens, PINs. Use Input for anything whose length varies, such as passwords and names.
Six is the usual length for SMS and email codes and authenticator apps. Four suits short PINs, and eight suits backup codes. The Different Lengths example shows all three.
Wrap each run of slots in InputOTPGroup and put InputOTPSeparator between groups, for example three and three. The separator is visual only, and the slot indexes count straight through the whole code.
Listen for completion on InputOTP and submit from there, as the Auto Submit example does. Show a loading state while you verify, as the Loading State example does, so the page doesn't look stuck.
Sign in with a free account, then copy the code or run the install command on the example's page. It adds the example and the components it uses, InputOTP and, where needed, Field, Button, Alert or Input, to your project.
Yes. InputOTP sets `autocomplete` to `one-time-code`, so iOS and Android offer the code from a recent message above the keyboard.
InputOTP takes a type or a pattern, depending on the library, and rejects other characters as they're typed or pasted. The Numeric Only and Pattern Validation examples show the setting for each library.
The InputOTP component and Tailwind CSS, plus Field, Button, Alert, Input, Spinner and Lucide icons where an example uses them. Values and validation live in the example's own state; there's no form library.
Every slot is reachable with the keyboard, and Backspace and the arrow keys move between them. Labeled examples link their FieldLabel to the field, icon buttons have an `aria-label`, and errors and status messages are announced.
On React, InputOTP is a client component. The static examples, such as the standard and grouped fields, render from a Server Component; the ones with state, such as the forms and flows, are client components.
4.9 out of 5 from 150+ developers
Every input otp example. One prompt away.
Every input otp example is free with an account. With Pro, your AI agent installs them from a prompt.
Get Pro
























