Stepper

Stepper

import Stepper from "@kiwicom/orbit-components/lib/Stepper";
<Stepper />

Props

NameTypeDefaultDescription
dataTeststringOptional prop for testing purposes.
idstringSet id for Stepper.
maxWidthboolean108pxSet max-widthfor Stepper wrapper.
activebooleanChanges the color of the Stepper.
defaultValuenumber0Specifies the value of the Stepper. See Functional specs
disabledbooleanfalseIf true, the Stepper will be disabled.
maxValuenumberSpecifies the maximum value for the Stepper.
minValuenumber-∞Specifies the minimum value for the Stepper.
namestringThe name for the Stepper.
onBlurevent => void \| PromiseFunction for handling onBlur event.
onChangenumber => void \| PromiseFunction for handling onClick event.
onFocusevent => void \| PromiseFunction for handling onFocus event.
stepnumber1Specifies the value of step to increment and decrement.
titleDecrementstringSpecifies aria-label property on decrement Button. See accessibility tab.
titleIncrementstringSpecifies aria-label property on increment Button. See accessibility tab.
ariaLabelValuestringOptional prop for aria-label value for input field. See accessibility tab.
ariaLabelledbystringOptional prop for aria-labelledby value for input field. See accessibility tab.
ariaDescribedbystringOptional prop for aria-describedby value for input field. See accessibility tab.
descriptionDecrementstringOptional prop for aria-describedby value for decrement Button. See accessibility tab.
descriptionIncrementstringOptional prop for aria-describedby value for increment Button. See accessibility tab.

Functional specs

  • The prop defaultValue sets the default value when the component mounts. If you need to get the current value of the Stepper, use an arrow function.
<Stepper onChange={value => doSomething(value)} />

StepperStateless

import StepperStateless from "@kiwicom/orbit-components/lib/Stepper/StepperStateless";

Props

NameTypeDefaultDescription
dataTeststringOptional prop for testing purposes.
disabledbooleanfalseIf true, the Stepper will be disabled.
disabledIncrementbooleanIf true, the increment Button will be disabled.
disabledDecrementbooleanIf true, the decrement Button will be disabled.
maxValuenumberSpecifies the maximum value for the Stepper.
minValuenumber-∞Specifies the minimum value for the Stepper.
namestringThe name for the Stepper.
onBlurevent => void \| PromiseFunction for handling onBlur event.
onChangenumber => void \| PromiseFunction for handling onClick event.
onDecrementevent => void \| PromiseFunction for handling decrement event.
onFocusevent => void \| PromiseFunction for handling onFocus event.
onIncrementevent => void \| PromiseFunction for handling increment event.
onKeyDownevent => void \| PromiseFunction for handling onKeyDown event present on input.
stepnumber1Specifies the value of step to increment and decrement.
titleDecrementstringSpecifies aria-label property on decrement Button. See accessibility tab.
titleIncrementstringSpecifies aria-label property on increment Button. See accessibility tab.
valuenumber \| stringSpecifies the value of the StepperStateless. See accessibility tab.
ariaLabelValuestringOptional prop for aria-label value for input field. See accessibility tab.
ariaLabelledbystringOptional prop for aria-labelledby value for input field. See accessibility tab.
ariaDescribedbystringOptional prop for aria-describedby value for input field. See accessibility tab.
descriptionDecrementstringOptional prop for aria-describedby value for decrement Button. See accessibility tab.
descriptionIncrementstringOptional prop for aria-describedby value for increment Button. See accessibility tab.

Usage:

<StepperStateless value="2 adults" />

Helper functions

import validateIncrement from "@kiwicom/orbit-components/lib/utils/validateIncrement";
import validateDecrement from "@kiwicom/orbit-components/lib/utils/validateDecrement";

ValidateIncrement

Arguments

NameTypeDefaultDescription
valuenumberSpecifies the the current value.
maxValuenumberSpecifies the maximum value for the InputStepperStateless.
stepnumber1Specifies the value of step to increment and decrement.

Usage

validateIncrement({ value, maxValue, step });

ValidateDecrement

Arguments

NameTypeDefaultDescription
valuenumberSpecifies the the current value.
minValuenumber-∞Specifies the minimum value for the InputStepperStateless.
stepnumber1Specifies the value of step to increment and decrement.

Usage

validateDecrement({ value, minValue, step });