Skip to Content
Cristal

Navigation and progress

Stepper

Progress through a multi-step flow.

<cr-stepper><cr-step>CrStepperCrStep

Example

Each step is a CrStep with a label; only the content of the current step is displayed. With navigation, "Previous" and "Next" buttons ("Finish" on the last step) are added: the step title comes in from the side you move towards and leaves the other way when going back. By default (variant="line"), a glowing bead runs along the line and lights up the step reached.

Choose an email address and a password.Add your name and a photo.Choose your plan.Check your details, then confirm.
import { CrStep, CrStepper } from '@cristal-ui/react';

export default function StepperBasic() {
  return (
    <CrStepper label="Sign-up" navigation style={{ width: '100%' }}>
      <CrStep label="Account">Choose an email address and a password.</CrStep>
      <CrStep label="Profile">Add your name and a photo.</CrStep>
      <CrStep label="Plan">Choose your plan.</CrStep>
      <CrStep label="Finish">Check your details, then confirm.</CrStep>
    </CrStepper>
  );
}

Styles

The variant property changes how progress is shown:

ValueEffect
lineBead Line: a glowing bead runs along the line and lights up the next step (default)
numberBig Number: a large number flips like a split-flap display, the step name rolls in
pathSkill Path: a zigzag path; the current step bounces three times
blocksLevel Blocks: stair-step blocks fill up one after another, a bead jumps onto the current step
gaugeGauge Arc: a half-circle gauge whose needle springs to the next mark
timelinesteps are stacked vertically, joined by a line that fills up; a completed step gets a check mark
Email address and password.Name and photo.Plan selection.Review.Email address and password.Name and photo.Plan selection.Review.Email address and password.Name and photo.Plan selection.Review.Email address and password.Name and photo.Plan selection.Review.
import { CrStep, CrStepper } from '@cristal-ui/react';

const styles = [
  ['number', 'Big Number'],
  ['path', 'Skill Path'],
  ['blocks', 'Level Blocks'],
  ['gauge', 'Gauge Arc'],
] as const;

export default function StepperStyles() {
  return (
    <div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(260px, 1fr))', gap: 32, width: '100%' }}>
      {styles.map(([variant, name]) => (
        <CrStepper key={variant} variant={variant} label={name} navigation>
          <CrStep label="Account">Email address and password.</CrStep>
          <CrStep label="Profile">Name and photo.</CrStep>
          <CrStep label="Plan">Plan selection.</CrStep>
          <CrStep label="Finish">Review.</CrStep>
        </CrStepper>
      ))}
    </div>
  );
}

Vertical steps

With variant="timeline", each step displays its title and content inside the progress line. Put your own buttons in the steps and call the next() method: the step is checked, the line fills up, the next step opens and receives focus. After the last step, onCrComplete is emitted.

3 items, $128.40

Continue

12 Lilac Lane, Austin, TX 78701

Continue

Card ending in 4242

Pay

'use client';

import { useRef, useState } from 'react';
import { CrButton, CrStep, CrStepper } from '@cristal-ui/react';

export default function StepperTimeline() {
  const steps = useRef<HTMLCrStepperElement>(null);
  const [complete, setComplete] = useState(false);
  const next = () => steps.current?.next();

  return (
    <div style={{ width: '100%' }}>
      <CrStepper ref={steps} variant="timeline" label="Order" onCrComplete={() => setComplete(true)}>
        <CrStep label="Cart">
          <p>3 items, $128.40</p>
          <CrButton size="s" onClick={next}>Continue</CrButton>
        </CrStep>
        <CrStep label="Address">
          <p>12 Lilac Lane, Austin, TX 78701</p>
          <CrButton size="s" onClick={next}>Continue</CrButton>
        </CrStep>
        <CrStep label="Payment">
          <p>Card ending in 4242</p>
          <CrButton size="s" onClick={next}>Pay</CrButton>
        </CrStep>
      </CrStepper>
      <p role="status">{complete ? 'Order confirmed.' : ''}</p>
    </div>
  );
}

Controlling the steps

  • current gives the current step (0 for the first one); it equals the number of steps once everything is completed.
  • The next(), previous() and goTo(index) methods change the step, from a ref in React.
  • onCrStepChange gives the new index in event.detail on every change.

If the user has asked their system to reduce motion, progress changes without any movement.

Accessibility

  • The progress indicator is a group named by label ("Progress" by default, "Progression" in French).
  • Screen readers read the list of steps with their state ("completed", "current", "upcoming") and the current step has aria-current="step"; the drawings (line, gauge, blocks…) are hidden from them.
  • Each step change is announced: "Step 2 of 4: Profile", then "All steps are completed.".
  • If focus was in a step that gets hidden, it moves to the new step; if the button used disappears, it moves to the other button.
  • The path bounce stops after three times: no endless motion.

API

Properties

PropertyTypeDefaultDescription
currentnumber0Index de l'étape en cours (0 pour la première) ; vaut le nombre d'étapes quand tout est terminé.
labelstring—Nom de la progression, lu par les lecteurs d'écran (« Progress », ou « Progression » en français, par défaut).
navigationbooleanfalseAjoute les boutons « Précédent » et « Suivant » (« Terminer » à la dernière étape).
variant"blocks" | "gauge" | "line" | "number" | "path" | "timeline"'line'Présentation : line (Bead Line), number (Big Number), path (Skill Path), blocks (Level Blocks), gauge (Gauge Arc) ou timeline (verticale).

Events

Reactevent.detailDescription
onCrCompletevoidÉmis quand la dernière étape est validée.
onCrStepChangenumberÉmis à chaque changement d'étape ; detail : l'index de la nouvelle étape.

Slots

SlotDescription
defaultLes étapes cr-step.

CSS parts

To style it from outside: cr-stepper::part(name) { … }

PartDescription
navLes boutons Précédent et Suivant.

CrStep API

Properties

PropertyTypeDefaultDescription
label (obligatoire)string—Nom de l'étape.

Slots

SlotDescription
defaultLe contenu de l'étape.

CSS parts

To style it from outside: cr-step::part(name) { … }

PartDescription
contentLe contenu affiché.

On this page