---
title: "MazProgressBar"
description: "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."
package: "maz-ui"
url: "https://maz-ui.com/components/maz-progress-bar"
---

# 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.

- Package: `maz-ui`
- Import: `import MazProgressBar from 'maz-ui/components/MazProgressBar'`
- Nuxt: auto-imported by `@maz-ui/nuxt`, no import needed in a Nuxt app
- Web: https://maz-ui.com/components/maz-progress-bar

> Before use it, you should install the MazUi plugin in your project, follow instructions in [Getting Started](../guide/getting-started.md)

## 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.

```vue
<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.

```vue
<MazProgressBar :value="3" :max="5" label="Onboarding" value-text="3 of 5 steps" />
```

## Colors

```vue
<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`).

```vue
<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").

```vue
<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

- `role` is `progressbar` by default, for the progress of a task. Use `meter` for a measure in a known range that is not a progress (disk usage, projects up to date).
- `label` gives the accessible name of the bar: always set it (or `aria-labelledby`) when no visible text names the bar.
- `value-text` replaces the number read by the screen readers ("3 of 5 steps"). With labelled `segments`, the value text lists them.

```vue
<MazProgressBar role="meter" :value="72" label="Disk usage" value-text="72 GB of 100 GB" color="warning" />
```

## MazProgressBar API

`import MazProgressBar from 'maz-ui/components/MazProgressBar'`

### Props

- `value` (`number`, default: `0`): Current value, between 0 and `max` (ignored with `segments`).
- `max` (`number`, default: `100`): Value of a full bar. With `segments` and without `max`, their sum fills the bar.
- `segments` (`MazProgressBarSegment[]`): Stacked segments (a distribution: 12 patch, 5 minor, 2 major) instead of a single value.
- `color` (`"primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast"`, default: `"primary"`): Color of the bar (and of the segments without their own color).
- `size` (`"xs" | "sm" | "md" | "lg" | "xl" | "mini"`, default: `"sm"`): Thickness of the bar.
- `rounded-size` (`"sm" | "md" | "none" | "full"`, default: `"full"`): Size of the rounded of the bar.
- `gap` (`boolean`, default: `false`): Leave a small gap between the segments.
- `role` (`"meter" | "progressbar"`, default: `"progressbar"`): 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).
- `label` (`string`): Accessible name of the bar.
- `value-text` (`string`): Accessible text of the value ("3 of 5 projects"), instead of the number.
