# Stepper

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2F8g4mEmqjNQVXGyhKWXKO%2FFrame%2046.png?alt=media&#x26;token=c510c138-01f4-407b-8b57-223147ce3994" alt="" width="330"><figcaption></figcaption></figure>

## Overview

Used in various interfaces, steppers are ideal for adjusting item counts or input values without requiring manual typing, which helps improve user experience in forms and shopping interfaces.

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

## When to use

* Perfect for scenarios where controlled, small changes are necessary, such as setting dates, times, or unit measurements.&#x20;
* Use when users need to increase or decrease the count of items, such as in shopping carts or inventory controls.&#x20;
* Ideal when the input has a fixed range or finite values, preventing users from exceeding or falling below a specific threshold.&#x20;
* Steppers work well on mobile devices where precision tapping is easier than manual text input.

## When not to use

* Avoid using steppers when the value range is too broad, as manually clicking through increments can become inefficient.&#x20;
* Do not use steppers if users need flexibility in entering large or complex numbers quickly.&#x20;
* Steppers are unsuitable for inputs involving text or other non-numeric data.&#x20;
* Avoid using steppers when users need more continuous control, such as sliders for volume or brightness.&#x20;
* Avoid steppers when the input values are uncertain or unpredictable, such as entering data with decimal precision not easily handled by step increments.

## Anatomy

1. **Minus Icon:** Represents the control for reducing the current value.&#x20;
2. **Current Value:** Shows the numeric input being controlled by the stepper buttons.&#x20;
3. **Plus Icon:** Represents the control for increasing the current value.

<figure><img src="https://1456965416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOHrijNlCiWxhWuZ7eBdg%2Fuploads%2F5s9dI2t84qfU6deJaQ6K%2Fanatomy.png?alt=media&#x26;token=f2be9a82-cf02-44ac-ba4f-f2d45378d4cb" 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%2FX4SSzeLoJ80LMRnm5rgY%2Fsize.png?alt=media&#x26;token=e635bc8c-7cb9-45b5-9dc3-a117af38dbdf" alt=""><figcaption></figcaption></figure>

| Size   | Digit (px) | Button (px) | Icon (px) |
| ------ | ---------- | ----------- | --------- |
| Small  | 16         | 24          | 16        |
| Medium | 18         | 34          | 16        |
| Large  | 22         | 40          | 20        |

## Accessibility

* **Keyboard Accessibility:** Ensure that steppers can be controlled using the keyboard with arrow keys or plus/minus buttons for users who rely on non-mouse input.&#x20;
* **Clear Focus States:** Visible focus states should be applied to each interactive element (buttons and input fields) to ensure users with assistive technologies can easily navigate them.&#x20;
* **Screen Reader Compatibility:** Labels and descriptions should be added to ensure screen readers correctly announce the current value and functionality of the stepper controls.&#x20;
* **Disabled States:** Ensure disabled steppers visually communicate when the upper or lower limit is reached, preventing further adjustment.

## Example

* **Shopping Cart Quantity Adjustment:** Commonly used for selecting the number of items to purchase on e-commerce platforms.&#x20;
* **Setting Time or Date:** Steppers can be used to adjust hours, minutes, and dates in booking systems or scheduling interfaces.&#x20;
* **Form Inputs for Unit Quantities:** Ideal for forms requiring precise numeric input, such as setting the number of units for a product or service.&#x20;
* **Temperature or Speed Settings:** Steppers are useful for selecting values like fan speed or temperature settings in appliances.
