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">(witharia-labelfromoptions.ariaLabelor default"Progress"), an optional<p class="progress-bars-title">fromoptions.title, and an<ol>ofoptions.steps. Thedata-layoutattribute reflectsoptions.layoutso each visual variant can be styled. Each step renders as<a class="progress-bars-step-link" href>(whenhrefis set) or<button class="progress-bars-step-button">(otherwise; a click emitsstepClickwith the stepid). Steps get thecurrentclass andaria-current="step"whenstatus === 'current'. Thedata-statusattribute on the<li>reflectsstatus(default'upcoming'). Each step showsiconTplor, without it,index(e.g."02"), thennameanddescription, in every step layout. - Bar mode (layout
progress-bar): renders<div class="progress-bars-bar-wrapper">with an optional<h4 class="sr-only">(fromsrOnlyTitle), an optional<p class="progress-bars-title">(fromtitle), a track +<div class="progress-bars-fill" role="progressbar">(width =valueclamped to 0–100) and an optional<div class="progress-bars-columns">row of column labels (each with theactiveclass whencolumn.active === true).ariaLabelis 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 + animatedbg-blue-600fill sized to the clampedvalue(0–100). The track is therole="progressbar"element and carriesoptions.ariaLabel(default"Progress") as itsaria-label. Shows a title header with avalue%label whentitleis set, ansr-only<h4>fromsrOnlyTitle, and a grid of column captions fromcolumns(active columns rendered semibold). - Stepper (all other layouts): a
<nav>(labelled byariaLabel) with the optionaltitleand an<ol>of steps. Markers adapt to the layout — numbered/check circles forcircles,circles-with-text,panels,panels-with-border; small dots forbullets,bullets-and-text; a colored top border (no marker) forsimple.bullets-and-textandcircles-with-textlay out vertically; the other step layouts lay out horizontally, with connector lines between markers forcircles/bullets. A step'siconTplreplaces the marker content, so the preset does not show it in thesimplelayout (which has no marker). Completed circle steps show a check SVG; current/upcoming circle steps showstep.index(falling back to the 1-based position); the dot andsimplelayouts show no index. Each step renders an<a>whenstep.hrefis set, otherwise a<button>that emitsstepClick. Names/markers tint bystatus(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>(aliasclass)stepClick: OutputEmitterRef<IProgressStepClick>
API
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
options | InputSignal<IProgressBarsOptions | undefined> | - | Progress configuration |
class | InputSignal<string> | '' | External CSS classes (alias for cssClass) |
Outputs
| Output | Type | Description |
|---|---|---|
stepClick | OutputEmitterRef<IProgressStepClick> | Emitted when a step without href (a <button>) is clicked. |
IProgressBarsOptions
| Field | Type | Default | Description |
|---|---|---|---|
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 | number | 0 | Bar mode: the percentage, clamped to 0–100. |
columns | IProgressBarColumn[] | [] | Bar mode: captions under the bar. |
SmartProgressBarsLayout is 'simple' | 'panels' | 'bullets' | 'panels-with-border' | 'circles' | 'bullets-and-text' | 'circles-with-text' | 'progress-bar'.
IProgressStep
| Field | Type | Default | Description |
|---|---|---|---|
id | string | required | Reported as stepId by stepClick. |
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 plain <a href> (no stepClick). |
iconTpl | TemplateRef<unknown> | - | 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
| Field | Type | Default | Description |
|---|---|---|---|
label | string | required | Caption text. |
active | boolean | - | Highlights the caption. |
IProgressStepClick
| Field | Type | Default | Description |
|---|---|---|---|
stepId | string | required | The 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.
| Export | Kind | What it is |
|---|---|---|
SmartProgressBars | component | Renders the implementation registered as components['progress-bars'] on SmartProvider, SmartProgressBarsStandard by default. |
SmartProgressBarsPreset | component | Styled progress bars variation (preset). |
SmartProgressBarsStandard | component | The 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
| Prop | Type | Default | Description |
|---|---|---|---|
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
| Field | Type | Default | Description |
|---|---|---|---|
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? | number | 0 | Bar mode: the percentage, clamped to 0–100. |
columns? | IProgressBarColumn[] | [] | Bar mode: captions under the bar. |
IProgressStepClick
| Field | Type | Default | Description |
|---|---|---|---|
stepId | string | required | The id of the clicked step. |
IProgressStep
| Field | Type | Default | Description |
|---|---|---|---|
id | string | required | Reported 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
| Field | Type | Default | Description |
|---|---|---|---|
label | string | required | Caption text. |
active? | boolean | — | Highlights the caption. |
Related types
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;
SmartProgressBarsPresetrenders every layout (connectors between horizontal circles and bullets, the track and fill of the bar) withsmart: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.