Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Ring chart

Concentric progress rings with a hover glow and a counting center value.

Installation

pnpm add @heyramzi/ui

Usage

import { RingChart } from "@heyramzi/ui/charts";
<RingChart
  data={[{ label: "Move", value: 520, maxValue: 600, color: "var(--chart-4)" }]}
  size={240}
  defaultLabel="Today"
/>

Keyboard and accessibility

  • The chart is an image named "Total" and the sum, unless you pass ariaLabel. The rings aren't in the name.
  • With reduced motion on, the rings show without sweeping in.

API reference

data required RingData[]
size number
Fixed square size in px. Omit to fill the parent (responsive).
strokeWidth number
Default 11
Ring thickness in viewBox units.
ringGap number
Default 6
Gap between concentric rings in viewBox units.
baseInnerRadius number
Default 48
Inner radius of the innermost ring in viewBox units.
lineCap "round" | "butt"
Default "round"
defaultLabel string
Default "Total"
Center label when nothing is hovered.
formatValue (v: number) => string
Default (v) => v.toLocaleString()
animate boolean
Default true
Animate arcs on mount.
showGlow boolean
Default true
Glow the hovered ring.
hoveredIndex bindable number | null
Default null
Hovered ring index, bindable for legend hover-sync.
onHoveredIndexChange (index: number | null) => void
minWidth number
Default 170
ariaLabel string
children Snippet
Replaces the center readout, for a number that isn't the ring's own value.
class string
Prop Type Default
data required RingData[]
size

Fixed square size in px. Omit to fill the parent (responsive).

number
strokeWidth

Ring thickness in viewBox units.

number 11
ringGap

Gap between concentric rings in viewBox units.

number 6
baseInnerRadius

Inner radius of the innermost ring in viewBox units.

number 48
lineCap "round" | "butt" "round"
defaultLabel

Center label when nothing is hovered.

string "Total"
formatValue (v: number) => string (v) => v.toLocaleString()
animate

Animate arcs on mount.

boolean true
showGlow

Glow the hovered ring.

boolean true
hoveredIndex bindable

Hovered ring index, bindable for legend hover-sync.

number | null null
onHoveredIndexChange (index: number | null) => void
minWidth number 170
ariaLabel string
children

Replaces the center readout, for a number that isn't the ring's own value.

Snippet
class string