Skip to main content

Stepper

The Stepper component can be used to improve the user experience of a multi-step process or form by visually indicating the progress and providing a clear sense of direction to the user.

Import

// with @dhl-official/react-library:
import { DhlStepper } from "@dhl-official/react-library"
// with @dhl-official/ui-libraries/react-library:
import { DhlStepper } from "@dhl-official/ui-libraries/react-library"

Code

<DhlStepper items={items}></DhlStepper>

Items prop should be passed in the following format:

const items = [
{
label: 'Step Label',
description: 'Step Description',
icon: icons.Containership,
},
{
label: 'Step Label',
description: 'Step Description',
},
{
label: 'Step Label',
description: 'Step Description',
icon: icons.PlaneAirFreight,
},
{
label: 'Step Label',
description: 'Step Description',
},
];

Interactive Demo

Readme

Properties

PropertyAttributeDescriptionTypeDefault
activeIndexactive-indexA REQUIRED prop to set active step index.number0
clickEvent--An optional step click event callback handler.(index: number) => voidundefined
dataAriaLabeldata-aria-labelAn optional prop defining the text read by the screen reader to represent the component; use this if you need different text to be read from label.string"Stepper"
dataClassNamedata-class-nameAn optional prop for the class of the root element.stringundefined
dataIddata-idAn optional prop. Gives a valid HTML ID attribute value for the component.stringdhl-stepper-${getRandomString()}
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.string"Stepper"
hasBackgroundhas-backgroundAn optional prop to toggle component background.booleantrue
headlineheadlineAn optional prop for the headline of the componentstringundefined
items--A REQUIRED prop for the component steps items.StepItem[]undefined

Dependencies

Depends on

Graph


Built by DHL User Interface Library Team!