Skip to content

docs(demos): add more progress bar examples #7859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions src/lib/progress-bar/progress-bar.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
`<mat-progress-bar>` is a horizontal progress-bar for indicating progress and activity.

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

#### Determinate
Operations where the percentage of the operation complete is known should use the
determinate indicator.

### Progress mode
The progress-bar supports four modes.
<!-- example(progress-bar-determinate) -->

This is the default mode and the progress is represented by the `value` property.

#### Indeterminate
Operations where the user is asked to wait while something finishes and it’s
not necessary to indicate how long it will take should use the indeterminate indicator.

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

The default mode is "determinate". In this mode, the progress is set via the `value` property,
which can be a whole number between 0 and 100.
In this mode the `value` property is ignored.

#### Buffer
Operations where the user wants to indicate some activity or loading from the server,
use the buffer indicator.

<!-- example(progress-bar-buffer) -->

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

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

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

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

### Theming
The color of a progress-bar can be changed by using the `color` property. By default, progress-bars
Expand Down
36 changes: 30 additions & 6 deletions src/material-examples/example-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ import {MenuOverviewExample} from './menu-overview/menu-overview-example';
import {NestedMenuExample} from './nested-menu/nested-menu-example';
import {PaginatorConfigurableExample} from './paginator-configurable/paginator-configurable-example';
import {PaginatorOverviewExample} from './paginator-overview/paginator-overview-example';
import {ProgressBarBufferExample} from './progress-bar-buffer/progress-bar-buffer-example';
import {ProgressBarConfigurableExample} from './progress-bar-configurable/progress-bar-configurable-example';
import {ProgressBarOverviewExample} from './progress-bar-overview/progress-bar-overview-example';
import {ProgressBarDeterminateExample} from './progress-bar-determinate/progress-bar-determinate-example';
import {ProgressBarIndeterminateExample} from './progress-bar-indeterminate/progress-bar-indeterminate-example';
import {ProgressBarQueryExample} from './progress-bar-query/progress-bar-query-example';
import {ProgressSpinnerConfigurableExample} from './progress-spinner-configurable/progress-spinner-configurable-example';
import {ProgressSpinnerOverviewExample} from './progress-spinner-overview/progress-spinner-overview-example';
import {RadioNgModelExample} from './radio-ng-model/radio-ng-model-example';
Expand Down Expand Up @@ -441,15 +444,33 @@ export const EXAMPLE_COMPONENTS = {
additionalFiles: null,
selectorName: null
},
'progress-bar-buffer': {
title: 'Buffer progress-bar',
component: ProgressBarBufferExample,
additionalFiles: null,
selectorName: null
},
'progress-bar-configurable': {
title: 'Configurable progress-bar',
component: ProgressBarConfigurableExample,
additionalFiles: null,
selectorName: null
},
'progress-bar-overview': {
title: 'Basic progress-bar',
component: ProgressBarOverviewExample,
'progress-bar-determinate': {
title: 'Determinate progress-bar',
component: ProgressBarDeterminateExample,
additionalFiles: null,
selectorName: null
},
'progress-bar-indeterminate': {
title: 'Indeterminate progress-bar',
component: ProgressBarIndeterminateExample,
additionalFiles: null,
selectorName: null
},
'progress-bar-query': {
title: 'Query progress-bar',
component: ProgressBarQueryExample,
additionalFiles: null,
selectorName: null
},
Expand Down Expand Up @@ -514,7 +535,7 @@ export const EXAMPLE_COMPONENTS = {
selectorName: null
},
'select-no-ripple': {
title: 'Select with cno option ripple ',
title: 'Select with no option ripple ',
component: SelectNoRippleExample,
additionalFiles: null,
selectorName: null
Expand Down Expand Up @@ -745,8 +766,11 @@ export const EXAMPLE_LIST = [
NestedMenuExample,
PaginatorConfigurableExample,
PaginatorOverviewExample,
ProgressBarBufferExample,
ProgressBarConfigurableExample,
ProgressBarOverviewExample,
ProgressBarDeterminateExample,
ProgressBarIndeterminateExample,
ProgressBarQueryExample,
ProgressSpinnerConfigurableExample,
ProgressSpinnerOverviewExample,
RadioNgModelExample,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mat-progress-bar mode="buffer"></mat-progress-bar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Component} from '@angular/core';

/**
* @title Buffer progress-bar
*/
@Component({
selector: 'progress-bar-buffer-example',
templateUrl: 'progress-bar-buffer-example.html',
})
export class ProgressBarBufferExample {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/** No CSS for this example */
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mat-progress-bar mode="determinate" value="40"></mat-progress-bar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Component} from '@angular/core';

/**
* @title Determinate progress-bar
*/
@Component({
selector: 'progress-bar-determinate-example',
templateUrl: 'progress-bar-determinate-example.html',
})
export class ProgressBarDeterminateExample {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/** No CSS for this example */
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Component} from '@angular/core';

/**
* @title Indeterminate progress-bar
*/
@Component({
selector: 'progress-bar-indeterminate-example',
templateUrl: 'progress-bar-indeterminate-example.html',
})
export class ProgressBarIndeterminateExample {}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/** No CSS for this example */
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mat-progress-bar mode="query"></mat-progress-bar>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Component} from '@angular/core';

/**
* @title Query progress-bar
*/
@Component({
selector: 'progress-bar-query-example',
templateUrl: 'progress-bar-query-example.html',
})
export class ProgressBarQueryExample {}