InputStepper
An input stepper is a two-segment UI control used to incrementally increase or decrease a numeric value.
Simple InputStepper
Sizes
To have the larger or smaller switches, use the size
property.
Controlled InputStepper
You can use the value
, and onChange
properties to control the behaviour of the stepper.
The value is
"0"
API
Learn more about the properties and the customization points.
Usage
import InputStepper from "@sonnat/ui/InputStepper";//orimport { InputStepper } from "@sonnat/ui";
Properties
Note that the documentation avoids mentioning all the native props (there are a lot) in this section of the components.
Name | Type | Default | Description |
---|---|---|---|
className | string | - | Append to the class names applied to the component so you can override or extend the styles. |
name | string | - | The name of the stepper. |
value | number | - | The value of the stepper. The DOM API casts this to a string. |
defaultValue | number | - | The default value. Use when the component is not controlled. |
size | "large" | "medium" | "small" | "medium" | The size of the stepper. |
disabled | boolean | false | If true , the field will be disabled. |
fluid | boolean | false | If true , the field will be fluid (max-width: 100%) |
min | number | 0 | The minimum value the stepper can hold. |
max | number | Infinity | The maximum value the stepper can hold. |
inputProps | object | - | The properties applied to the input element. |
onChange | function | - | The callback fires when the state has changed. Signature: function(value: number) => void |
onAdd | function | - | The callback fires when the add button has been clicked. Signature: function(value: number) => void |
onSubtract | function | - | The callback fires when the subtract button has been clicked. Signature: function(value: number) => void |
|