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.
<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.
<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.
<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.
<div
class="w-96"
label="Label"
labelOrientation="side"
q-progress
value="64"
valueText="64%"
></div>
Sizes
<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:
The error text will only render when invalid is true.
<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-labelof 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:
| Prop | Type |
|---|---|
string | |
This can also be provided using the directive:
<div q-progress-label>...</div> | |
Additional description for the component, rendered below the bar. | string |
This can also be provided using the directive:
<div q-progress-hint>...</div> | |
Accessible label for the component, rendered above or to the left of the bar. | string |
This can also be provided using the directive:
<div q-progress-label>...</div> | |
Optional value text. | string |
This can also be provided using the directive:
<div q-progress-value-text>...</div> | |
string<div q-progress-label>...</div>
string<div q-progress-hint>...</div>
string<div q-progress-label>...</div>
string<div q-progress-value-text>...</div>
ProgressApi
The ProgressApi is accessible from the template via the progressContext structural directive:
<ng-container *progressContext="let context">
{{ context.valuePercent }}%
</ng-container>| Prop | Type |
|---|---|
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. | ( |
The computed state of the progress bar, based on the value. | | 'indeterminate' |
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 |
booleannumbernumber(
value: number,
) => void
| 'indeterminate'
| 'complete'
| 'loading'
value.numbernumbermin
and max values.Composite API
q-progress-root
| Prop | Type | Default |
|---|---|---|
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' | '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' | 'side' | 'top' |
Maximum value | number | 100 |
Minimum value | number | 0 |
Governs the height of the progress bar and track. | | 'sm' | 'md' |
Current progress value (0-100) | number | |
Callback fired when the value changes. | number |
number'ltr' | 'rtl'
| 'primary'
| 'neutral'
booleantrue, the progress is marked as invalid.'top' | 'side'
numbernumber| 'sm'
| 'md'
| 'lg'
numbernumber| Attribute / Property | Value |
|---|---|
class | 'qui-progress__root' |
data-invalid | |
data-label-orientation | 'top' | 'side' |
data-max | number |
data-part | 'root' |
data-scope | 'progress' |
data-size | | 'sm' |
data-state | | 'indeterminate' |
data-value | number |
style |
class'qui-progress__root'data-invaliddata-label-orientation'top' | 'side'
data-maxnumberdata-part'root'data-scope'progress'data-size| 'sm'
| 'md'
| 'lg'
data-state| 'indeterminate'
| 'complete'
| 'loading'
data-valuenumberstyleq-progress-label
| Prop | Type |
|---|---|
id attribute. If
omitted, a unique identifier will be generated for accessibility. | string |
string| Attribute / Property | Value |
|---|---|
class | 'qui-progress__label' |
data-part | 'label' |
data-scope | 'progress' |
class'qui-progress__label'data-part'label'data-scope'progress'q-progress-error-text
| Prop | Type | Default |
|---|---|---|
Error indicator icon. | | LucideIconData | CircleAlert |
id attribute. If
omitted, a unique identifier will be generated for accessibility. | string |
| LucideIconData
| string
string| Attribute / Property | Value |
|---|---|
class | 'qui-progress__error-text' |
data-part | 'error-text' |
data-scope | 'progress' |
hidden | boolean |
class'qui-progress__error-text'data-part'error-text'data-scope'progress'hiddenbooleanq-progress-hint
| Prop | Type |
|---|---|
id attribute. If
omitted, a unique identifier will be generated for accessibility. | string |
string| Attribute / Property | Value |
|---|---|
class | 'qui-progress__hint' |
data-part | 'hint' |
data-scope | 'progress' |
hidden | boolean |
class'qui-progress__hint'data-part'hint'data-scope'progress'hiddenbooleanq-progress-value-text
| Attribute / Property | Value |
|---|---|
class | 'qui-progress__value-text' |
data-invalid | |
data-part | 'value-text' |
data-scope | 'progress' |
class'qui-progress__value-text'data-invaliddata-part'value-text'data-scope'progress'q-progress-track
| Prop | Type |
|---|---|
id attribute. If
omitted, a unique identifier will be generated for accessibility. | string |
string| Attribute / Property | Value |
|---|---|
class | 'qui-progress__track' |
data-part | 'track' |
data-scope | 'progress' |
data-size | | 'sm' |
data-state | | 'indeterminate' |
class'qui-progress__track'data-part'track'data-scope'progress'data-size| 'sm'
| 'md'
| 'lg'
data-state| 'indeterminate'
| 'complete'
| 'loading'
q-progress-bar
| Attribute / Property | Value |
|---|---|
class | 'qui-progress__bar' |
data-emphasis | | 'primary' |
data-invalid | |
data-max | number |
data-part | 'bar' |
data-scope | 'progress' |
data-size | | 'sm' |
data-state | | 'indeterminate' |
style |
class'qui-progress__bar'data-emphasis| 'primary'
| 'neutral'
data-invaliddata-maxnumberdata-part'bar'data-scope'progress'data-size| 'sm'
| 'md'
| 'lg'
data-state| 'indeterminate'
| 'complete'
| 'loading'
style