ProgressCircle
ProgressCircle shows the progress of a task as a ring that fills up, with the value, an icon or a count in its center, segments for steps, severities, sizes and an indeterminate mode. It is a pure SVG with no dependency.
Import #
import { ProgressCircle } from '@exhaustive-ui/core/progresscircle';Basic #
ProgressCircle draws the progress of a task as a ring that fills up clockwise from the top, with the value in its center. value goes from min to max, 0 and 100 by default; values outside the range are clamped. The ring is a pure SVG, rendered on the server, with no dependency.
Value and Template #
The center shows the rounded percentage of the range. With a unit other than %, it shows the value itself followed by the unit, and showValue set to false leaves the center empty. The content template replaces it with anything, such as an icon or a count: it receives the value as implicit variable, along with percent, min, max and completedSegments.
Sizes #
size set to small or large picks a preset size; any other size is set with the --p-progresscircle-size CSS variable, and the value in the center follows it. strokeWidth is the width of the ring, in percent of the size of the circle, 8 by default.
Colors #
severity colors the indicator: secondary, success, info, warn, danger or contrast, with a contrast of 3:1 or more against the background in both color schemes. color and trackColor take any CSS color, and rounded set to false draws square ends.
Segments #
segments splits the ring into chunks, for steps such as 3 of 5: set max to the same number so that each step fills one segment, and give ariaValueText a sentence such as "Step 3 of 5". The value can also fill the segments in part. segmentGap is the gap between two segments, in degrees.
Indeterminate #
mode set to indeterminate turns an arc around the ring while the duration of the task is unknown; switch back to determinate once the progress is known. The value is hidden and aria-valuenow removed, but the content template is still shown. With reduced motion, the arc turns slowly without stretching.
Upload #
The ring follows the value with a transition, disabled when the user prefers reduced motion. In this upload, each file is indeterminate while it is prepared, then shows the uploaded share; the content template replaces the value with a check mark once it is done, and a polite live region announces the end, since a progress bar is not announced when its value changes.
- 0%report.pdf0 of 12 MB
- 0%photos.zip0 of 240 MB
- 0%video.mp40 of 860 MB
Accessibility #
Screen Reader
ProgressCircle has the progressbar role with aria-valuemin, aria-valuemax and aria-valuenow, set from min, max and the clamped value. aria-valuetext is the displayed value, such as "60%" or "420 MB"; ariaValueText replaces it with a sentence, such as "Step 3 of 5", which matters with a content template or with segments. Name every progress circle with ariaLabel or with ariaLabelledBy pointing to a visible label. The SVG ring is hidden from assistive technologies.
In indeterminate mode, aria-valuenow and aria-valuetext are removed, as the WAI-ARIA progressbar role asks. A progress bar is not announced when its value changes: announce the start and the end of a long task with a polite live region, as in the upload example.
The indicator of each severity keeps a contrast of 3:1 or more with the background in light and dark mode. Do not rely on the color alone: pair a success or danger color with an icon or a text. The transition of the value and the stretching of the indeterminate arc are disabled when the user prefers reduced motion.
<span id="upload-label">Uploading report.pdf</span>
<p-progress-circle ariaLabelledBy="upload-label" [value]="40" />
<p-progress-circle ariaLabel="Checkout" [value]="3" [max]="5" [segments]="5" ariaValueText="Step 3 of 5" />Keyboard Support
Not applicable, the component is not interactive and is not in the tab order.