Skip to main content

Stepper

Quick start

Here's a quick start guide to get started with the Stepper component.

Importing Component

import { Stepper, StepperStep } from "@hover-design/react";

Code Snippets and Examples

Simple Stepper
import { Stepper, StepperStep } from "@hover-design/react";

const Demo = () => {
const [active, setActive] = useState(1);
const nextStep = () =>
setActive((current) => (current < 3 ? current + 1 : current));
const prevStep = () =>
setActive((current) => (current > 0 ? current - 1 : current));

return (
<div>
<Stepper onStepClick={setActive} activeStep={active}>
<StepperStep>
<label>Step 1</label>
</StepperStep>
<StepperStep>
<label>Step 2</label>
</StepperStep>
<StepperStep>
<label>Step 3</label>
</StepperStep>
</Stepper>
</div>
);
};

Stepper Props Reference

KeytypeOptional?
activeStepnumberNo
childrenReact.ReactNodeNo
onStepClick(stepIndex: number) => voidYes
orientationverticle horizontalYes
labelOrientationverticle horizontalYes
sizexs sm md lg xl stringYes
borderRadiusxs sm md lg xl stringYes
baseStylesbaseStyles objectYes
completedStylescompletedStyles objectYes
progressStylesprogressStyles objectYes
iconReact.ReactNodeYes
progressIconReact.ReactNodeYes
completedIconReact.ReactNodeYes
dividerPropsdividerStyles objectYes
refRefObject<HTMLButtonElement>;Yes

StepperStep Props Reference

KeytypeOptional?
childrenReact.ReactNodeYes
orientationverticle horizontalYes
labelOrientationverticle horizontalYes
sizexs sm md lg xl stringYes
borderRadiusxs sm md lg xl stringYes
baseStylesbaseStyles objectYes
completedStylescompletedStyles objectYes
progressStylesprogressStyles objectYes
iconReact.ReactNodeYes
progressIconReact.ReactNodeYes
completedIconReact.ReactNodeYes
dividerPropsdividerStyles objectYes
refRefObject<HTMLButtonElement>;Yes
Customizing Stepper Base, Progress, Completed and Divider Styles.

You can customize the base, progress, completed and divider styles of the Stepper by passing in the baseStyles, progressStyles, completedStyles and dividerProps props. Refer below Spec for this:

baseStyles

PropertyDescriptionDefault
backgroundColorBackground#ebf0f5
colorColor#495057
borderBordernone

progressStyles

PropertyDescriptionDefault
backgroundColorBackground#ebf0f5
colorColor#495057
borderBorder2px solid #2eb85c

completedStyles

PropertyDescriptionDefault
backgroundColorBackground#2eb85c
colorColor#fff
borderBordernone

dividerProps

PropertyDescriptionDefault ValueOptional ?
typesolid | dashed | dottedsolidYes
sizestring2pxYes
colorstring#2eb85cYes