Skip to main content

Stepper

A numeric increment/decrement control with a /+ button pair. Fully controlled via value and onChange.

Basic usage

1
function StepperDemo() {
const [value, setValue] = useState(1);

return <Stepper value={value} onChange={setValue} min={0} max={10} />;
}

Custom step & colors

0
<Stepper
value={value}
onChange={setValue}
min={0}
max={100}
step={5}
buttonBg="primarySubtle"
buttonColor="primary"
/>

Disabled

3
<Stepper value={3} onChange={() => {}} isDisabled />

Props

PropTypeDefaultDescription
valuenumberRequired. Current value.
onChange(value: number) => voidRequired. Called with the next value on increment/decrement.
minnumber0Minimum value; decrement disables below it.
maxnumberInfinityMaximum value; increment disables above it.
stepnumber1Amount added or subtracted per press.
isDisabledbooleanfalseDisables both buttons.
buttonBgTVajraColors'surfaceRaised'Background color of the +/− buttons.
buttonColorTVajraColors'text'Color of the +/− glyphs.
testIDstringTest identifier.