Skip to content
Nana UI

Navigation

Stepper

A progress trail through a sequence of steps, with an optional linear mode that keeps a wizard from being skipped.

View .md Download

A progress trail through a sequence of steps. The stepper owns which step is current and which are finished; each step renders the state it is handed.

Your details Where to send it How to pay
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/stepper";

next() finishes the step it is on and opens the following one. previous() goes back, and stops at the first. goTo(index) jumps, and returns whether the rules allowed it.

Steps before current count as finished. completed marks any others, which matters when a step is finished out of order.

Add linear and a step only opens once the one before it is finished, so a wizard cannot be skipped through. A finished step can always be reopened. Without linear, any step can be chosen.

Pick one Locked until the first is done Locked too
KeyResult
← / →Moves focus along a horizontal trail
↑ / ↓Moves focus along a vertical trail
Home / EndJumps to the first or last step
Enter / SpaceOpens the focused step, if the rules allow

Focus moves freely along the trail; only opening a step is governed by linear.

Properties

PropertyAttributeTypeDefaultDescription
completedcompletednumber[][]Steps finished out of order, as indices. A step before current counts as done anyway.
currentcurrentnumber0Zero-based index of the step being worked on.
linearlinearbooleanfalseSteps open only in order.
orientationorientationStepperOrientation'horizontal'
showProgressshow-progressbooleanfalseDraw the progress line behind the steps.

Events

EventDescription
nana-step-changeAfter the current step moves; detail: { current: number, previous: number }

Slots

SlotDescription
(default)The nana-stepper-step children

CSS parts

PartDescription
::part(base)The trail container
::part(progress)The progress line behind the steps

CSS custom properties

PropertyDescription
--nana-stepper-gapSpace between steps
--nana-stepper-line-colorColour of the trail line
--nana-stepper-line-sizeThickness of the trail line
--nana-stepper-step-sizeDiameter of a step marker, which the line is centred on

Properties

PropertyAttributeTypeDefaultDescription
indexindexnumber0Position in the trail, set by the parent stepper.
labellabelstring''The step's name.
lastlastbooleanfalseWhether this is the final step, set by the parent.
orientationorientationStepperOrientation'horizontal'
reachablereachablebooleanfalseWhether the stepper would open this step, set by the parent.
statusstatusStepStatus'upcoming'Set by the parent stepper.

Slots

SlotDescription
(default)Description shown under the label

CSS parts

PartDescription
::part(base)The step container
::part(marker)The numbered or ticked circle
::part(label)The step name
::part(description)The slotted description
::part(connector)The line joining this step to the next

CSS custom properties

PropertyDescription
--nana-stepper-step-sizeDiameter of the marker
--nana-stepper-step-colorMarker colour while upcoming
--nana-stepper-step-activeMarker colour while current or complete
EventTypeDescription
nana-step-changeCustomEventThe current step moved; detail carries current and previous.

The trail is a labelled group and each step is a button carrying aria-current="step" when it is the one being worked on. A step the rules keep closed reports aria-disabled, and exactly one step stays in the tab order.

  • Progress Bar — a single unlabelled measure
  • Tab Group — switching between panels rather than advancing