Markdown:
Components

ProgressTracker

A component that displays the current step in a multi-step process or workflow.

  1. (1)
    Step 1
  2. (2)
    Step 2
  3. (3)
    Step 3

Usage

Use standalone.

Svelte
<ProgressTracker {...props} />

Anatomy

The class attribute values represent part names, and conditional indicates elements that are rendered conditionally. Other attributes represent their corresponding props.

Svelte
<ol class="whole" {...rest}>
  {#each labels as label}
    <li class="middle">
      <div class="main">
        <div class="aux" conditional>{aux}</div>
        <div class="label">{label} or {children}</div>
      </div>
      <div class="extra" aria-hidden="true" conditional>{extra}</div>
    </li>
  {/each}
</ol>

Props

NameTypeDefaultDescription
current*number0Index of the step currently progressing
labels*string[]-Step labels
childrenSnippet-Step content; receives index, label, and variant
auxSnippet-Auxiliary content; receives index, label, and variant
extra`booleanSnippet`true
statusLabelsRecord-Maps a variant to a screen-reader-only suffix appended to each step
stylingSVSClass-Styling override
variantSVSVariantNEUTRALVariant
eachVariantSvelteMap-Per-step variant

* required. Other HTMLOlAttributes are passed to <ol> via rest props; class is merged onto the root.

Styling

To learn more, see Styling.

Variant Management

Current step and whole part are applied neutral. Steps less than current step will be active, greater than current will be inactive. If the variant prop is specified, the specified value is applied instead of neutral.

Default Class Name

svs-progress-tracker

Accessibility

ARIA Roles and Attributes

The component applies these automatically:

  • Steps (middle <li>): aria-current="step" on the current step, and aria-label on non-current steps when a status suffix is available.
  • Connector (extra <div>, when rendered): aria-hidden="true".

Pass statusLabels when custom variants need a screen-reader suffix; otherwise the default active state suffix is used.

Exports

Types

TypeScript
interface ProgressTrackerProps extends Omit<HTMLOlAttributes, "children"> {
  current: number; // (0)
  labels: string[];
  children?: Snippet<[number, string, string]>; // Snippet<[index,label,variant]>
  aux?: Snippet<[number, string, string]>; // Snippet<[index,label,variant]>
  extra?: boolean | Snippet<[number, string, string]>; // (true) Snippet<[index,label,variant]>
  statusLabels?: Partial<Record<string, string>>; // variant -> screen-reader suffix
  styling?: SVSClass;
  variant?: SVSVariant; // (VARIANT.NEUTRAL)
  eachVariant?: SvelteMap<number, string> | Map<number, string>;
  // other HTMLOlAttributes are passed to <ol> via ...rest; `class` is merged onto the root
}
type ProgressTrackerReqdProps = "current" | "labels";
type ProgressTrackerBindProps = never;

Others

No additional exports are available.

Examples

The example code uses Tailwind CSS along with SVSClass.

Basic

  1. (1)
    Step 1
  2. (2)
    Step 2
  3. (3)
    Step 3

With Interactive Variant

Preset for Demo
Enter variant as you like
  1. Step 1
    Additional text 1
  2. Step 2
    Additional text 2
  3. Step 3
    Additional text 3
  4. Step 4
    Additional text 4