# Digit Entry

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FcO5RSelCmekfx05Cl5h0%2FFrame%2046.png?alt=media&#x26;token=0f8522f0-1199-41e6-9d88-7e5f59826799" alt="" width="330"><figcaption></figcaption></figure>

## Overview

Ideal for use cases requiring a set number of digits, the digit entry component simplifies data input by providing a clear and structured approach.

{% embed url="<https://www.figma.com/design/4NwKhd4dwRhRF5Zpiooi69/Components?node-id=57-205223&t=0Thv0LIO2gFzE3eo-4>" %}

## When to use

* Use when users need to enter short, sequential numbers, such as a 4-6 digit PIN or verification code during authentication processes.&#x20;
* Use in scenarios where accuracy in number input is essential, such as during account recovery, login, or making secure transactions.&#x20;
* Helpful when asking users to input a short number or code, especially on mobile devices, where larger forms are inconvenient.

## When not to use

* Avoid using for entering long strings of numbers like phone numbers or account numbers, where a standard input field may be more practical.&#x20;
* Do not use for any input requiring letters or special characters, as this component is designed strictly for digits.&#x20;
* This component is not suitable for editing large numbers or when users may need to go back and forth between digits without a guided structure.&#x20;
* Avoid if users need flexibility to input numbers freely, like in a calculator or a payment amount field.

## Types

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2F5zOlhVHXGH8ZnXa2IaOK%2FVariants.png?alt=media&#x26;token=6b7a4bb8-3389-46b2-969a-b6079966749e" alt=""><figcaption></figcaption></figure>

## Anatomy

1. **Container:** A box that holds the entire digit entry fields, ensuring consistent spacing and layout. It provides a boundary that organizes the individual fields visually.&#x20;
2. **Digit Entry:** Individual fields for each digit input. Each field accepts a single digit and typically auto-focuses to the next field after input.

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2Fzjgmo2dTVu4eFg00Qecf%2FAnatomy.png?alt=media&#x26;token=eb853b16-66f0-4fbf-9a5e-2b55f9d93686" alt=""><figcaption></figcaption></figure>

## Styles

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FgRYSH0YKZE6DwjmrvfXz%2FStyle.png?alt=media&#x26;token=942c296b-ca25-4d8b-8b11-550cb0f427f1" alt=""><figcaption></figcaption></figure>

## States

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FTxfdFcksAZhlP0Q0Dlqn%2FState.png?alt=media&#x26;token=d0496456-9ac1-43d4-845c-dc4e59130393" alt=""><figcaption></figcaption></figure>

## Size

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2FC1C0QYQ9zgVtmAJMgPYX%2FSize.png?alt=media&#x26;token=759aa9cf-d820-41e0-afe0-88950b505801" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="152">Size</th><th width="148">Digit (px)</th><th width="177">Corner (px)</th><th>Container Height (px)</th></tr></thead><tbody><tr><td>Small</td><td>14</td><td>8</td><td>32</td></tr><tr><td>Medium</td><td>18</td><td>8</td><td>42</td></tr><tr><td>Large</td><td>22</td><td>8</td><td>50</td></tr></tbody></table>

## Accessibility

* **Keyboard Navigation:** Users must be able to navigate between digit fields using the keyboard. Use clear focus states to indicate which digit field is active.&#x20;
* **Screen Reader Support:** Each digit entry field should be announced clearly, specifying the number of digits needed for full completion.&#x20;
* **Error Messaging:** If users enter an incorrect digit or code, ensure accessible error messages with appropriate visual indicators like red borders and error descriptions.&#x20;
* **Auto-focus and Auto-tab:** To enhance accessibility, each field should automatically advance to the next one after a digit is entered, reducing the need for additional keypresses.

## Example

* **Mobile Number PIN Input:** When users log in using a one-time PIN sent to their phone.&#x20;
* **ATM or Payment Systems:** For users to securely input their 4-6 digit PIN for transactions.&#x20;
* **Account Recovery:** When a user is resetting a password, they may need to input a verification code sent via email or SMS.&#x20;
* **Lock Screens on Devices:** To unlock mobile devices or apps, users can enter their chosen PIN using a digit entry component.
