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.
centerchanges what goes in the hole; without it, the percentage done.legendshows underneath the colour, name and value of each section: with several sections, colour alone does not say which is which.targetputs a mark on the ring, in the same units asmax: 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
| Part | Value |
|---|---|
| Done | 45 |
| In review | 20 |
Aurelia order
Workshop · due on the 20th
| Part | Value |
|---|---|
| Order packed | 90 |
<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.
| Prop | Type | What it does |
|---|---|---|
labelrequired | string | What is being measured. Required: a ring without a name does not inform. |
sectionsrequired | readonly RingSection[] | The sections, in order: `{ key, label, value, tone? }`. With just one it is a circular progress. |
center | ReactNode | What goes in the middle hole: the big number, an icon. Without it, the percentage done. |
className | string | Merged with the library classes; it does not replace them. |
format | (value: number) => string | — |
legend | boolean | Shows underneath the legend with the colour, name and value of each section. The screen reader already has the table. |
max | number | What the full ring is worth. Without it, the sum of the sections. |
size | "sm" | "md" | "lg" | — |
target | number | A 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.
| Variable | Default |
|---|---|
--amset-ringprogress-size | 7.5rem |
--amset-ringprogress-thickness | 3.2 |
--amset-ringprogress-track | var(--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:
