Progress

Progress bars provide clear visual feedback about task completion or loading states, helping users understand system status and perceived remaining time.

import {ProgressModule} from "@qualcomm-ui/angular/progress"

Overview

The progress bar can be in one of two states:

  • indeterminate: the default state.
  • determinate: assumed when the value prop is passed.

Indeterminate progress bar keep users informed that work is happening when timeframes are unknown.

Examples

Simple

The simple API bundles all subcomponents together into a single directive.

Indeterminate
Determinate
64%
Optional hint
<div class="w-64" label="Indeterminate" q-progress></div>
<div
  hint="Optional hint"
  label="Determinate"
  q-progress
  value="64"
  valueText="64%"
></div>

Child Directives

Provide child directives to customize specific elements while keeping the simple API's default structure.

Label
<div class="w-64" q-progress>
  <div q-progress-label>Label</div>
</div>

Composite

Build with the composite API for granular control. This API requires you to provide each subcomponent, but gives you full control over the structure.

Label
64%
Optional hint
<div class="w-64" q-progress-root value="64">
  <div q-progress-label>Label</div>
  <div *progressContext="let context" q-progress-value-text>
    <div q-progress-value-text>{{ context.valuePercent }}%</div>
  </div>
  <div q-progress-track></div>
  <div q-progress-error-text></div>
  <div q-progress-hint>Optional hint</div>
</div>

Label Orientation

Use the labelOrientation property to change the positioning of the label and value text relative to the progress bar.

Label
64%
<div
  class="w-96"
  label="Label"
  labelOrientation="side"
  q-progress
  value="64"
  valueText="64%"
></div>

Sizes

sm
md
lg
<div label="sm" q-progress size="sm" [value]="value()"></div>
<div label="md" q-progress size="md" [value]="value()"></div>
<div label="lg" q-progress size="lg" [value]="value()"></div>

Emphasis (Color)

<div emphasis="primary" q-progress></div>
<div emphasis="neutral" q-progress></div>

Error Text

Error messages are displayed using two props:

  • invalid
  • errorText (or the Progress.ErrorText component when using the composite API)

The error text will only render when invalid is true.

Loading Module
25%
Network disconnected, please try again
<div
  class="w-64"
  defaultValue="25"
  errorText="Network disconnected, please try again"
  invalid
  label="Loading Module"
  q-progress
>
  <div *progressContext="let context" q-progress-value-text>
    {{ context.valuePercent }}%
  </div>
</div>

Shortcuts

Track and Bar

The q-progress-track automatically renders a q-progress-bar when no children as passed to it. This makes <div q-progress-track></div> equivalent to:

<div q-progress-track>
  <div q-progress-bar></div>
</div>

Accessibility

  • When the value is supplied, the component automatically provides the corresponding aria-value* attributes to the element.
  • The progress element is automatically marked with role="progressbar".
  • The label is automatically associated with the progress bar. If you omit the label property, the aria-label of the progress element defaults to the value when determinate, and "Loading" when indeterminate.

API

q-progress

The q-progress directive extends the q-progress-root directive with the following properties:

PropType
Optional error text. Only rendered when invalid is true.
string
Additional description for the component, rendered below the bar.
string
Accessible label for the component, rendered above or to the left of the bar.
string
Optional value text.
string
Type
string
Description
Optional error text. Only rendered when invalid is true.
Type
string
Description
Additional description for the component, rendered below the bar.
Type
string
Description
Accessible label for the component, rendered above or to the left of the bar.
Type
string
Description
Optional value text.

ProgressApi

The ProgressApi is accessible from the template via the progressContext structural directive:

<ng-container *progressContext="let context">
  {{ context.valuePercent }}%
</ng-container>
PropType
Whether the progress bar is indeterminate
boolean
The maximum value of the progress bar.
number
The minimum value of the progress bar.
number
Sets the value of the progress bar.
    (
    value: number,
    ) => void
    The computed state of the progress bar, based on the value.
    | 'indeterminate'
    | 'complete'
    | 'loading'
    The current value of the progress bar.
    number
    The current value of the progress bar as a percentage, computed from the min and max values.
    number
    Type
    boolean
    Description
    Whether the progress bar is indeterminate
    Type
    number
    Description
    The maximum value of the progress bar.
    Type
    number
    Description
    The minimum value of the progress bar.
    Type
    (
    value: number,
    ) => void
    Description
    Sets the value of the progress bar.
      Type
      | 'indeterminate'
      | 'complete'
      | 'loading'
      Description
      The computed state of the progress bar, based on the value.
      Type
      number
      Description
      The current value of the progress bar.
      Type
      number
      Description
      The current value of the progress bar as a percentage, computed from the min and max values.

      Composite API

      q-progress-root

      PropTypeDefault
      The initial value of the progress when it is first rendered. Use when you do not need to control the state of the progress.
      number
      The document's text/writing direction.
      'ltr' | 'rtl'
      "ltr"
      
      Governs the color of the progress bar.
      | 'primary'
      | 'neutral'
      'primary'
      
      If true, the progress is marked as invalid.
      boolean
      Governs the placement of the label and value text relative to the progress bar.
      • top: the label and value text are positioned above the progress bar.
      • side: the label and value text are positioned on the same horizontal axis as the progress bar, to the left and right, respectively.
      'top' | 'side'
      'top'
      
      Maximum value
      number
      100
      
      Minimum value
      number
      0
      
      Governs the height of the progress bar and track.
      | 'sm'
      | 'md'
      | 'lg'
      'md'
      
      Current progress value (0-100)
      number
      Callback fired when the value changes.
      number
      Type
      number
      Description
      The initial value of the progress when it is first rendered. Use when you do not need to control the state of the progress.
      Type
      'ltr' | 'rtl'
      Description
      The document's text/writing direction.
      Type
      | 'primary'
      | 'neutral'
      Description
      Governs the color of the progress bar.
      Type
      boolean
      Description
      If true, the progress is marked as invalid.
      Type
      'top' | 'side'
      Description
      Governs the placement of the label and value text relative to the progress bar.
      • top: the label and value text are positioned above the progress bar.
      • side: the label and value text are positioned on the same horizontal axis as the progress bar, to the left and right, respectively.
      Type
      number
      Description
      Maximum value
      Type
      number
      Description
      Minimum value
      Type
      | 'sm'
      | 'md'
      | 'lg'
      Description
      Governs the height of the progress bar and track.
      Type
      number
      Description
      Current progress value (0-100)
      Type
      number
      Description
      Callback fired when the value changes.

      q-progress-label

      PropType
      id attribute. If omitted, a unique identifier will be generated for accessibility.
      string
      Type
      string
      Description
      id attribute. If omitted, a unique identifier will be generated for accessibility.

      q-progress-error-text

      PropTypeDefault
      Error indicator icon.
      | LucideIconData
      | string
      CircleAlert
      
      id attribute. If omitted, a unique identifier will be generated for accessibility.
      string
      Type
      | LucideIconData
      | string
      Description
      Error indicator icon.
      Type
      string
      Description
      id attribute. If omitted, a unique identifier will be generated for accessibility.

      q-progress-hint

      PropType
      id attribute. If omitted, a unique identifier will be generated for accessibility.
      string
      Type
      string
      Description
      id attribute. If omitted, a unique identifier will be generated for accessibility.

      q-progress-value-text

      q-progress-track

      PropType
      id attribute. If omitted, a unique identifier will be generated for accessibility.
      string
      Type
      string
      Description
      id attribute. If omitted, a unique identifier will be generated for accessibility.

      q-progress-bar