Meter
● Stable · v0.1A labelled horizontal progress bar for "how far toward a target" — revenue vs goal, spend vs budget, savings vs plan. A label, an optional readout, and a fill the user reads in a glance without doing the maths.
In context
Purpose
Meter turns a target into a picture. A shop owner shouldn't have to divide ฿8,900 by ฿9,000 to feel "almost there" — the bar says it. Stack a few for a week's targets; the shapes compare at a glance.
Anatomy
- Label — what's being measured ("Revenue").
- Readout (optional) — the numbers ("฿8,900 of ฿9,000").
- Bar — a track with a fill,
progress0–1 (clamps). - Dot (optional) — a legend dot when several meters share a key.
- Caption (optional) — a plain-words read ("Comfortably in surplus").
Variants
- Default — teal fill toward a goal.
met— tints the readout in the bar colour to signal the target is hit.- Custom
color— e.g. an amber spend meter.
Code
import { Meter } from '@daytwo/components'<Meter label="Revenue" value="฿8,900 of ฿9,000" progress={0.99} caption="Almost there" /><Meter label="Surplus" value="฿2,800 of ฿2,200" progress={1} met />
When to use
- Target vs actual on a Progress/targets screen.
- A budget or savings bar where the ratio is the point.
When NOT to use
- A single circular score — use a ProgressRing.
- A trend over time — use a chart, not a bar.
- A yes/no state — use a StatusLabel.
Good vs bad
- Good: three stacked meters for the week — revenue, expenses (amber), surplus (met) — the owner sees the whole week's health in one look.
- Bad: a meter with no label or readout and a mystery fill — a bar with no numbers is decoration; the user can't act on it.
Edge cases
Over target
progress clamps at 1; use met to mark it
WhyBeating a goal shouldn't overflow the bar
Zero progress
Empty track renders cleanly
WhyA fresh target starts at 0
Long Burmese/Thai label
Label wraps; bar keeps full width below
WhyMY/TH expand — the readout must not squeeze the bar
Dark mode
Track/fill follow the theme
WhyThe ratio must stay legible in both schemes
Numbers make the bar honest
A fill without a label or readout can't be acted on. Give a meter at least a label; give it a readout when the exact figures matter.
Tokens used
color.brand.primarycolor.background.tertiarycolor.text.primarycolor.text.secondaryradius.pilltypography.subhead