OTP Paste Input

OTP Paste Input is a copy-paste React component that stops otp verification fails on paste before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/otp-paste-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsOTP verification fails on paste

Was this component page useful?

How do I install OTP Paste Input?

pnpm dlx shadcn@latest add @bollard/otp-paste-input

The files land in your project. They're yours to edit.

How do I use OTP Paste Input in React?

otp-paste-input-usage.tsx
import { OtpPasteInput } from "@/components/ui/otp-paste-input"

<OtpPasteInput ref={inputRef} onComplete={setVerified} onValueChange={() => setVerified(undefined)} />

What input mistakes does OTP Paste Input catch?

  • Whole SMS or email pasted instead of just the code
  • Phone numbers, amounts, account endings and order numbers mistaken for the code
  • Full-width, Devanagari or Arabic-Indic digits from other keyboards
  • Runs of the wrong length

What props does OTP Paste Input accept?

OtpPasteInput props
PropTypeDefault
length

Number of digits in the code.

number6
label

Visible label.

string"Verification code"
hint

Helper text shown until something is pasted.

string"Paste the whole message if you like. We'll find the code."
value

Controlled value (digits only).

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with the digits entered so far.

(value: string) => void—
onComplete

Called once all `length` digits are in.

(code: string) => void—
foundMessage

Shown after a code was picked out of a longer message.

(code: string) => string(code) => `Found ${code} in the pasted message.`
notFoundMessage

Shown when a paste held no code of the right length.

(length: number) => string(n) => `Couldn't find a ${n}-digit code in what you pasted.`

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

How is OTP Paste Input accessible?

  • Visible label; input is described by a polite notice region
  • Digit boxes are a visual layer marked aria-hidden over one real input
  • Notice icons are aria-hidden

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Verify the code server-side with expiry, attempt limits and rate limiting.

  • Picks the likeliest code; unusual message formats can still confuse it
  • Fixed code length (length prop)
  • Doesn't verify the code; your server does

What expensive mistakes does OTP Paste Input stop?

OTP verification fails on paste

Also known as

otp · one-time code · verification code · sms code · 2fa · pin input · login · mobile verification

Field type

What dependencies does OTP Paste Input require?

OTP Paste Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameOTP Paste Input
Registry identifier@bollard/otp-paste-input
Install commandnpx shadcn@latest add @bollard/otp-paste-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about OTP Paste Input

How does OTP Paste Input validate Indian financial identifiers?

OTP Paste Input stops oTP verification fails on paste. Complies with national standards for Whole SMS or email pasted instead of just the code, Phone numbers, amounts, account endings and order numbers mistaken for the code, Full-width, Devanagari or Arabic-Indic digits from other keyboards, Runs of the wrong length. Limitation: verify otp-paste-input with issuer gateway.

How do I install otp-paste-input with shadcn?

Run `npx shadcn@latest add @bollard/otp-paste-input`. Sources added: registry/default/otp-paste-input/otp-paste-input.tsx. Package requirements: lucide-react.

What props customize OTP Paste Input?

OTP Paste Input accepts `length`, `label`, `hint`, `value`, `defaultValue`. Configures otp, one-time code, verification code behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of otp-paste-input?

Picks the likeliest code; unusual message formats can still confuse it. Fixed code length (length prop). Doesn't verify the code; your server does Server requirement: Verify the code server-side with expiry, attempt limits and rate limiting.

How does OTP Paste Input meet accessibility guidelines?

Visible label; input is described by a polite notice region. Digit boxes are a visual layer marked aria-hidden over one real input. Notice icons are aria-hidden. Minimizes errors: paste sms otp, otp input paste whole message.

Which components pair with OTP Paste Input?