Skip to content

Quantity input

A native input type="number" that works on its own. A small script adds the minus and plus buttons’ behaviour, respecting min and max, and fires a change event after each step.

  • label, id: required. The buttons are labelled “Decrease” and “Increase” followed by the label in lower case
  • hideLabel: keeps the label for screen readers only
  • value: starting quantity (default 1)
  • min, max: limits (default 1 and 99)
  • size: compact, regular (default)
  • Any other input attribute is passed to the field
<QuantityInput id="quantity" name="quantity" label="Quantity" />
Compact with a hidden label, and a limited range