Stepper / Dev
Install
Import
Props
Stepper
Prop | Type & Description |
---|---|
name | string The name of the input. Mainly used to make the internal id of the component unique |
valueRange | [number, number] | number[] The valid value range given as an chronological array of numbers Floating range (integer between min and max): Fixed values: |
onIncrement | (value: number, direction: number) => number Default value: "(val: number, increment: number) =>
((val + increment > 1000) ? 1000 : (val + increment > 100) ? 100 : (val + increment > 10) ? 10 : 1)" Create a custom increments function. Here you can decide the amount it will increase or decrease for each button click. Default it looks like this: ((val, increment) => ((val + increment > 1000) ? 1000 : (val + increment > 100) ? 100 : (val + increment > 10) ? 10 : 1)) |
align | "left" | "center" | "right" Default value: "'center'" How the stepper should align itself in the container |
ariaLabelButtonIncrease | string Since the button uses symbols to convey visual meaning, you need to provide the decrease/increase-button with appropriate label. Try to provide a semantic message, that includes the unit (e.g. weeks, coupons, ...) |
ariaLabelButtonDecrease | string See |
ariaValueText | (value: number) => string Provide a more semantic read-out when the value change for screen readers For example: "1 uke" "2 uker" "4 kuponger" |
label | string | ((info: InfoProps) => string) Label for the (actual) number input. |
errorMessage | (info: InfoProps) => string If the user provides a invalid, too big/small or empty value, an inline error
message will be shown under input. Provide a contextual message with the correct
range (use the |
value | number Used together with |
disabled | boolean Disables the stepper both visually and interactively |
onChange | (nextValue: number) => void Called for every value change. Typically for updating the value externally. Important! The Stepper will return NaN on ALL invalid input (empty values, too big/small values and letters).
If the value becomes invalid, the component will display an error message that you provide via the Use
|
suffix | string Custom suffix for the input |