Progress
How far a task has gone, as a bar or a circle. In the look of the app's style.
Usage
import { Component, DestroyRef, ViewEncapsulation, afterNextRender, inject, signal,} from '@angular/core';import { ScProgress, ScProgressRange, ScProgressTrack,} from '@semantic-components/ui';
@Component({ selector: 'app-progress-usage-demo', imports: [ScProgress, ScProgressRange, ScProgressTrack], template: ` <div scProgress [value]="value()" aria-label="Loading" class="w-[60%]"> <div scProgressTrack><div scProgressRange></div></div> </div> `, host: { class: 'flex w-full justify-center' }, encapsulation: ViewEncapsulation.None,})export class ProgressUsageDemo { private readonly value = signal(13);
constructor() { // A moment after it appears: further along. let timer: ReturnType<typeof setTimeout> | undefined; afterNextRender(() => { timer = setTimeout(() => this.value.set(66), 500); }); inject(DestroyRef).onDestroy(() => clearTimeout(timer)); }}Anatomy
Every part is a directive on your element; the label and the value as text are yours. A bar has a track and a range; a circle, an svg.
import { ScProgress, ScProgressLabel, ScProgressValueText, ScProgressTrack, ScProgressRange, ScProgressCircle,} from '@semantic-components/ui';<div scProgress [value]="…"> <span scProgressLabel>…</span> <span scProgressValueText>…</span> <div scProgressTrack><div scProgressRange></div></div></div>
<div scProgress [value]="…" aria-label="…"> <svg scProgressCircle></svg> <span scProgressValueText>…</span></div>Accessibility
- A progressbar (role="progressbar", aria-valuenow, -min, -max), named by its label — or aria-label without one.
- The value as text is read too (aria-valuetext): "3 of 5 steps", not only a number.
- Without a value it is indeterminate: no aria-valuenow, and its movement stops for people who ask for less motion.
Examples
Label
Uploading
import { PercentPipe } from '@angular/common';import { Component, ViewEncapsulation } from '@angular/core';import { ScProgress, ScProgressLabel, ScProgressRange, ScProgressTrack, ScProgressValueText,} from '@semantic-components/ui';Controlled
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScProgress, ScProgressRange, ScProgressTrack, ScSlider,} from '@semantic-components/ui';
/** Its value from your state: here, a slider's. */@Component({Circle
import { PercentPipe } from '@angular/common';import { Component, ViewEncapsulation } from '@angular/core';import { ScProgress, ScProgressCircle, ScProgressValueText,} from '@semantic-components/ui';
@Component({ selector: 'app-circle-progress-demo',Indeterminate
Connecting
import { Component, ViewEncapsulation } from '@angular/core';import { ScProgress, ScProgressCircle, ScProgressLabel, ScProgressRange, ScProgressTrack,} from '@semantic-components/ui';
@Component({Download
report.pdf
import { PercentPipe } from '@angular/common';import { Component, DestroyRef, ViewEncapsulation, inject, signal,} from '@angular/core';import { ScButton,Min and Max
Setup
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScButton, ScProgress, ScProgressCircle, ScProgressLabel, ScProgressRange, ScProgressTrack, ScProgressValueText,} from '@semantic-components/ui';RTL
التحميل
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import { ScProgress, ScProgressCircle, ScProgressLabel, ScProgressRange, ScProgressTrack, ScProgressValueText,} from '@semantic-components/ui';API reference
Each part takes class, merged over the style (cn: a later class wins).
| Part | Selector | Description |
|---|---|---|
ScProgress | div[scProgress] | value (none: indeterminate), min, max; role="progressbar"; data-state, data-shape. |
ScProgressLabel, ScProgressValueText | [scProgressLabel], [scProgressValueText] | Its name (aria-labelledby), and its value as text (aria-valuetext), in the style's look; centred in a circle. |
ScProgressTrack, ScProgressRange | div[scProgressTrack], div[scProgressRange] | A bar: the track in the style's look, the range as far as the value; sliding while indeterminate. |
ScProgressCircle | svg[scProgressCircle] | A circle: the track and an arc from the top, clockwise (mirrored right to left); thickness, spin. |