Skip to content

Progress Ring

SixProgressRing

Progress rings are used to show the progress of a determinate operation in a circular fashion.

html
<six-progress-ring percentage="50"></six-progress-ring>

Examples

Size

Use the --size attribute to set the diameter of the progress ring.

html
<six-progress-ring percentage="50" size="200"></six-progress-ring>

Stroke Width

Use the stroke-width attribute to set the width of the progress ring's indicator.

html
<six-progress-ring percentage="50" stroke-width="10"></six-progress-ring>

Colors

To change the color, use the --track-color and --indicator-color custom properties.

html
<six-progress-ring percentage="50" style="--track-color: tomato; --indicator-color: green"></six-progress-ring>

Labels

Use the default slot to show a label.

50%
removeadd
html
<six-progress-ring percentage="50" size="200" class="progress-ring-labels" style="margin-bottom: 0.5rem"
  >50%</six-progress-ring>

<br>

<six-button size="small" circle><six-icon size="small">remove</six-icon></six-button>
<six-button size="small" circle><six-icon size="small">add</six-icon></six-button>

<script type="module">
  const progressRing = document.querySelector('.progress-ring-labels');
  const subtractButton = progressRing.nextElementSibling.nextElementSibling;
  const addButton = subtractButton.nextElementSibling;

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

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

Properties

PropertyAttributeDescriptionTypeDefault
percentagepercentageThe current progress percentage, 0 - 100.number0
sizesizeThe size of the progress ring in pixels.number128
strokeWidthstroke-widthThe stroke width of the progress ring in pixels.number4

Slots

SlotDescription
A label to show inside the ring.

Shadow Parts

PartDescription
"base"The component's base wrapper.
"label"The progress ring label.

CSS Custom Properties

NameDescription
--indicator-colorThe indicator color.
--track-colorThe track color.

Copyright © 2021-present SIX-Group