Skip to main content

NumberStepper

A two-segment UI control used to incrementally increase or decrease a numeric value.

Submit feedback
github
import { NumberStepper } from '@uhg-abyss/mobile';
() => {
const [value, setValue] = useState(0)
return(
<NumberStepper
title="Title Here"
description="2 lines max description here"
value={value}
onChange={setValue}
/>
);
};

useState

The useState hook gets the value from the component state. It is required to pass in the starting number to the value prop.

Title

Use the title prop to set the title for the input. It is required to pass in a string to the title prop.

Description

Use the description prop to set the description for the input.

Min and Max Values

Use the minimumValue and maximumValue to constrain the stepper to a specific range. By default this range is 0-99.

Disabled

Use the isDisabled prop to disable the stepper. By default, the add or remove buttons disable when the min or max is reached.

Error Message

Use the errorMessage prop to display a message below the description.

NumberStepper Props

Prop NameTypeDefaultDescription
decreaseRefshape-The ref to be passed to the decrease button
descriptionstring-The description of the number stepper
errorMessagestring-Error message to be displayed below the stepper
increaseRefshape-The ref to be passed to the increase button
isDisabledbooleanfalseFlag to enable/disable the stepper. If true, both buttons will be disabled
maximumValuenumbers-Specifies the number the stepper can be increased to
minimumValuenumber-Specifies the number the stepper can be decreased to
onChangefunction-Callback fired when the add or remove button is pressed
titlenode-The title of the number stepper
valuenumber-The current value of the number stepper

NumberStepper Classes

Class NameDescription
abyss-number-stepper-buttonButton element
abyss-number-stepper-containerContainer around title, description and buttons
abyss-number-stepper-countCount element
abyss-number-stepper-descriptionDescription element
abyss-number-stepper-iconIcon element
abyss-number-stepper-messageError message
abyss-number-stepper-rootRoot element
abyss-number-stepper-titleTitle element

Dynamic Type

AX5 reorders items to a vertical stack.

NumberStepper Tokens

Token NameValue
number-stepper.color.text.heading
#323334
number-stepper.color.text.paragraph
#4B4D4F
number-stepper.color.text.label
#323334
number-stepper.color.border.button
#002677
number-stepper.color.surface.button.disabled
#CBCCCD
number-stepper.color.surface.button.default
#FFFFFF
number-stepper.color.icon.button.default
#002677
number-stepper.color.icon.button.disabled
#4B4D4F
number-stepper.border-radius.all.button
500
number-stepper.border-width.all.button
1
number-stepper.sizing.all.icon
24
number-stepper.spacing.gap.horizontal.container
16
number-stepper.spacing.gap.horizontal.controls
8
number-stepper.spacing.padding.all.button
8
Table of Contents