MazProgressBar
MazProgressBar is a linear bar showing the progress of a task or a measure in a known range, with a single value or stacked colored segments (a distribution), and an accessible label and value text.
Before use it, you should install the MazUi plugin in your project, follow instructions in Getting Started
Basic usage
value goes from 0 to max (default 100). The bar takes the full width of its container, the filled part animates when the value changes.
<script lang="ts" setup>
import MazProgressBar from 'maz-ui/components/MazProgressBar'
import { ref } from 'vue'
const progress = ref(40)
</script>
<template>
<MazProgressBar :value="progress" label="Upload" />
</template>Max
With max, value is on its scale: 3 of 5 steps.
<MazProgressBar :value="3" :max="5" label="Onboarding" value-text="3 of 5 steps" />Colors
<MazProgressBar :value="65" color="primary" label="primary" />
<MazProgressBar :value="65" color="secondary" label="secondary" />
<MazProgressBar :value="65" color="accent" label="accent" />
<MazProgressBar :value="65" color="info" label="info" />
<MazProgressBar :value="65" color="success" label="success" />
<MazProgressBar :value="65" color="warning" label="warning" />
<MazProgressBar :value="65" color="destructive" label="destructive" />
<MazProgressBar :value="65" color="contrast" label="contrast" />Sizes and rounded
size sets the thickness (default sm), rounded-size the rounded of the bar (default full).
<MazProgressBar :value="50" size="mini" label="mini" />
<MazProgressBar :value="50" size="xs" label="xs" />
<MazProgressBar :value="50" size="sm" label="sm" />
<MazProgressBar :value="50" size="md" label="md" />
<MazProgressBar :value="50" size="lg" label="lg" />
<MazProgressBar :value="50" size="xl" label="xl" />
<MazProgressBar :value="50" size="xl" rounded-size="none" label="xl, no rounded" />
<MazProgressBar :value="50" size="xl" rounded-size="md" label="xl, rounded md" />Segments
segments stacks several values in one bar, each with its own color: a distribution (dependencies to update by kind of update, tests by status). Without max, their sum fills the bar; with max, the rest stays empty. gap leaves a small space between the segments.
The label of the segments is read in the accessible value of the bar ("12 patch, 5 minor, 2 major").
<script lang="ts" setup>
import type { MazProgressBarSegment } from 'maz-ui/components/MazProgressBar'
import MazProgressBar from 'maz-ui/components/MazProgressBar'
const updates: MazProgressBarSegment[] = [
{ value: 12, color: 'success', label: 'patch' },
{ value: 5, color: 'warning', label: 'minor' },
{ value: 2, color: 'destructive', label: 'major' },
]
</script>
<template>
<MazProgressBar :segments="updates" size="md" gap label="Updates" />
<MazProgressBar :segments="updates" :max="30" size="md" gap label="Updates out of 30 dependencies" />
</template>Accessibility
roleisprogressbarby default, for the progress of a task. Usemeterfor a measure in a known range that is not a progress (disk usage, projects up to date).labelgives the accessible name of the bar: always set it (oraria-labelledby) when no visible text names the bar.value-textreplaces the number read by the screen readers ("3 of 5 steps"). With labelledsegments, the value text lists them.
<MazProgressBar role="meter" :value="72" label="Disk usage" value-text="72 GB of 100 GB" color="warning" />Props
| Name | Description | Type | Required | Default | Possible values |
|---|---|---|---|---|---|
| value | Current value, between 0 and max (ignored with segments) | number | No | 0 | - |
| max | Value of a full bar. With segments and without max, their sum fills the bar | number | No | 100 | - |
| segments | Stacked segments (a distribution: 12 patch, 5 minor, 2 major) instead of a single value | MazProgressBarSegment[] | No | - | - |
| color | Color of the bar (and of the segments without their own color) | "primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | No | "primary" | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'destructive' | 'contrast' |
| size | Thickness of the bar | "xs" | "sm" | "md" | "lg" | "xl" | "mini" | No | "sm" | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'mini' |
| rounded-size | Size of the rounded of the bar | "sm" | "md" | "none" | "full" | No | "full" | 'sm' | 'md' | 'none' | 'full' |
| gap | Leave a small gap between the segments | boolean | No | false | - |
| role | Semantic of the bar: progressbar for the progress of a task, meter for a measure in a known range (disk usage, projects up to date) | "meter" | "progressbar" | No | "progressbar" | 'meter' | 'progressbar' |
| label | Accessible name of the bar | string | No | - | - |
| value-text | Accessible text of the value ("3 of 5 projects"), instead of the number | string | No | - | - |