Stacked composition bar with a legend for parts of one whole: aging buckets, budget mix, seat usage. Segment widths follow value, the legend and assistive tech read display, and colors walk the brand viz ramp, as a chart's series do; the accent is a flag a segment asks for through its color. Pass segments and totalLabel as properties.
Each segment renders as role="img" named "label display", so the bar reads as four figures rather than one silent graphic; the legend repeats the same figures as text. Money arrives pre-formatted in display, with two decimals and thousands separators.
// setup(root): properties and events
setup(root) {
const meter = root.querySelector('sui-meter-group');
meter.totalLabel = agingTotal;
meter.segments = aging();
}
Colors and the flag
With no colors given, segments walk the brand ramp, as a chart's series do, and never take the accent. Pin one with color when a bucket needs attention; the accent is the one flag, so use it once per bar.
orientation="vertical" stands the bar up to the height you give the host, stacks the segments top to bottom in legend order, and moves the total and legend beside it. height is then the bar's width.
Bar thickness in px: its height when horizontal, its width when vertical. The bar is a pill (radius = thickness / 2).
hideLegend
hide-legend
boolean
false
Drops the legend, which stands under the bar (beside it when vertical), for a bar whose parts the page names elsewhere. Each segment keeps its own name for assistive tech. Reflected.
orientation
orientation
"horizontal" | "vertical"
'horizontal'
Which way the bar runs. horizontal (default) is the pill across the card with the legend under it. vertical stands the bar up as a column that fills the height of the element or of its parent (give one of them a height, e.g. style="height:180px"; 120px is the floor), stacks the segments top to bottom in legend order, and puts the total and the legend beside it. An unrecognised value falls back to horizontal.
segments
property only
SuiMeterSegment[]
[]
Segments: { label, value, display?, color? }[]. Property, not attribute. display is the formatted figure for the legend and for assistive tech, so money arrives pre-formatted with two decimals and thousands separators; without it the legend prints value grouped in the page's locale (1,250, 1.250). Each segment renders as role="img" named "label display". color pins a segment, for example var(--accent) on the bucket that needs attention; use the flag once per bar.
totalLabel
property only
SuiMeterTotalSuiMeterTotal | undefined
Header row: { label, value }, e.g. { label: 'Storage', value: '42 GB used' }. Property, not attribute.
Types
SuiMeterSegmentinterface
label
string
value
number
display?
string
color?
string
SuiMeterTotalinterface
label
string
value
string
Theming
Every design token this element can render with, read from its own stylesheets and the ones it imports. Set a token on :root or on any ancestor and every use below follows it. The values shown are the ones in the theme you are viewing. The list is read per stylesheet, so an element that imports a shared drawing module lists that module's tokens too, whether or not it paints with all of them.