PIN Input

Android · iOS · Web
For inputting secure codes

Overview

The PIN Input component allows users to enter a secure code, typically for authentication or verification purposes. It consists of multiple input fields representing each digit of the PIN, with clear feedback for each entry to maintain usability and security.

Live demo

Example label
Content
Modifiers

Usage

Do

  • Use the PIN Input for fixed-length numeric or alphanumeric codes (e.g., 4 or 6 characters) required for secure workflows, such as authentication or account recovery.

  • Provide clear visual feedback as users enter each character, using styles like masking, numbers, or letters, depending on the context and security requirements.

  • Automatically move focus to the next input field as the user types, ensuring a seamless interaction.

  • Allow users to navigate backwards to correct errors using the backspace key.

Don't

  • Avoid using the PIN Input for variable-length inputs; use a standard text field instead.

  • Do not compromise security by displaying sensitive codes unless required by the context.

  • Avoid designs that restrict accessibility, such as insufficient focus indicators or non-standard keyboard behaviour.


Placement

  • Place the PIN Input prominently in workflows requiring secure code entry, such as login, multi-factor authentication, or account verification screens.
  • Ensure adequate spacing between input fields for clarity and ease of use, especially on touch devices.

Content

Labels

  • PIN Input fields should have labels. A field without a label is ambiguous and not accessible.

  • Follow capitalisation rules. Labels should be in sentence case.

Helper text

Optional helper text can provide additional guidance for users.

  • Use helper text to show hints, formatting and requirements.

  • Write error text that shows a solution.

  • Don’t use helper text to simply restate the same information in the label or if it isn’t relevant to the specific field.

  • Use complete sentences that end with a full stop, not an exclamation point.

Placeholder text

Don’t use placeholder text to provide essential information, labels or instructions. Once a value is entered, placeholder text is no longer viewable, which makes it not accessible.

Sizes

PIN Inputs come in three different sizes: small, medium, and large. Medium is the default and the most frequently used option.

Medium

Label
Example helper text
Error message
This is the default size and the most commonly used size. When in doubt, use the medium size.

Small

Label
Example helper text
Error message
Use when space is constricted or when placing a text input into a form that is long and complex.

Large

Label
Example helper text
Error message
Use when there is a lot of space to work with. The large size is typically used in simple forms or when a text input is placed by itself on a page..

States and interactions

The Text Field should change its appearance based on its state to provide feedback to users.

Enabled

Label
Error message
Initial state displaying the label and input field in default styles.

Hover

Label
Error message
Initial state displaying the label and input field in default styles.

Error

Label
Error message
Appears when the user inputs invalid data.

Error focus

Label
Error message
The error focus state occurs when the user inputs invalid data, and the input field is also in focus. For touch devices the keyboard is shown.

Focus

Label
Error message
The error focus state occurs when the user inputs invalid data, and the input field is also in focus. For touch devices the keyboard is shown.

Success

Label
Error message
The success state occurs when the user inputs valid data, and the input field should change its style to indicate that there is no error.

Success focus

Label
Error message
The success focus state occurs when the user inputs valid data, and the input field is also in focus. For touch devices the keyboard is shown.

Disabled

Label
Error message
Shows that an input field exists but is not available in that circumstance. This can be used to maintain layout continuity and communicate that a field may become available later.

Read-only

Label
Error message
PIN Inputs have a read-only option for when content in the disabled state still needs to be shown. This allows for content to be copied, but not interacted with or changed.

Disabled PIN Inputs

Due to usability and accessibility issues that arise from using disabled and read-only fields, we suggest considering alternative design patterns. This includes using plain text when possible or validating on submit and guiding users directly to errors with sensible error messages.

Accessibility

  • Clearly label PIN Inputs for user understanding.

  • Set appropriate keyboard types based on expected input.

  • Enable secure text entry for sensitive information.

  • Implement input validation for expected formats.

  • Ensure PIN Inputs are easily navigable, fillable, and submittable using only the keyboard.

iOS guidance

Along with the guidance above, there is some iOS specific guidance for this component.

  • Ensure that the Text Field is accessible to users with disabilities. Set appropriate accessibility labels and hints to assist users relying on VoiceOver.