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.
titleDecrementstring \| (any => string)Specifies title property on decrement Button.
titleIncrementstring \| (any => string)Specifies title property on increment Button.

size

size
"small"
"normal"

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.l
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.
titleDecrementstring \| (any => string)Specifies title property on decrement Button.
titleIncrementstring \| (any => string)Specifies title property on increment Button.
valuenumber \| stringSpecifies the value of the StepperStateless.

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 });