Progress Bars

The <smart-progress-bars> component renders either a list of progress steps (options.steps, each complete, current or upcoming) or a percentage-based bar with optional column labels. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract ProgressBarsBaseComponent defines the shared API — options (IProgressBarsOptions), cssClass (alias class), and the stepClick output. ProgressBarsStandardComponent is a barebones placeholder using native HTML. ProgressBarsComponent is the public wrapper that renders ProgressBarsStandardComponent by default and accepts a custom replacement via PROGRESS_BARS_STANDARD_COMPONENT_TOKEN.


Usage

<smart-progress-bars [options]="options" (stepClick)="onStepClick($event)" />
@if (lastStep()) {
  <p>Last clicked step: {{ lastStep() }}</p>
}

The preview renders the code above in an application that registers every preset (provideSmartPresets(), see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.

Components

ProgressBarsComponent (<smart-progress-bars>)

Main wrapper. Delegates to ProgressBarsStandardComponent by default. When PROGRESS_BARS_STANDARD_COMPONENT_TOKEN is provided, renders the injected component via NgComponentOutlet, hands it the options and class inputs and re-emits its stepClick, so (stepClick) on <smart-progress-bars> works with any implementation.

ProgressBarsStandardComponent (<smart-progress-bars-standard>)

Barebones placeholder. options.layout selects one of two rendering modes.

  • Step mode (default; layouts simple, panels, bullets, panels-with-border, circles, bullets-and-text, circles-with-text): renders <nav class="progress-bars"> (with aria-label from options.ariaLabel or default "Progress"), an optional <p class="progress-bars-title"> from options.title, and an <ol> of options.steps. The data-layout attribute reflects options.layout so each visual variant can be styled. Each step renders as <a class="progress-bars-step-link" href> (when href is set) or <button class="progress-bars-step-button"> (otherwise; a click emits stepClick with the step id). Steps get the current class and aria-current="step" when status === 'current'. The data-status attribute on the <li> reflects status (default 'upcoming'). Each step shows iconTpl or, without it, index (e.g. "02"), then name and description, in every step layout.
  • Bar mode (layout progress-bar): renders <div class="progress-bars-bar-wrapper"> with an optional <h4 class="sr-only"> (from srOnlyTitle), an optional <p class="progress-bars-title"> (from title), a track + <div class="progress-bars-fill" role="progressbar"> (width = value clamped to 0–100) and an optional <div class="progress-bars-columns"> row of column labels (each with the active class when column.active === true). ariaLabel is not used in this mode.

ProgressBarsPresetComponent (<smart-progress-bars-preset>)

Fully-styled variation that extends ProgressBarsBaseComponent and is a drop-in replacement for ProgressBarsStandardComponent. Register it via PROGRESS_BARS_STANDARD_COMPONENT_TOKEN (or every preset at once with provideSmartPresets()) to restyle every <smart-progress-bars>, or use the <smart-progress-bars-preset> selector directly. It renders both modes off the shared IProgressBarsOptions API.

  • Percentage bar (layout: 'progress-bar'): a rounded track + animated bg-blue-600 fill sized to the clamped value (0–100). The track is the role="progressbar" element and carries options.ariaLabel (default "Progress") as its aria-label. Shows a title header with a value% label when title is set, an sr-only <h4> from srOnlyTitle, and a grid of column captions from columns (active columns rendered semibold).
  • Stepper (all other layouts): a <nav> (labelled by ariaLabel) with the optional title and an <ol> of steps. Markers adapt to the layout — numbered/check circles for circles, circles-with-text, panels, panels-with-border; small dots for bullets, bullets-and-text; a colored top border (no marker) for simple. bullets-and-text and circles-with-text lay out vertically; the other step layouts lay out horizontally, with connector lines between markers for circles/bullets. A step's iconTpl replaces the marker content, so the preset does not show it in the simple layout (which has no marker). Completed circle steps show a check SVG; current/upcoming circle steps show step.index (falling back to the 1-based position); the dot and simple layouts show no index. Each step renders an <a> when step.href is set, otherwise a <button> that emits stepClick. Names/markers tint by status (complete/current/upcoming).

All classes are smart:-prefixed Tailwind with explicit dark: variants. The class recipes are internal to the preset and not exported.

ProgressBarsPresetComponent declares cssClass without the class alias: bind [cssClass] when you use the <smart-progress-bars-preset> selector directly. On <smart-progress-bars> pass class as usual; the wrapper hands it to whichever implementation renders.

ProgressBarsBaseComponent (abstract)

Abstract base directive. Exposes:

  • options: InputSignal<IProgressBarsOptions | undefined>
  • cssClass: InputSignal<string> (alias class)
  • stepClick: OutputEmitterRef<IProgressStepClick>

API

Inputs

InputTypeDefaultDescription
optionsInputSignal<IProgressBarsOptions | undefined>-Progress configuration
classInputSignal<string>''External CSS classes (alias for cssClass)

Outputs

OutputTypeDescription
stepClickOutputEmitterRef<IProgressStepClick>Emitted when a step without href (a <button>) is clicked.

IProgressBarsOptions

FieldTypeDefaultDescription
layoutSmartProgressBarsLayout'simple'A step layout, or progress-bar for the percentage bar.
ariaLabelstring'Progress'Accessible name of the step <nav>; the preset also puts it on the bar's role="progressbar" track.
stepsIProgressStep[][]The steps of a step layout.
titlestring-Title above the steps or the bar (the preset bar also shows the value% next to it).
srOnlyTitlestring-Bar mode: a heading for screen readers only.
valuenumber0Bar mode: the percentage, clamped to 0–100.
columnsIProgressBarColumn[][]Bar mode: captions under the bar.

SmartProgressBarsLayout is 'simple' | 'panels' | 'bullets' | 'panels-with-border' | 'circles' | 'bullets-and-text' | 'circles-with-text' | 'progress-bar'.

IProgressStep

FieldTypeDefaultDescription
idstringrequiredReported as stepId by stepClick.
namestring-Step name.
descriptionstring-Text under the name, in every step layout.
statusSmartProgressStepStatus'upcoming''complete', 'current' (adds aria-current="step") or 'upcoming'.
hrefstring-Renders the step as a plain <a href> (no stepClick).
iconTplTemplateRef<unknown>-Icon of the step; the preset shows it in the marker, so not in the simple layout.
indexstring-Number of the step (e.g. '01'): the standard shows it when there is no iconTpl, the preset in circle markers.

IProgressBarColumn

FieldTypeDefaultDescription
labelstringrequiredCaption text.
activeboolean-Highlights the caption.

IProgressStepClick

FieldTypeDefaultDescription
stepIdstringrequiredThe id of the clicked step.

PROGRESS_BARS_STANDARD_COMPONENT_TOKEN

Provide a component class extending ProgressBarsBaseComponent under PROGRESS_BARS_STANDARD_COMPONENT_TOKEN to render it in every <smart-progress-bars> below that injector, for example ProgressBarsPresetComponent. provideSmartPresets() registers every preset of the library at once.

Extending the base class

import {
  ChangeDetectionStrategy,
  Component,
  computed,
  signal,
  ViewEncapsulation,
} from '@angular/core';

import {
  IProgressBarsOptions,
  PROGRESS_BARS_STANDARD_COMPONENT_TOKEN,
  ProgressBarsBaseComponent,
  ProgressBarsComponent,
} from '@smartsoft001/angular';

@Component({
  selector: 'docs-custom-progress-bars',
  template: `
    <div [class]="containerClasses()" [attr.aria-label]="options()?.ariaLabel">
      @if (options()?.title) {
        <p class="docs-progress-bars__title">{{ options()?.title }}</p>
      }

      @if (options()?.value !== undefined) {
        <div class="docs-progress-bars__track">
          <div
            class="docs-progress-bars__value"
            [style.width.%]="options()?.value"
          ></div>
        </div>
      }

      <ol class="docs-progress-bars__steps">
        @for (step of steps(); track step.id) {
          <li>
            <button
              type="button"
              class="docs-progress-bars__step"
              [class]="
                'docs-progress-bars__step--' + (step.status ?? 'upcoming')
              "
              [attr.aria-current]="step.status === 'current' ? 'step' : null"
              (click)="stepClick.emit({ stepId: step.id })"
            >
              <span class="docs-progress-bars__index">{{ step.index }}</span>
              <span class="docs-progress-bars__name">{{ step.name }}</span>
            </button>
          </li>
        }
      </ol>
    </div>
  `,
  encapsulation: ViewEncapsulation.None,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomProgressBarsComponent extends ProgressBarsBaseComponent {
  readonly steps = computed(() => this.options()?.steps ?? []);

  // `class` on <smart-progress-bars> reaches the inherited `cssClass` input.
  readonly containerClasses = computed(() => {
    const classes = ['docs-progress-bars'];
    const extra = this.cssClass();
    if (extra) classes.push(extra);
    return classes.join(' ');
  });
}

@Component({
  selector: 'docs-progress-bars-custom-example',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [ProgressBarsComponent],
  // The token swaps the standard progress bars for the custom one everywhere
  // below this component, so consumers keep writing `<smart-progress-bars>`.
  // The wrapper re-emits the custom component's `stepClick`.
  providers: [
    {
      provide: PROGRESS_BARS_STANDARD_COMPONENT_TOKEN,
      useValue: CustomProgressBarsComponent,
    },
  ],
  template: `
    <smart-progress-bars
      [options]="options"
      (stepClick)="lastStep.set($event.stepId)"
    />
    @if (lastStep()) {
      <p>Last clicked step: {{ lastStep() }}</p>
    }
  `,
})
export class ProgressBarsCustomExampleComponent {
  readonly lastStep = signal<string | null>(null);

  readonly options: IProgressBarsOptions = {
    title: 'Uploading files',
    ariaLabel: 'Upload progress',
    value: 50,
    steps: [
      { id: 'account', name: 'Account', index: '1', status: 'complete' },
      { id: 'profile', name: 'Profile', index: '2', status: 'current' },
      { id: 'review', name: 'Review', index: '3', status: 'upcoming' },
    ],
  };
}

Source

The component lives in packages/shared/angular/src/lib/components/progress-bars and is documented for Claude Code by the angular-components-progress-bars skill.

SmartProgressBars shows progress in two ways. With a step layout it renders steps (each complete, current or upcoming) as a <nav> list; steps with an internal href render through the navigation adapter's linkComponent when one is set, steps without href are buttons reported through onStepClick({ stepId }). With layout: 'progress-bar' it renders a track filled to value percent, with an optional title and column captions.


Usage

import { useState } from 'react';

import {
  IProgressBarsOptions,
  IProgressStepClick,
  SmartProgressBars,
} from '@smartsoft001/react';

const options: IProgressBarsOptions = {
  layout: 'panels',
  ariaLabel: 'Checkout progress',
  steps: [
    { id: 'shipping', index: '01', name: 'Shipping', status: 'complete' },
    { id: 'payment', index: '02', name: 'Payment', status: 'current' },
    { id: 'review', index: '03', name: 'Review', status: 'upcoming' },
  ],
};

export function ProgressBarsUsageExample() {
  const [lastStep, setLastStep] = useState<string | null>(null);

  const onStepClick = ({ stepId }: IProgressStepClick) => setLastStep(stepId);

  return (
    <>
      <SmartProgressBars options={options} onStepClick={onStepClick} />
      {lastStep && <p>Last clicked step: {lastStep}</p>}
    </>
  );
}

The preview renders the code above in an application that registers every preset (SMART_PRESET_COMPONENTS on SmartProvider, see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.

Exports

All from @smartsoft001/react.

ExportKindWhat it is
SmartProgressBarscomponentRenders the implementation registered as components['progress-bars'] on SmartProvider, SmartProgressBarsStandard by default.
SmartProgressBarsPresetcomponentStyled progress bars variation (preset).
SmartProgressBarsStandardcomponentThe default progress bars rendering: the steps as a <nav> list, or a progress bar for the progress-bar layout.

The preset's class helpers (getProgressBarsColumnClasses, isProgressBarsVertical, isProgressBarsBullet, isProgressBarsCircle, isProgressBarsPanel, isProgressBarsSimple, getProgressBarsListClasses, getProgressBarsStepClasses, getProgressBarsMarkerClasses, getProgressBarsNameClasses, getProgressBarsConnectorClasses, PROGRESS_BARS_WRAPPER, PROGRESS_BARS_HEADER, PROGRESS_BARS_TITLE, PROGRESS_BARS_VALUE_LABEL, PROGRESS_BARS_TRACK, PROGRESS_BARS_FILL, PROGRESS_BARS_COLUMNS, PROGRESS_BARS_NAV, PROGRESS_BARS_STEPPER_TITLE, PROGRESS_BARS_DESCRIPTION, PROGRESS_BARS_INDEX, PROGRESS_BARS_STEP_BUTTON, PROGRESS_BARS_STEP_LINK, PROGRESS_BARS_CHECK_ICON) are exported too, for a custom implementation that wants the preset look.

Props and Types

SmartProgressBarsProps

PropTypeDefaultDescription
options?IProgressBarsOptions—Layout, steps or the progress value.
className?string—Classes on the root element.
onStepClick?(event: IProgressStepClick) => void—A click on a step without href.

IProgressBarsOptions

FieldTypeDefaultDescription
layout?SmartProgressBarsLayout'simple'A step layout, or progress-bar for the percentage bar.
ariaLabel?string'Progress'Accessible name of the step <nav>; the preset also puts it on the bar's role="progressbar" track.
steps?IProgressStep[][]The steps of a step layout.
title?string—Title above the steps or the bar (the preset bar also shows the value% next to it).
srOnlyTitle?string—Bar mode: a heading for screen readers only.
value?number0Bar mode: the percentage, clamped to 0–100.
columns?IProgressBarColumn[][]Bar mode: captions under the bar.

IProgressStepClick

FieldTypeDefaultDescription
stepIdstringrequiredThe id of the clicked step.

IProgressStep

FieldTypeDefaultDescription
idstringrequiredReported as stepId.
name?string—Step name.
description?string—Text under the name, in every step layout.
status?SmartProgressStepStatus'upcoming'complete, current (adds aria-current="step") or upcoming.
href?string—Renders the step as a link (through the navigation adapter for internal paths); no onStepClick.
iconTpl?ReactNode—Icon of the step; the preset shows it in the marker, so not in the simple layout.
index?string—Number of the step (e.g. '01'): the standard shows it when there is no iconTpl, the preset in circle markers.

IProgressBarColumn

FieldTypeDefaultDescription
labelstringrequiredCaption text.
active?boolean—Highlights the caption.
  • SmartProgressBarsLayout: 'simple' \| 'panels' \| 'bullets' \| 'panels-with-border' \| 'circles' \| 'bullets-and-text' \| 'circles-with-text' \| 'progress-bar'
  • SmartProgressStepStatus: 'complete' \| 'current' \| 'upcoming'

Replacing the Implementation

SmartProgressBars renders the component registered under the 'progress-bars' key of SmartProvider's components, and SmartProgressBarsStandard when nothing is registered there. Every SmartProgressBars below the provider then renders the registered component, which receives the same props.

SmartProgressBarsPreset is the styled (preset) implementation: register it under the 'progress-bars' key of SmartProvider's components, render it directly in place of SmartProgressBars, or spread SMART_PRESET_COMPONENTS on the provider to register every preset at once (see the react-provider skill). Pass components as a stable object (a module constant or a memoised value), or the context changes on every render.

import { useState } from 'react';

import {
  cn,
  IProgressBarsOptions,
  SmartProgressBars,
  SmartProgressBarsProps,
  SmartProvider,
} from '@smartsoft001/react';

// There is no progress bars hook: the custom component takes the same props
// as SmartProgressBars and renders them its own way.
export function CustomProgressBars({
  options,
  className,
  onStepClick,
}: SmartProgressBarsProps) {
  return (
    <div
      className={cn('docs-progress-bars', className)}
      aria-label={options?.ariaLabel}
    >
      {options?.title && (
        <p className="docs-progress-bars__title">{options.title}</p>
      )}

      {options?.value !== undefined && (
        <div className="docs-progress-bars__track">
          <div
            className="docs-progress-bars__value"
            style={{ width: `${options.value}%` }}
          ></div>
        </div>
      )}

      <ol className="docs-progress-bars__steps">
        {(options?.steps ?? []).map((step) => (
          <li key={step.id}>
            <button
              type="button"
              className={cn(
                'docs-progress-bars__step',
                `docs-progress-bars__step--${step.status ?? 'upcoming'}`,
              )}
              aria-current={step.status === 'current' ? 'step' : undefined}
              onClick={() => onStepClick?.({ stepId: step.id })}
            >
              <span className="docs-progress-bars__index">{step.index}</span>
              <span className="docs-progress-bars__name">{step.name}</span>
            </button>
          </li>
        ))}
      </ol>
    </div>
  );
}

// A module constant: a new object on every render would change the context.
const components = { 'progress-bars': CustomProgressBars };

const options: IProgressBarsOptions = {
  title: 'Uploading files',
  ariaLabel: 'Upload progress',
  value: 50,
  steps: [
    { id: 'account', name: 'Account', index: '1', status: 'complete' },
    { id: 'profile', name: 'Profile', index: '2', status: 'current' },
    { id: 'review', name: 'Review', index: '3', status: 'upcoming' },
  ],
};

export function ProgressBarsCustomExample() {
  const [lastStep, setLastStep] = useState<string | null>(null);

  // Every SmartProgressBars below the provider renders CustomProgressBars,
  // which receives the same props, onStepClick included.
  return (
    <SmartProvider components={components}>
      <SmartProgressBars
        options={options}
        onStepClick={({ stepId }) => setLastStep(stepId)}
      />
      {lastStep && <p>Last clicked step: {lastStep}</p>}
    </SmartProvider>
  );
}

Styling

  • The standard rendering is unstyled; SmartProgressBarsPreset renders every layout (connectors between horizontal circles and bullets, the track and fill of the bar) with smart:dark: variants.

Source

The component lives in packages/shared/react/src/lib/components/progress-bars and is documented for Claude Code by the react-components-progress-bars skill.