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

Chart parts

The legend, the sparkline, number and stat card variants, the center-value gauge and the five chart tokens.

Gauge with a count-up center

A notched radial meter that counts up its center value.

Ring chart and Legend

Concentric rings with a legend that hovers in step, progress bars included.

  • Organic 4,25085%
  • Paid 3,12062%
  • Email 2,10042%
  • Social 1,58032%

Legend on its own

Progress bars, percentages, hover dim and keyboard focus.

Traffic by channel

  • Organic 4,25085%
  • Paid 3,12062%
  • Email 2,10042%
  • Social 1,58032%

Sparkline

A trendline the width of whatever holds it.

showLast: end-cap dot and inline value

0 to 23. v: first 50, last 33.491, low 30.822, high 76.186.

Sparkline
iv
050
166.589
270.829
370.95
476.186
566.969
654.822
751.984
840.864
933.449
1030.822
1142.889
1248.412
1355.302
1471.14
1573.76
1671.787
1774.97
1864.242
1951.497
2039.12
2139.406
2234
2333.491
33.491

bare: no chrome, for the foot of a card that links

Chart tokens

Theme charts globally with five CSS custom properties.

--chart-1
--chart-2
--chart-3
--chart-4
--chart-5

Number chart

A figure on its own, with or without a scale under it.

size=lg: count-up, direction-aware delta

Total cash

$128,400 up 6%

across 4 accounts

share: the scale a lone number can't carry

Expenses

$41,250 down 3%

38% of revenue

bare: no chrome, for a figure inside a band or a panel

Net income

$67,150

62% of revenue

Stat card

A figure over a chart, on a card: three chart kinds, a gauge form and a bare chart.

variant=area: edge-to-edge chart, trend pill, count-up value

Total Revenue +12.4%
$8,200 Avg

variant=line: denser series

Active sessions +8.2%
1,344 Avg

variant=bar: negative trend, down state

Refunds -2.8%
$3,500 vs last month

variant=gauge: figure left, radial gauge right

Deliverables +5%
2 of 6 complete

figureOnly: the bare edge-to-edge chart, no labels

Installation

pnpm add @heyramzi/ui

Usage

import {
  GaugeChart,
  Legend,
  NumberChart,
  RingChart,
  Sparkline,
  StatCard,
} from "@heyramzi/ui/charts";

Keyboard and accessibility

  • A Legend is a list of each row's label and value. Its rows take no focus, and hovering one highlights its series.

API reference

items required LegendItem[]
title string
layout "vertical" | "horizontal"
Default "vertical"
Stacked rows vs inline wrap.
showProgress boolean
Default false
Render a progress bar under each row (needs maxValue).
showValue boolean
Default true
Show the value beside each label.
showPercentage boolean
Default false
Append a percentage (needs maxValue).
formatValue (v: number) => string
Default (v) => v.toLocaleString()
formatPercentage (p: number) => string
Default (p) => `${p.toFixed(0)}%`
hoveredIndex bindable number | null
Default null
Hovered index, bindable for chart hover-sync.
onHoveredIndexChange (index: number | null) => void
class string
Prop Type Default
items required LegendItem[]
title string
layout

Stacked rows vs inline wrap.

"vertical" | "horizontal" "vertical"
showProgress

Render a progress bar under each row (needs maxValue).

boolean false
showValue

Show the value beside each label.

boolean true
showPercentage

Append a percentage (needs maxValue).

boolean false
formatValue (v: number) => string (v) => v.toLocaleString()
formatPercentage (p: number) => string (p) => `${p.toFixed(0)}%`
hoveredIndex bindable

Hovered index, bindable for chart hover-sync.

number | null null
onHoveredIndexChange (index: number | null) => void
class string