VisorVisor
ComponentsData Display

Segmented Progress

Discrete per-step progress meter — N equal pill segments in a row, each individually expressing done, current, or pending state, with optional step labels and a failed state.

Default

Pass total and value to render a row of pill segments. Completed steps (indices 0..value-1) are filled with the primary color; remaining steps render as muted surface.

With current segment

Pass current (a 0-based index, typically equal to value) to render an in-progress gradient on the next segment — a primary-to-muted split at the ~55%/45% mark.

Sizes

Two segment heights for different surface densities. sm (6px) is the default and matches the brand-workbench prototype. md (8px) is slightly taller for increased visual weight.

Completion states

Each segment independently resolves to done, current, or pending:

Step labels

Pass steps to put a label under each segment. A done step's label carries a check, the current step's reads bold in the primary ink, and a step not reached reads in the tertiary ink. On mount each filled segment draws in from the left, once, about 140ms after the one before it; under prefers-reduced-motion the fills are drawn static.

Step 2 of 3: Bank Details
Step 2 of 3: Bank Details

A step without a state follows value and current, so <SegmentedProgress value={1} current={1} steps={[{ label: 'A' }, { label: 'B' }, { label: 'C' }]} /> draws done, current, pending.

Failed step

A failed step fills with --interactive-destructive-bg, and its label reads bold in --text-error with a warning icon.

Step 2 of 3 failed: Payment Starts
Step 2 of 3 failed: Payment Starts

Sections

A multi-step form's step bar. Give each step a weight (its slide count, say) and its segment takes that share of the width. Give a finished step an onSelect and it becomes a button that jumps back to it; steps without one stay out of the tab order. Set fill (0 to 1) on the current step to fill its segment as far as the form has got through it. With revealLabels, a pending step's label is hidden, and fades, rises and sharpens in when its step fills. Labels already filled on first render show without animating, and under prefers-reduced-motion they switch with no transition. Press Next to walk the form, and press a finished section to jump back.

Step 2 of 5: Tickets

In Five Looks

The same sections bar in each look, on the theme picked in the docs. The labels take the theme's text inks. Over a photo (data-glass="on") they take the glass layer's control ink, as the glass controls beside them do, and the track takes the glass fill and blurs the photo behind it; everywhere else the track is solid and does not blur.

Today
Dark
Dark + Photo
Light
Light + Photo

Theming the steps

HookDefaultDrives
--button-strong-fill--interactive-primary-bgThe current segment's fill, with or without steps
--segmented-progress-sm-label-font-size--font-size-xs (12px)Labels under sm
--segmented-progress-md-label-font-size--font-size-sm (14px)Labels under md
--segmented-progress-fill-duration600msEach segment's fill-in
--segmented-progress-fill-stagger140msThe delay between one segment's fill and the next
--motion-duration-enter, --motion-easing-enter--motion-duration-800, --motion-easing-ease-outA revealed label's fade in
--glass-control-ink, --glass-fill, --glass-blurthe theme's text inks, --surface-muted, noneLabels, track and track blur under data-glass="on"

A host that wants smaller labels at desktop widths sets the label hooks in its own media or container query.

Installation

npx visor add segmented-progress

This copies two files into your project:

  • components/ui/segmented-progress/segmented-progress.tsx — the component
  • components/ui/segmented-progress/segmented-progress.module.css — the styles

Usage

import { SegmentedProgress } from '@/components/ui/segmented-progress/segmented-progress';

export default function OnboardingProgress({ step, total }: { step: number; total: number }) {
  return (
    <SegmentedProgress
      total={total}
      value={step}
      current={step}
      aria-label={`Step ${step + 1} of ${total}`}
    />
  );
}

API Reference

SegmentedProgressProps

PropTypeDefaultDescription
total*number—Total number of segments to render.
value*number—Count of completed segments — indices 0..value-1 render in the done state. With steps, the default for a step that sets no state.
steps{ label: ReactNode; state?: 'done' | 'current' | 'pending' | 'failed'; weight?: number; onSelect?: () => void; fill?: number }[]—One entry per step: a segment with its label under it. The bar is then aria-hidden and summary is read in its place; total and aria-label are not used. weight (default 1) is the step's share of the width; onSelect makes the step a button, for jumping back to a finished step; fill (0 to 1, default 0.55) is how far a current step is filled.
revealLabelsbooleanfalseWith steps, hides each pending label and fades it in when its step fills. Labels filled on first render show without animating.
summaryReactNode—With steps, the visually hidden line a screen reader hears. Defaults to "Step 2 of 3: Bank Details", naming the failed, current or next step.
currentnumber—Optional 0-based index of the in-progress segment, rendered with the primary-to-muted gradient. Typically equals value.
size'sm' | 'md''sm'Segment height — 6px (sm) or 8px (md).
aria-label*string—Accessible name for the progress bar. Not used with steps.
classNamestring—Additional CSS class names to merge onto the element.

The component also accepts all standard <div> HTML attributes.

Accessibility

  • Without steps, the root element has role="progressbar" with aria-valuemin={0}, aria-valuemax={total}, and aria-valuenow={value}.
  • A step with onSelect is a <button> named "Go to" and its label (when the label is a string), and it stays in the accessibility tree and the tab order. Every other step is aria-hidden and never focusable.
  • With steps, every other step is aria-hidden and a visually hidden line beside the bar is read instead: "Step 2 of 3: Bank Details" by default, naming the failed step first, then the current one, then the next one ("All 3 steps done" when every step is done). Pass summary to say it differently.
  • Without steps, an aria-label is required — describe the current step context (e.g. "Step 3 of 10" or "Brand elicitation: step 3 of 10 complete").
  • Individual segment <span> elements are presentational; the progressbar role carries all announcements.
  • Segment transitions and the fill-in animation are disabled under prefers-reduced-motion.