Paste button for OTP code
Add a visible paste button to let users quickly fill the OTP from clipboard
Bad example
Test code:
Click to copy
Enter verification code
Type the code manually or use Ctrl+V to paste
Good example
Test code:
Click to copy
Enter verification code
Click the paste button or use Ctrl+V
Paste Button for OTP Code
Description
Add a visible "Paste" button next to OTP input fields, allowing users to quickly fill the code from their clipboard with a single click instead of relying on keyboard shortcuts.
Why it matters
- Discoverability: Not all users know Ctrl+V/Cmd+V, especially on mobile or for less tech-savvy users
- Mobile-friendly: On mobile, the paste keyboard shortcut is less intuitive; a button is easier to tap
- Fallback for native features: WebOTP and
autocomplete="one-time-code"don't always work (email codes, different apps, browser limitations) - Reduced friction: One click vs. focus input + keyboard shortcut
The psychology behind it
Users receiving an OTP often have it in their clipboard already (from email, SMS app, password manager). Showing a visible paste action reduces cognitive load — they don't have to remember or discover the paste shortcut.
This follows the principle of "recognition over recall" from Nielsen's heuristics.
Browser permission: is it a UX problem?
The Clipboard API (navigator.clipboard.readText()) triggers a browser permission prompt on first use. This is not a deal-breaker, here's why:
Why the permission is acceptable
- One-time only: Once granted, the permission persists for the site. Users won't see the prompt again.
- Contextually appropriate: The prompt appears right after clicking "Paste" — it's expected, not intrusive.
- Still faster: Even with the permission step, the flow is: click → accept (once) → code filled. That's 2 clicks vs typing 6 characters manually.
- Covers real use cases: WebOTP and
autocomplete="one-time-code"are primarily for mobile/SMS. On desktop with email codes, the paste button remains valuable.
The trade-off
- Desktop: Paste button is highly useful (email codes, password managers)
- Mobile: Prefer
autocomplete="one-time-code"which has no permission friction
Technical requirements
- HTTPS (or localhost)
- User interaction (the button click satisfies this)
- Permission grant (browser will prompt on first use)
This is intentional for security — websites shouldn't silently read clipboard contents.
When to apply
- OTP/verification code inputs
- Any form field where users commonly paste content
- Desktop and mobile applications
- Email-based verification codes (where WebOTP doesn't help)
When not to apply
- Password fields (security concerns with showing paste button)
- Fields where paste is rarely used
- When space is extremely constrained
Implementation tips
- Handle permission gracefully: The clipboard read may fail; don't break the flow
- Filter the pasted content: Extract only digits for OTP, validate format
- Position clearly: Place the button next to the input, not far away
- Use clear iconography: Clipboard/paste icon is universally understood
- Combine with auto-submit: Paste + immediate validation = fastest flow
- Keep Ctrl+V working: The button is an addition, not a replacement
Related patterns
- Verification Code Input - Separate vs single input design
- Auto-submit Verification Code - Automatic validation on completion
Explore more examples
Autofocus on Modal input
When a modal opens with a single input, it should be automatically focused
Disable submit button during loading
Prevent double submissions by disabling the button and showing a spinner
Verification code paste support
Allow users to paste verification codes instead of typing digit by digit