Components
BaseSegmentBar
A proportional bar of coloured segments, with an optional neutral track for the rest of a total.
components/ui/BaseSegmentBar.vue
View in the demo
Example
Documents 32 GB Images 21 GB Videos 14 GB
Without total the segments fill the bar, as in revenue by country or balance by account; pair it with a BaseLegend (or a list in the same colours) so the colours have names. With total the rest stays as a neutral track, as in storage or seats. Give each segment a label and the bar describes itself to screen readers.
API
Props
Name | Type | Default | Description |
|---|---|---|---|
segmentsrequired | BaseSegmentBarItem[] | — | Each { id, value, color, label? }. Zero values are hidden. |
total | number | — | A total larger than the sum leaves a neutral track, as in storage or seats. |
height | number | 8 | The bar height. |
gap | number | 1 | Space between segments in spacing units (1 = 4px, 0 joins them). |
min-width | number | 6 | Minimum width so small segments stay visible. |
label | string | — | The accessible name. Without it the bar reads each segment label with its share, such as “Desktop 54%”. |