Meter group
VMeterGroup shows how a total breaks down: several readings sharing one range, drawn as the parts of a single bar with a legend.
Usage
- Documents 25%
- Photos 19%
- Apps 14%
- System 9%
Examples
Colours
Each item takes a tone or a color. Without either, its hue is derived from its position, starting from the accent, and follows the theme. An icon replaces the legend swatch.
- Rent 40%
- Food 20%
- Transport 10%
- Savings 15%
- Leisure 8%
Values
showValue writes the sum after the label. The sum and every amount are percentages of max by default; formatOptions formats them for the current locale, and valueText replaces the sum.
- Documents 32 GB
- Photos 24 GB
- Apps 18 GB
- System 12 GB
Overflow
When the amounts add up to more than max, the parts share the whole bar in proportion. The legend keeps their real amounts.
- Documents 50%
- Photos 38%
- Apps 28%
- System 19%
Slots
The value slot replaces the sum. item-leading, item-label and item-value replace a legend row’s swatch, label and amount.
- Documents 32 GB
- Photos 24 GB
- Apps 18 GB
- System 12 GB
Sizes
size sets the thickness of the bar, from 2 to 20 pixels, on the same scale as VMeter. hideLegend hides the legend visually; screen readers still read it.
- Documents 25%
- Photos 19%
- Apps 14%
- System 9%
- Documents 25%
- Photos 19%
- Apps 14%
- System 9%
- Documents 25%
- Photos 19%
- Apps 14%
- System 9%
- Documents 25%
- Photos 19%
- Apps 14%
- System 9%
- Documents 25%
- Photos 19%
- Apps 14%
- System 9%
Orientation
orientation="vertical" fills from the bottom up and puts the legend beside the bar. Set a height to control the bar’s length.
- Documents 25%
- Photos 19%
- Apps 14%
- System 9%
API
Props
| Prop | Type | Default |
|---|---|---|
items | MeterGroupItem[] | [] |
| Parts, in the order they fill the bar. | ||
max | number | 100 |
| Total the amounts are measured against. Parts share the bar in proportion when they exceed it. | ||
label | string | none |
| What is measured, shown above the bar and naming the group. Uses the dictionary by default; ARIA naming attributes take precedence. | ||
hideLabel | boolean | false |
| Hides the label visually. Screen readers still read it. | ||
showValue | boolean | false |
| Writes the sum of the amounts after the label. | ||
valueText | string | none |
| Text replacing the formatted sum. | ||
formatOptions | Intl.NumberFormatOptions | none |
Intl.NumberFormat options formatting the sum and every amount. | ||
hideLegend | boolean | false |
| Hides the legend visually. Screen readers still read it. | ||
size | MeterGroupSize'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
| Bar thickness. | ||
orientation | MeterGroupOrientation'horizontal' | 'vertical' | 'horizontal' |
| Horizontal or vertical bar. Vertical fills from bottom to top, the legend beside it. | ||
Slots
| Slot | Type |
|---|---|
value | MeterGroupValueSlotProps |
Content replacing the sum. Receives value, max and percent. | |
item-leading | MeterGroupItemSlotProps |
Decorative content replacing a row’s swatch or icon. Receives item, index and percent. | |
item-label | MeterGroupItemSlotProps |
Content replacing a row’s label. Receives item, index and percent. | |
item-value | MeterGroupItemSlotProps |
Content replacing a row’s amount. Receives item, index and percent. | |
Types
Types used in the API tables. Import exported types from vectis-ui.
export interface BuiltinIcon {
name: string
paths: readonly [string] | readonly [string, string]
}export type IconRender =
| { path: string; viewBox?: string }
| { component: Component; props?: Record<string, unknown> }
| { src: string }
| { text: string; class?: string }
| { class: string }export type IconSource = string | BuiltinIcon | IconRender
export interface MeterGroupItem {
label: string
value: number
tone?: MeterGroupTone
color?: string
icon?: IconSource
}export interface MeterGroupItemSlotProps {
item: MeterGroupItem
index: number
percent: number
}export type MeterGroupTone = 'accent' | 'neutral' | 'success' | 'warning' | 'danger'
export interface MeterGroupValueSlotProps {
value: number
max: number
percent: number
}CSS variables
| Token | Value |
|---|---|
--vectis-control-size-bar-thickness-xs | 0.125rem |
--vectis-control-size-bar-thickness-sm | 0.25rem |
--vectis-control-size-bar-thickness-md | 0.5rem |
--vectis-control-size-bar-thickness-lg | 0.75rem |
--vectis-control-size-bar-thickness-xl | 1.25rem |
--vectis-control-size-bar-length | 10rem |
--vectis-control-size-meter-group-swatch | 0.5rem |
--vectis-control-size-meter-segment-gap | 0.125rem |