Skip to content
EspañolEnglish
All components (283)

Radial bars

Data · RadialBarChart · .amset-radialbar

What it is and when to use it

Several measures against the same ceiling, each in its own ring: how much of each goal is done, the use of each quota. Unlike a split ring, each ring fills on its own and they are compared by how close they are to going all the way round.

When to use it

  • Several measures of the same kind with the same ceiling (quarter goals, plan quotas).
  • items are the rings, the first one outermost: { key, label, value, tone? }. max says what a full ring is worth; without it, the largest value.

When not to

  • Parts of a total that add up to everything: DonutChart.
  • A single measure: RingProgress.
  • Comparing values precisely: BarChart.

Keyboard: Tab goes to the drawing and the arrows move from ring to ring, with a spoken notice.

Accessibility: it is an image (role="img") with a written summary and underneath goes a real table. Each ring has its name, its value and its percentage written out in the legend.

Fine-tuning: --amset-radialbar-size is the diameter, --amset-radialbar-thickness the thickness (in drawing units, out of 100) and --amset-radialbar-track the colour of the background.

What it looks like

Use the arrow keys to move through the values, Home and End to jump to the first and last, and Escape to leave.
Quarter goals
PartValueShare of total
Sales8282%
Sign-ups6464%
Tickets4141%
NPS2727%

<RadialBarChart
  label="Quarter goals"
  items={[
    { key: "ventas", label: "Sales", value: 82 },
    { key: "altas", label: "Sign-ups", value: 64 },
    { key: "tickets", label: "Tickets", value: 41 },
  ]}
  max={100}
/>

Props

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

PropTypeWhat it does
itemsrequiredreadonly WaffleItem[]The rings, the first one outermost: `{ key, label, value, tone? }`.
labelrequiredstringWhat is being measured. Required: a chart without a title tells nothing.
classNamestringMerged with the library classes; it does not replace them.
errorReactNode—
format(value: number) => string—
loadingboolean—
maxnumberWhat a full ring is worth. Without it, the largest value.
tableVisibleboolean—

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-radialbar-size14rem
--amset-radialbar-thickness5
--amset-radialbar-trackvar(--amset-border)

How to change it

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

In the test bench

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