Skip to content
Focsd homeFocsd homeFocsd
Forms

Progress bar

Progress of a task, known or indeterminate.

  • Tag: focsd-progress
  • Pattern: Progressbar
  • Category: Feedback

Example

HTML
<div class="stack">
<focsd-progress label="Uploading report.pdf" value="40"></focsd-progress>
<focsd-progress label="Preparing export" indeterminate></focsd-progress>
</div>

Ring

Progress as a ring, with the percentage in the center, for a compact space such as a card or a toolbar.

HTML
<focsd-progress
variant="ring"
label="Uploading report.pdf"
value="40"
show-value></focsd-progress>
<focsd-progress variant="ring" label="Syncing" indeterminate></focsd-progress>
<focsd-progress
variant="ring"
label="Saving"
value="70"
style="--focsd-progress-ring-size: 1.5rem"></focsd-progress>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-progress.js';
</script>
<focsd-progress label="Uploading report.pdf" value="40"></focsd-progress>

API

Attributes

AttributePropertyTypeDefault
valuevaluenumber0
maxmaxnumber100
labellabelstring—
indeterminateindeterminatebooleanfalse
variantvariant'bar' | 'ring'bar
show-valueshowValuebooleanfalse

CSS parts

Style the inside of the component with ::part(), for example focsd-progress::part(indicator).

PartDescription
indicatorThe bar's indicator element.
trackThe bar's track element.
ringThe ring variant's box, holding the circle and the value.
ring-trackThe ring's full circle behind the arc (a band between two thin outlines, as the bar's track).
ring-indicatorThe ring's arc, as long as the value.
valueThe ring's value as a percentage, shown with `show-value` (hidden from assistive technology, which reads aria-valuenow).

Accessibility

  • role="progressbar" with aria-valuenow/min/max and a required label; indeterminate omits aria-valuenow.

Ring

  • The ring is the same role="progressbar" as the bar, named by label, with aria-valuenow, aria-valuemin and aria-valuemax; the drawing is hidden from assistive technology.
  • With show-value the percentage appears in the center. It is hidden from screen readers, which already read the value from aria-valuenow.
  • While indeterminate, there is no aria-valuenow and the ring turns. When reduced motion is preferred it stops turning and shows a still arc.
  • Like the bar, the track is a sunk band with a thin edge-colored outline on each side. The arc against the band measures 6.33:1 (light), 10.02:1 (dark) and 16.39:1 (contrast), and the outline against the page 3.63:1, 3.63:1 and 21:1, so both the value and the ring’s extent meet the 3:1 non-text minimum.
  • In forced colors the arc uses Highlight, the band Canvas and its outlines CanvasText.
  • Set --focsd-progress-ring-size to change its size (3rem by default).