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
clickEventclick-eventAn 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.string`dhl-stepper-${getRandomString()}`
dataTestiddata-testidAn optional prop. The test id attached to the component as a data-testid attribute.string"Stepper"
desktopStyledesktop-styleAn optional prop. When set to true, forces the desktop layout to render on mobile/narrow viewports. The stepper switches to a touch-scrollable carousel with snap, fade edges, and auto-centering on the active step.booleanfalse
hasBackgroundhas-backgroundAn optional prop to toggle component background.booleantrue
headlineheadlineAn optional prop for the headline of the componentstringundefined
itemsitemsA REQUIRED prop for the component steps items.StepItem[]undefined
navigationnavigationAn optional prop. Controls how overflowing steps are navigated on desktop viewports. "scroll" (the default) keeps the original trackpad/mouse-wheel scroll behavior with no arrow controls. "arrows" renders ghost arrow buttons on each side of the carousel. Has no effect on mobile — on mobile with desktopStyle arrows are always shown for multi-step steppers regardless of this prop."arrows" | "scroll"DHL_STEPPER.NAVIGATION.SCROLL

Dependencies

Depends on

Graph


Built by DHL User Interface Library Team!