Internal ID software / Forms
QuantityStepper
A number chosen with minus and plus, around a real number field.
Not drawn in Figma: built only from the tokens, for internal ID software. In code: components/software/quantity-stepper.tsx. From the old system: QuantityStepper in @id-identity-as/ui/buy.
Example
Sælges i kolli a 10. Mindst 10 stk.
Sælges i kolli a 10. Mindst 10 stk.
import { QuantityStepper } from '@/components/software/quantity-stepper';
<QuantityStepper label="Antal" name="quantity" min={10} step={10} defaultValue={20} helper="Sælges i kolli a 10." />Props
| Prop | Type | Default | What it does |
|---|---|---|---|
label (required) | string | What is counted. | |
name (required) | string | The form field name. The value posts like any other field. | |
min | number | 0 | The lowest number. |
max | number | The highest number. | |
step | number | 1 | How much one press changes the number. |
defaultValue | number | The number from the start. Without it, min. | |
helper | string | A line under the field. | |
onChange | (value: number) => void | Called with the new number. | |
labels | Partial<QuantityStepperLabels> | { decrease, increase }, read aloud for the two buttons. Danish by default. |
Do
- Use it for small counts that are nudged up and down.
- Say the rule in the helper: the minimum, the pack size.
Do not
- Do not use it for a number that is typed once, such as a year or a CVR number. That is Input.
- Do not put it in the same row as the solid Button.
Accessibility
- The field is a native number input with a real label, so 48 can be typed.
- The two buttons are named by labels, and without script the field still works.
Tokens it uses
- color.surface.base
- color.text.default
- color.neutral.500
- color.software.muted
- radius.sm
- type.body.md
- type.body.sm
- type.heading.sm
- space.inline.2
- space.section.1
- space.section.2