Progress
Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
Loading...
 import { Component, computed, effect, signal } from '@angular/core';
import { RdxProgressIndicatorDirective, RdxProgressRootDirective } from '@radix-ng/primitives/progress';
 
@Component({
    selector: 'raidx-progress-demo',
    standalone: true,
    imports: [RdxProgressIndicatorDirective, RdxProgressRootDirective],
    template: `
        <div class="ProgressRoot" [value]="progress()" rdxProgressRoot>
            <div
                class="ProgressIndicator"
                [style.transform]="'translateX(-' + (100 - progress()) + '%)'"
                rdxProgressIndicator
            ></div>
        </div>
    `,
    styleUrl: 'progress-demo.css'
})
export class ProgressDemoComponent {
    private startTime = Date.now();
    private readonly currentTime = signal(this.startTime);
 
    readonly progress = computed(() => {
        const elapsed = Math.floor((this.currentTime() - this.startTime) / 1000);
        const value = (10 + elapsed * 30) % 100;
        return value === 0 ? 10 : value;
    });
 
    constructor() {
        effect(() => {
            const intervalId = setInterval(() => {
                this.currentTime.set(Date.now());
            }, 1000);
 
            return () => clearInterval(intervalId);
        });
    }
}
   .ProgressRoot {
    position: relative;
    overflow: hidden;
    background: var(--black-a9);
    border-radius: 99999px;
    width: 220px;
    display: flex;
    height: 25px;
 
    /* Fix overflow clipping in Safari */
    /* https://gist.github.com/domske/b66047671c780a238b51c51ffde8d3a0 */
    transform: translateZ(0);
}
 
.ProgressIndicator {
    background-color: white;
    width: 100%;
    height: 100%;
    transition: transform 660ms cubic-bezier(0.65, 0, 0.35, 1);
} Features
- Provides context for assistive technology to read the progress of a task.
Installation
Get started with importing the directive:
 import { RdxProgressIndicatorDirective, RdxProgressRootDirective } from '@radix-ng/primitives/progress'; API Reference
Root
  RdxProgressRootDirective  
| Prop | Default | Type | 
|---|---|---|
| value |  0  |  ModelSignal<number> The current value of the progress bar. | 
| max |  100  |  ModelSignal<number> The maximum value of the progress bar. | 
| valueLabel |  —  |  InputSignal<(value: number, max: number) => string> Function to generate the value label. | 
| Data Attribute | Value | 
|---|---|
| [data-state] |  "complete" | "indeterminate" | "loading"  | 
| [data-value] |  The current value  | 
| [data-max] |  The max value  | 
Indicator
  RdxProgressIndicatorDirective 
Used to show the progress visually. It also makes progress accessible to assistive technologies. 
| Data Attribute | Value | 
|---|---|
| [data-state] |  "complete" | "indeterminate" | "loading"  | 
| [data-value] |  The current value  | 
| [data-max] |  The max value  |