Primitives

Progress

Display an indicator representing the progress of a task.

Import

Import the Progress primitives from ng-primitives/progress.

import {
  NgpProgress,
  NgpProgressTrack,
  NgpProgressLabel,
  NgpProgressValue,
  NgpProgressIndicator,
} from 'ng-primitives/progress';

Usage

Assemble the avatar directives in your template.

<div ngpProgress [ngpProgressValue]="percentage">
  <span ngpProgressLabel></span>
  <span ngpProgressValue></span>

  <div ngpProgressTrack>
    <div ngpProgressIndicator></div>
  </div>
</div>

Reusable Component

Create a reusable component that uses the progress directives.

import { Component } from '@angular/core';
import { Progress } from './progress';

@Component({
  selector: 'app-root',
  imports: [Progress],
  template: `
    <app-progress value="50" label="Loading" aria-label="Progress indicator" />
  `,
})
export default class App {}

Schematics

Generate a reusable progress component using the Angular CLI.

ng g ng-primitives:primitive progress

Options

  • path: The path at which to create the component file.
  • prefix: The prefix to apply to the generated component selector.
  • componentSuffix: The suffix to apply to the generated component class name.
  • fileSuffix: The suffix to apply to the generated component file name. Defaults to component.
  • exampleStyles: Whether to include example styles in the generated component file. Defaults to true.

API Reference

The following directives are available to import from the ng-primitives/progress package:

NgpProgress

Apply the `ngpProgress` directive to an element that represents the progress bar.

  • Selector: [ngpProgress]
ngpProgressValue
number | null

Define the progress value.

ngpProgressMin
number
default: "'0'"

Define the progress min value.

ngpProgressMax
number
default: "100"

Define the progress max value.

ngpProgressValueLabel
NgpProgressValueTextFn

Define a function that returns the progress value label.

Data Attributes

The following data attributes are applied to the ngpProgress directive:

Attribute Description
data-progressing Indicates that the progress is in progress.
data-indeterminate Indicates that the progress is indeterminate.
data-complete Indicates that the progress is complete.

NgpProgressIndicator

Apply the `ngpProgressIndicator` directive to an element that represents the current progress. The width of this element can be set to the percentage of the progress value.

  • Selector: [ngpProgressIndicator]

Data Attributes

The following data attributes are applied to the ngpProgress directive:

Attribute Description
data-progressing Indicates that the progress is in progress.
data-indeterminate Indicates that the progress is indeterminate.
data-complete Indicates that the progress is complete.

NgpProgressTrack

  • Selector: [ngpProgressTrack]
  • Exported As: ngpProgressTrack

Data Attributes

The following data attributes are applied to the ngpProgressTrack directive:

Attribute Description
data-progressing Indicates that the progress is in progress.
data-indeterminate Indicates that the progress is indeterminate.
data-complete Indicates that the progress is complete.

NgpProgressLabel

  • Selector: [ngpProgressLabel]
  • Exported As: ngpProgressLabel

Data Attributes

The following data attributes are applied to the ngpProgressLabel directive:

Attribute Description
data-progressing Indicates that the progress is in progress.
data-indeterminate Indicates that the progress is indeterminate.
data-complete Indicates that the progress is complete.

NgpProgressValue

  • Selector: [ngpProgressValue]
  • Exported As: ngpProgressValue

Data Attributes

The following data attributes are applied to the ngpProgressValue directive:

Attribute Description
data-progressing Indicates that the progress is in progress.
data-indeterminate Indicates that the progress is indeterminate.
data-complete Indicates that the progress is complete.

Accessibility

Adheres to the WAI-ARIA Progressbar pattern.

Copyright © 2025 Angular Primitives