scoreMeter Renderer
renderAs: 'scoreMeter' renders a bounded 0–100 score as a filled meter bar with a semantic band chip. Define bands to map score ranges to labels and colors — the chip auto-selects the matching band.
Core Examples
Basic Score Meter with Bands
Health score with three bands: Critical (score < 35), Watch (35–64), Healthy (65+).
export const healthBands = [
{ max: 35, label: 'Critical', color: '#dc2626', background: '#fee2e2' },
{ max: 65, label: 'Watch', color: '#d97706', background: '#fef9c3' },
{ label: 'Healthy', color: '#16a34a', background: '#dcfce7' },
];
{
key: 'score',
renderAs: 'scoreMeter',
renderAsOptions: { showValue: true, bands: healthBands },
}
Compact Density with Multiple Meters
density: 'compact' reduces the bar height and minimum width — useful when displaying several meter columns side by side.
Health and Risk meters side by side in compact density.
{ key: 'score', renderAs: 'scoreMeter', renderAsOptions: { showValue: true, bands: healthBands, density: 'compact' } },
{ key: 'risk', renderAs: 'scoreMeter', renderAsOptions: { showValue: true, bands: riskBands, density: 'compact' } },
Tag and Value Alignment
Control where the band chip and numeric value are placed relative to the bar.
Chip positioned below-right, value left with a % suffix.
{
key: 'confidence',
renderAs: 'scoreMeter',
renderAsOptions: {
showValue: true,
valueAsPercent: true,
tagPosition: 'bottom',
tagAlign: 'right',
valueAlign: 'left',
bands: healthBands,
},
}
Options Reference
| Option | Type | Default | Effect |
|---|---|---|---|
bands | ScoreBand[] | built-in 4-band palette | Ordered band definitions. Evaluated top-to-bottom; the first matching band wins. |
density | 'regular' | 'compact' | 'regular' | 'compact' reduces bar height (6px) and minimum width (92px). |
showValue | boolean | true | Show the numeric score value next to the bar. |
valueAsPercent | boolean | false | Append % to the displayed value. |
decimals | number | 0 | Decimal places for the displayed value (clamped 0–6). |
tagPosition | 'top' | 'bottom' | 'top' | Band chip position relative to the bar. |
tagAlign | 'left' | 'right' | 'left' | Horizontal alignment of the band chip. |
valueAlign | 'left' | 'right' | 'right' | Horizontal alignment of the numeric value. |
className | string | unset | Additional CSS class on the root element. |
ScoreBand shape
{
min?: number; // inclusive lower bound — score >= min
max?: number; // exclusive upper bound for non-last bands — score < max
// for the last band max is inclusive (acts as a hard cap)
label?: string; // chip label text (default: 'State')
color?: string; // used for BOTH chip text AND meter bar fill (default: '#4a5568')
background?: string; // chip background color (default: semi-transparent grey)
}
:::caution color is used for both chip text and meter bar fill
color drives two visual roles: the text inside the band chip and the filled portion of the meter bar. Choose a mid-to-dark tone that reads clearly in both contexts. Avoid very light colors (e.g. #ffffff) — they produce an invisible meter fill on light backgrounds. Use background for the chip's background tint and keep color as the shared accent.
:::
Default bands (when bands is omitted)
| Score range | Label | Color |
|---|---|---|
| ≥ 85 | High | #2b6cb0 (blue) |
| ≥ 70 | Good | #2f855a (green) |
| ≥ 55 | Medium | #c05621 (orange) |
| catch-all | Low | #c53030 (red) |
Caveats
- Scores are clamped to
[0, 100]. Values outside this range are clamped silently, not rejected. - Non-numeric values render the plain text
Invalidwith no color applied. - Band matching iterates top-to-bottom; the first band where both
minandmaxconditions pass wins. For non-last bands,maxis an exclusive upper bound (score < max) — a score exactly equal tomaxfalls into the next band. For the last band,maxbecomes inclusive.minis always inclusive (score >= min). colordual role:colorsets both the chip text color and the meter bar fill. If nobandsare provided, the built-in palette is used.decimalsis clamped to[0, 6].formattercan pre-process the value before rendering — useful to normalise values that arrive outside the 0–100 range.
See Also
- progress Renderer — simple filled bar without bands
- rating Renderer — discrete icon-based scores
- number Field Type
- Field Config