Skip to content
EspañolEnglish
All components (283)

Ring progress

Surfaces · RingProgress · .amset-ringprogress

What it is and when to use it

A ring that fills up: the progress of a task, a spent quota, the split of a total into a few parts. Unlike DonutChart, the ring does not have to be full: max says how much is everything, and what is missing stays in the background colour.

When to use it

  • A single value over a total (68 % of an order prepared): one section and max.
  • A few parts of a total that is not complete (done, in progress, blocked out of 100 tasks): several sections.
  • center changes what goes in the hole; without it, the percentage done.
  • legend shows underneath the colour, name and value of each section: with several sections, colour alone does not say which is which.
  • target puts a mark on the ring, in the same units as max: what was expected to have been reached.

When not to

  • A task in a straight line with its bar: Progress.
  • A level that changes colour by bands: Gauge.
  • Many parts that add up to everything: DonutChart.

Keyboard: it is not focusable.

Accessibility: it is an image (role="img") with a written summary ("68% complete. Done: 68") and, underneath, a real table hidden from sight. Colour is not the only thing that informs: the percentage is written in the centre.

Fine-tuning: the tones are the text ones of the gauge, which also read as a stroke on a dark surface. --amset-ringprogress-size is the diameter, --amset-ringprogress-thickness the thickness (in drawing units, out of 36) and --amset-ringprogress-track the colour of the background.

What it looks like

Sprint progress

Sprint 14 · ends on Friday

Sprint progress
PartValue
Done45
In review20

Aurelia order

Workshop · due on the 20th

Order packed
PartValue
Order packed90

<Card title="Sprint progress" subtitle="Sprint 14 · ends on Friday">
<RingProgress
  label="Sprint progress"
  sections={[
    { key: "terminado", label: "Done", value: 45, tone: "success" },
    { key: "revision", label: "In review", value: 20, tone: "accent" },
  ]}
  max={100}
  size="lg"
  legend
/>
</Card>

Props

Import it with import { RingProgress } from '@amset/ui'. Required props are marked.

PropTypeWhat it does
labelrequiredstringWhat is being measured. Required: a ring without a name does not inform.
sectionsrequiredreadonly RingSection[]The sections, in order: `{ key, label, value, tone? }`. With just one it is a circular progress.
centerReactNodeWhat goes in the middle hole: the big number, an icon. Without it, the percentage done.
classNamestringMerged with the library classes; it does not replace them.
format(value: number) => string—
legendbooleanShows underneath the legend with the colour, name and value of each section. The screen reader already has the table.
maxnumberWhat the full ring is worth. Without it, the sum of the sections.
size"sm" | "md" | "lg"—
targetnumberA mark on the ring, in the same units as `max`: what is expected to have been reached.

It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.

CSS variables

These CSS variables are how you adapt it. Declare them on the component's selector, not on :root: the stylesheet redeclares them in the rule itself, and a declaration on the same element always wins.

VariableDefault
--amset-ringprogress-size7.5rem
--amset-ringprogress-thickness3.2
--amset-ringprogress-trackvar(--amset-border)

How to change it

.amset-ringprogress {
  --amset-ringprogress-size: ...;
  --amset-ringprogress-thickness: ...;
}

In the test bench

Every state and variant, to try one at a time, on its page at storybook.amsetui.com: