Skip to content

Commit 74bc623

Browse files
amcdnltinayuangao
authored andcommitted
docs(demos): add more progress bar examples (#7859)
1 parent 206d9e0 commit 74bc623

15 files changed

+102
-29
lines changed

src/lib/progress-bar/progress-bar.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
11
`<mat-progress-bar>` is a horizontal progress-bar for indicating progress and activity.
22

3-
<!-- example(progress-bar-overview) -->
3+
### Progress mode
4+
The progress-bar supports four modes: determinate, indeterminate, buffer and query.
45

6+
#### Determinate
7+
Operations where the percentage of the operation complete is known should use the
8+
determinate indicator.
59

6-
### Progress mode
7-
The progress-bar supports four modes.
10+
<!-- example(progress-bar-determinate) -->
11+
12+
This is the default mode and the progress is represented by the `value` property.
13+
14+
#### Indeterminate
15+
Operations where the user is asked to wait while something finishes and it’s
16+
not necessary to indicate how long it will take should use the indeterminate indicator.
817

9-
| Mode | Description |
10-
|---------------|----------------------------------------------------------------------------------|
11-
| determinate | Standard progress bar, fills from 0% to 100% |
12-
| indeterminate | Indicates that something is happening without conveying a discrete progress |
13-
| buffer | Dual-progress mode, typically showing both video download and playback progress |
14-
| query | Dual-stage mode, typically showing sending a request and downloading a response |
18+
<!-- example(progress-bar-indeterminate) -->
1519

16-
The default mode is "determinate". In this mode, the progress is set via the `value` property,
17-
which can be a whole number between 0 and 100.
20+
In this mode the `value` property is ignored.
21+
22+
#### Buffer
23+
Operations where the user wants to indicate some activity or loading from the server,
24+
use the buffer indicator.
25+
26+
<!-- example(progress-bar-buffer) -->
1827

1928
In "buffer" mode, `value` determines the progress of the primary bar while the `bufferValue` is
2029
used to show the additional buffering progress.
2130

22-
In "query" mode, the progress-bar renders as an inverted "indeterminate" bar. Once the response
23-
progress is available, the `mode` should be changed to determinate to convey the progress.
31+
#### Query
32+
For situations where the user wants to indicate pre-loading (until the loading can actually be made),
33+
use the query indicator.
2434

25-
In both "indeterminate" and "query" modes, the `value` property is ignored.
35+
<!-- example(progress-bar-query) -->
2636

37+
In "query" mode, the progress-bar renders as an inverted "indeterminate" bar. Once the response
38+
progress is available, the `mode` should be changed to determinate to convey the progress. In
39+
this mode the `value` property is ignored.
2740

2841
### Theming
2942
The color of a progress-bar can be changed by using the `color` property. By default, progress-bars

src/material-examples/example-module.ts

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ import {MenuOverviewExample} from './menu-overview/menu-overview-example';
7474
import {NestedMenuExample} from './nested-menu/nested-menu-example';
7575
import {PaginatorConfigurableExample} from './paginator-configurable/paginator-configurable-example';
7676
import {PaginatorOverviewExample} from './paginator-overview/paginator-overview-example';
77+
import {ProgressBarBufferExample} from './progress-bar-buffer/progress-bar-buffer-example';
7778
import {ProgressBarConfigurableExample} from './progress-bar-configurable/progress-bar-configurable-example';
78-
import {ProgressBarOverviewExample} from './progress-bar-overview/progress-bar-overview-example';
79+
import {ProgressBarDeterminateExample} from './progress-bar-determinate/progress-bar-determinate-example';
80+
import {ProgressBarIndeterminateExample} from './progress-bar-indeterminate/progress-bar-indeterminate-example';
81+
import {ProgressBarQueryExample} from './progress-bar-query/progress-bar-query-example';
7982
import {ProgressSpinnerConfigurableExample} from './progress-spinner-configurable/progress-spinner-configurable-example';
8083
import {ProgressSpinnerOverviewExample} from './progress-spinner-overview/progress-spinner-overview-example';
8184
import {RadioNgModelExample} from './radio-ng-model/radio-ng-model-example';
@@ -483,15 +486,33 @@ export const EXAMPLE_COMPONENTS = {
483486
additionalFiles: null,
484487
selectorName: null
485488
},
489+
'progress-bar-buffer': {
490+
title: 'Buffer progress-bar',
491+
component: ProgressBarBufferExample,
492+
additionalFiles: null,
493+
selectorName: null
494+
},
486495
'progress-bar-configurable': {
487496
title: 'Configurable progress-bar',
488497
component: ProgressBarConfigurableExample,
489498
additionalFiles: null,
490499
selectorName: null
491500
},
492-
'progress-bar-overview': {
493-
title: 'Basic progress-bar',
494-
component: ProgressBarOverviewExample,
501+
'progress-bar-determinate': {
502+
title: 'Determinate progress-bar',
503+
component: ProgressBarDeterminateExample,
504+
additionalFiles: null,
505+
selectorName: null
506+
},
507+
'progress-bar-indeterminate': {
508+
title: 'Indeterminate progress-bar',
509+
component: ProgressBarIndeterminateExample,
510+
additionalFiles: null,
511+
selectorName: null
512+
},
513+
'progress-bar-query': {
514+
title: 'Query progress-bar',
515+
component: ProgressBarQueryExample,
495516
additionalFiles: null,
496517
selectorName: null
497518
},
@@ -793,8 +814,11 @@ export const EXAMPLE_LIST = [
793814
NestedMenuExample,
794815
PaginatorConfigurableExample,
795816
PaginatorOverviewExample,
817+
ProgressBarBufferExample,
796818
ProgressBarConfigurableExample,
797-
ProgressBarOverviewExample,
819+
ProgressBarDeterminateExample,
820+
ProgressBarIndeterminateExample,
821+
ProgressBarQueryExample,
798822
ProgressSpinnerConfigurableExample,
799823
ProgressSpinnerOverviewExample,
800824
RadioNgModelExample,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<mat-progress-bar mode="buffer"></mat-progress-bar>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {Component} from '@angular/core';
2+
3+
/**
4+
* @title Buffer progress-bar
5+
*/
6+
@Component({
7+
selector: 'progress-bar-buffer-example',
8+
templateUrl: 'progress-bar-buffer-example.html',
9+
})
10+
export class ProgressBarBufferExample {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/** No CSS for this example */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<mat-progress-bar mode="determinate" value="40"></mat-progress-bar>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {Component} from '@angular/core';
2+
3+
/**
4+
* @title Determinate progress-bar
5+
*/
6+
@Component({
7+
selector: 'progress-bar-determinate-example',
8+
templateUrl: 'progress-bar-determinate-example.html',
9+
})
10+
export class ProgressBarDeterminateExample {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/** No CSS for this example */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {Component} from '@angular/core';
2+
3+
/**
4+
* @title Indeterminate progress-bar
5+
*/
6+
@Component({
7+
selector: 'progress-bar-indeterminate-example',
8+
templateUrl: 'progress-bar-indeterminate-example.html',
9+
})
10+
export class ProgressBarIndeterminateExample {}

src/material-examples/progress-bar-overview/progress-bar-overview-example.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/** No CSS for this example */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<mat-progress-bar mode="query"></mat-progress-bar>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {Component} from '@angular/core';
2+
3+
/**
4+
* @title Query progress-bar
5+
*/
6+
@Component({
7+
selector: 'progress-bar-query-example',
8+
templateUrl: 'progress-bar-query-example.html',
9+
})
10+
export class ProgressBarQueryExample {}

0 commit comments

Comments
 (0)