Stepper

Sets a whole number a step at a time: − and + either side of it, the number between them. The landing's seats count with it. Built on Okami's secondary icon buttons.

Playground

3
Stepper
Reading

With a question and a total

The landing's pricing: the question names the stepper (aria-labelledby), and the total beside it says the month aloud, so the stepper keeps quiet (announce={false}).

3
How many of you take bookings?

€117 a month for 3 seats

At its ends

The number never passes min or max: at the least, − rests; at the most, + does.

1
20

API reference

PropTypeDefaultDescription
valuenumber—The number shown. Pair with onValueChange.
onValueChange(value: number) => void—Called with the next number, already within min and max.
minnumber0The least it counts to; − rests there.
maxnumberInfinityThe most it counts to; + rests there.
decreaseLabelstring—The − button's name: “One seat fewer”.
increaseLabelstring—The + button's name: “One seat more”.
announcebooleantrueSays the number aloud as it changes. Off when a line beside it says more.
aria-label | aria-labelledbystring—What it counts. One of the two is required.

Usage

  • For a small count people nudge: seats, guests, sessions. A number someone types (a price, a duration) is an Input.
  • Name what it counts, and name each button by what it does to it: “One seat more”, not “Plus”.
  • Give it real ends. A stepper that climbs forever is a field in disguise.