Component docs
Loading
"use client";
import { InputStepper } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
max | number | — | — |
min | number | — | — |
onValueChange | (value: number) => void | — | Called with the new value (only when it changes). |
size | "sm" | "md" | "lg" | md | Control size of the field and both buttons (default md). On coarse pointers (touch screens) the buttons are never smaller than --pixxl-size-touch-target (44 px), whatever the size. |
value | number | — | Current value (controlled); null where it means "nothing selected". |
decrementLabel | string | — | — |
defaultValue | number | — | Initial value when uncontrolled. |
incrementLabel | string | — | — |
step | number | — | — |
maxnumber
minnumber
onValueChange(value: number) => void
Called with the new value (only when it changes).
sizedefault md"sm" | "md" | "lg"
Control size of the field and both buttons (default md). On coarse pointers (touch screens) the buttons are never smaller than --pixxl-size-touch-target (44 px), whatever the size.
valuenumber
Current value (controlled); null where it means "nothing selected".
decrementLabelstring
defaultValuenumber
Initial value when uncontrolled.
incrementLabelstring
stepnumber
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const [players, setPlayers] = useState(2);
const [rounds, setRounds] = useState(3);
const [legs, setLegs] = useState(1);
<InputStepper aria-label="Players" value={players} onValueChange={setPlayers} min={0} max={10} size="sm" />
<InputStepper aria-label="Rounds" value={rounds} onValueChange={setRounds} min={0} max={10} />
<InputStepper aria-label="Legs" value={legs} onValueChange={setLegs} min={0} max={10} size="lg" />