Skip to main content

Stepper

Usage

Overview

The stepper component enables users to incrementally increase or decrease a numeric value. Users can also type numeric values directly into the input field.

When to use

  • For numerical parameters with a clear default that most users are likely to select.
  • To adjust numeric fields by a small discrete amount, with no more than 10 increments or decrements. For example, you could use the stepper to change the number of passengers in a vehicle or the number of copies to be made.

When not to use

  • If frequent, large deviations from the default are expected.
  • To select a single value or a range of values from a fixed set of options. Use the slider instead.
  • For continuous variables, such as age, height, price, or distance. Use the number input to specify the exact value within a wide range.

Source: Nielsen Norman Group

Formatting

Anatomy

image illustrating the anatomy of the stepper component

The stepper consists of the following elements:

  1. Label: Indicates what value the stepper changes, such as number of passengers.
  2. Decrease button: The decrease button reduces the value. The value reduces by 1 when a user clicks the button.
  3. Value: The current value that has been selected or predetermined. Users have the option to manually enter a numeric value by clicking in the text input field.
  4. Increase button: The increase button increases the value. The value increases by 1 when a user clicks the button.

Content

General writing guidelines

  • Use sentence case for all aspects of designing Guidewire product interfaces. Don't use title case.
  • Use present tense verbs and active voice in most situations.
  • Use common contractions to lend your copy a more natural and informal tone.
  • Use plain language. Avoid unnecessary jargon and complex language.
  • Keep words and sentences short.

Include a label

Place a clear, visible label outside the stepper input field. Label text explains the purpose of the stepper and provides context for the user. An input field without a label is ambiguous and not accessible.

Note: The label prop is mandatory for the Stepper component. If you do not want the label to be visible, you can pass hideLabel = true underneath the label prop.
Do position a permanent label outside the field.
Don't assume that the field is self-explanatory without a label.

Add help text if it's meaningful

Use help text to communicate pertinent information, such as the maximum or minimum input value.

Do use help text to provide additional aid to the user.
Don't use help text to simply restate the same information that appears in the label.

Use error text to guide users

Error message text tells a user how to fix the error. In the case of the stepper, errors are often related to data that is invalid or a required field that is left empty.

Use sentence case for error text. Write 1-2 short, complete sentences that end with a period.

Do use error text to guide the user and show them a solution.
Don't write ambiguous error messages or leave users guessing as to how to resolve a problem.

Mark required fields

Use an asterisk (*) to indicate required fields. The asterisk precedes the field label. This helps users to easily locate which fields are required by scanning just the left-most character of the label.

In addition to marking required fields with an asterisk, it is recommended to include clear instructions at the top of the form, such as "All fields marked with an asterisk are mandatory," to ensure users understand the meaning of the asterisk.

Do use an asterisk to indicate that a field is required.
Don't use an asterisk to denote anything that is optional.

Use sentence case

Field labels appear in sentence case.

Refer to the UI text style guide for more information on how to implement sentence case.

Do use sentence case.
Don't use title case. It hinders readability.

Behaviors

States

The stepper field has states for enabled, disabled, focus, error, read-only, and display-only.

Stepper control elements use icon buttons. For information about icon button states, refer to the documentation on button states.

StateDescription
Enabled stateEnabled (default)Communicates to the user that the element is enabled for interaction.
Disabled stateDisabledIndicates to the user that the input value can't be changed because of local factors. For example, a checkbox above the input field must be checked to access this input field. The user can take action to enable it by interacting with the page.
Focus stateFocusProvides feedback indicating the user has highlighted the element, typically using an input method such as a keyboard or voice.
Error stateErrorIndicates that the user has made a validation error. A validation label provides corrective feedback to users.
Read-only stateRead-onlyIndicates to the user that the input value can't be changed because of outside factors. For example, lack of write access. The user can take action to enable it by, for example, contacting an administrator.
Display-only stateDisplay-onlyThe display-only state is used for two cases:
  • A UI element is used in display mode.
  • A UI element is displayed in edit mode, but is never editable.
This state was called read-only before.

Interactions

Mouse

Users can manually enter a numeric value by clicking in the text input field. They can also incrementally increase or decrease the value by clicking the add icon or subtract icon.

image illustrating stepper mouse interactions

Keyboard

Each element in the Jutro stepper component is tab-indexed and, as such, can be accessed using the Tab key. Values can be increased or decreased with the Spacebar and Enter keys. The value within the input field can also be explicitly set with the cursor arrow keys or by entering the value manually.

Screenreader

The plus and minus value buttons include an aria-label attribute of "Increase Value" and "Decrease Value" respectively. These can be changed in Storybook in the messageProps fields. The input field utilizes aria-live="polite" in order to convey its value to people who are blind, and it is associated with the component label text through aria-labelledby.

Default values

Set the most frequently selected value as a stepper default. For example, 1 is usually the default number of adults for booking a hotel room, whereas 0 may be the default number of children in a hotel reservation.

Source: Nielsen Norman Group

Do set a default that's appropriate to the task.
Don't leave the stepper input value blank.

Accessibility

The contrast ratio of textual elements against their background is above 4.5:1 as per WCAG 2.1 AA requirements. Non-textual content that needs to convey meaning (such as icons and keyboard focus visibility) has a contrast ratio of at least 3:1 with its adjacent colors. All content is visible and functional up to and including 400% without requiring scrolling in two dimensions.

This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. However, changes made by the content author can affect accessibility conformance.