StartFoundationsComponentsContent

Number stepper

A number stepper sets a small whole number with − and + buttons, such as a quantity, guests, or tickets.

Stable Figma
OverviewUsageAPIAccessibility
<tk-number-stepper label="Adults" unit="adults" value="2" min="1" max="8"></tk-number-stepper>

Anatomy

Part What it is
tk-number-stepper the element; one Tab stop
field part the bordered row
decrement part the − button; press and hold to repeat
value part the number in the middle; it is the spinbutton and takes focus
increment part the + button; press and hold to repeat

The stepper is only as wide as its content. It shows no label of its own.

Label

Guests
<div style="display: flex; align-items: center; justify-content: space-between; max-width: 280px">
  <span>Guests</span>
  <tk-number-stepper label="Guests" unit="guests" value="3" min="1" max="10"></tk-number-stepper>
</div>
  • Put a visible label beside the stepper and set label to the same words. label is the name screen readers hear; the stepper doesn't draw it.
  • unit adds a word to what screen readers hear, "3 guests"; the visible value stays "3".
  • Don't wrap a stepper in a Field. It names itself.

Value

  • value is a whole number (default 0) and submits under name.
  • min defaults to 0. Set min="1" for "at least one". max has no default; set it when there's a real cap, or + never turns off.
  • step defaults to 1 and must be a whole number. The value always stays on the step grid and inside the range.
  • Every press is a change: it fires input and change. Holding a button fires one pair per repeat.

Sizes

<tk-number-stepper label="Medium stepper" value="2"></tk-number-stepper>
<tk-number-stepper label="Large stepper" size="large" value="2"></tk-number-stepper>
size Height and button width Value text Icon
medium (default) 32px Body Small (14/20) icon-size-16
large 36px Body Medium (16/24) icon-size-16

Both sizes meet the 24px minimum target size. There is no small; size="small" renders as medium and logs a console warning.

States

<tk-number-stepper label="Tickets at minimum" value="1" min="1" max="4"></tk-number-stepper>
<tk-number-stepper label="Tickets" value="2" disabled></tk-number-stepper>

The row doesn't change on hover; on focus its border takes the focus color and grows thicker inward. The − and + tint under the pointer.

  • At min or max, the matching button is disabled.
  • disabled: the whole stepper can't be focused or changed, and it's left out of the form.

The stepper never shows an error: the value can't leave the range.

Remove at minimum, or Add first

Two cart patterns are yours to build around the stepper:

  • Remove at minimum: set min="1" and put a trash Icon button beside the stepper.
  • Add first: show an "Add" Button until the item is added, then show the stepper.