Stepper

Shows where people are in a task that has a few steps in order.

import { Stepper } from '@halo-ds/react';

When to use it

Use a stepper for flows like sign-up, checkout or setup, where people go through steps one after another. Step is one step, Complete, Current, Upcoming or Error; Stepper lays steps out Horizontal or Vertical in a slot, or shows a Compact "Step 2 of 4" for small screens.

Do

  • Keep it to about 3 to 5 steps.
  • Use short titles of one or two words.
  • Let people go back to complete steps to make changes.
  • Mark a step Error when it has something to fix.

Don't

  • Use a stepper for a single form; use headings.
  • Let people skip ahead to steps that need earlier answers.
  • Change the steps in the middle of the flow.
  • Rely on colour alone; keep the check, number or "!".

Stepper or Tabs?

Both split content into parts. Pick by whether the order matters.

  • Stepper: Steps must be done in order, like checkout. Shows progress and what is left. People move on with Next and Back buttons.
  • Tabs: Views people can open in any order. Nothing to finish; no progress to show. People switch by clicking the tab itself.

Props

Stepper props

PropTypeWhat it does
steps (required)StepperStep[]
current (required)numberIndex of the current step, starting at 0. Earlier steps show as complete.
orientation`"vertical" \"horizontal" \"compact" \undefined`horizontal, vertical, or compact (a title and a segmented bar for small screens). Figma: Orientation.
compactBelow`number \false \undefined`A horizontal stepper switches to compact when it has less room than this, in pixels, like on a phone. The default, 600, matches the Mobile layout breakpoint. Pass false to always stay horizontal.
showNext`boolean \undefined`Compact only: shows "Next: …" with the next step's title. Figma: Next step.
aria-label`string \undefined`Screen reader name for the steps.
classNames`Partial<Record<StepperPart, string>> \undefined`Extra class names for the parts inside the component, by part name, like { header: 'my-header' }.
styles`Partial<Record<StepperPart, CSSProperties>> \undefined`Inline styles for the parts inside the component, by part name, like { footer: { gap: 4 } }.

It also takes the usual HTML attributes for its element.

Examples

Overview

import { Stepper } from '@halo-ds/react';

const steps = [
  { title: 'Account', description: 'Name and email' },
  { title: 'Profile', description: 'Photo and bio' },
  { title: 'Billing', description: 'Plan and card' },
  { title: 'Review', description: 'Check and confirm' },
];

export default function Example() {
  return (
    <div style={{ width: '100%', maxWidth: 640 }}>
      <Stepper steps={steps} current={1} />
    </div>
  );
}

Vertical

Down the side of a long form.

import { Stepper } from '@halo-ds/react';

const steps = [
  { title: 'Account', description: 'Name and email' },
  { title: 'Profile', description: 'Photo and bio' },
  { title: 'Billing', description: 'Plan and card' },
];

export default function Demo() {
  return (
    <div style={{ width: 280 }}>
      <Stepper steps={steps} current={1} orientation="vertical" />
    </div>
  );
}

With an error

A step that needs fixing turns red with a message.

import { Stepper } from '@halo-ds/react';

const steps = [
  { title: 'Account', description: 'Name and email' },
  { title: 'Profile', description: 'Add a photo', error: true },
  { title: 'Billing', description: 'Plan and card' },
  { title: 'Review', description: 'Check and confirm' },
];

export default function Demo() {
  return (
    <div style={{ width: '100%', maxWidth: 640 }}>
      <Stepper steps={steps} current={2} />
    </div>
  );
}

Compact

A title and a segmented bar. Horizontal steppers switch to this by themselves under 600px.

import { Stepper } from '@halo-ds/react';

const steps = [
  { title: 'Account', description: 'Name and email' },
  { title: 'Profile', description: 'Photo and bio' },
  { title: 'Billing', description: 'Plan and card' },
  { title: 'Review', description: 'Check and confirm' },
];

export default function Demo() {
  return (
    <div style={{ width: 340 }}>
      <Stepper steps={steps} current={1} orientation="compact" />
    </div>
  );
}

More: https://halodesignsystem.dev/components/stepper