3.0.0-alpha.4 Alpha
Light Dark Light Dark System Search /

Progress Bar

<wa-progress-bar> Since 2.0 stable

Progress bars are used to show the status of an ongoing operation.

<wa-progress-bar value="50"></wa-progress-bar>

Examples

Labels

Use the label attribute to label the progress bar and tell assistive devices how to announce it.

<wa-progress-bar value="50" label="Upload progress"></wa-progress-bar>

Custom Height

Use the --height custom property to set the progress bar's height.

<wa-progress-bar value="50" style="--height: 6px;"></wa-progress-bar>

Showing Values

Use the default slot to show a value.

50%
<wa-progress-bar value="50" class="progress-bar-values">50%</wa-progress-bar>

<br />

<wa-button circle><wa-icon name="minus" variant="solid" label="Decrease"></wa-icon></wa-button>
<wa-button circle><wa-icon name="plus" variant="solid" label="Increase"></wa-icon></wa-button>

<script>
  const progressBar = document.querySelector('.progress-bar-values');
  const subtractButton = progressBar.nextElementSibling.nextElementSibling;
  const addButton = subtractButton.nextElementSibling;

  addButton.addEventListener('click', () => {
    const value = Math.min(100, progressBar.value + 10);
    progressBar.value = value;
    progressBar.textContent = `${value}%`;
  });

  subtractButton.addEventListener('click', () => {
    const value = Math.max(0, progressBar.value - 10);
    progressBar.value = value;
    progressBar.textContent = `${value}%`;
  });
</script>

Indeterminate

The indeterminate attribute can be used to inform the user that the operation is pending, but its status cannot currently be determined. In this state, value is ignored and the label, if present, will not be shown.

<wa-progress-bar indeterminate></wa-progress-bar>

Slots

Name Description
(default) A label to show inside the progress indicator.

Properties

Name Description Reflects
value
value
The current progress as a percentage, 0 to 100.
Type number
Default 0
indeterminate
indeterminate
When true, percentage is ignored, the label is hidden, and the progress bar is drawn in an indeterminate state.
Type boolean
Default false
label
label
A custom label for assistive devices.
Type string
Default ''

CSS custom properties

Name Description
--height
The progress bar's height.
--track-color
The color of the track.
--indicator-color
The color of the indicator.
--label-color
The color of the label.
--box-shadow
The shadow effects around the edges of the progress bar.

CSS parts

Name Description
base The component's base wrapper.
indicator The progress bar's indicator.
label The progress bar's label.

Importing

The autoloader is the recommended way to import components. If you prefer to do it manually, use one of the following code snippets.

CDN npm React

To manually import this component from the CDN, use the following code.

import 'https://early.webawesome.com/webawesome@3.0.0-alpha.4/dist/components/progress-bar/progress-bar.js';
Coming soon! Coming soon!
    No results