| name | code-confirmation |
| description | Use when implementing verify codes with segmented input. |
| metadata | {"id":"code-confirmation","category":"forms","pattern":"Code Confirmation","source":"uxpatterns.dev","url":"https://uxpatterns.dev/patterns/forms/code-confirmation","sourcePath":"apps/web/content/patterns/forms/code-confirmation.mdx"} |
Code Confirmation
Verify codes with segmented input
What it solves
A Code Confirmation (also called an OTP input or verification code input) is a specialized form component that allows users to enter short numeric or alphanumeric codes — typically 4–8 characters — sent via SMS, email, or authenticator app to verify identity.
The defining characteristic is the segmented layout: each character occupies its own individual input box, providing a clear visual structure that guides users digit-by-digit and reduces transcription errors.
When to use
- Two-factor authentication (2FA) – SMS or TOTP codes used alongside password login.
- Email verification – Confirm account ownership after registration.
- Password reset flows – Short codes sent via SMS or email to authorize resets.
- Transaction confirmation – PIN or code required before sensitive financial actions.
- Access codes – Short invite or gift codes entered to unlock content.
When to avoid
- Long passwords or passphrases – A standard password field is better; segmented inputs are meant for short, structured codes.
- Free-form text entry – Use a text field instead.
- – Use a standard single-line input.