Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz.
With a label and a count
The label names the bar (aria-labelledby); the count beside it says the same in words.
Importing products640 of 1,000
ProgressLabeled.vue
<script setup lang="ts">
import { Progress } from '@/components/ui/progress'
const done = 640
const total = 1000
</script>
<template>
<div class="flex w-full max-w-120 flex-col gap-(--bh-space-100)">
<div class="flex items-baseline justify-between gap-(--bh-space-200)">
<span id="import-label" class="text-(--bh-color-text) [font:var(--bh-font-label-default)]">Importing products</span>
<span class="text-(--bh-color-text-subtle) [font:var(--bh-font-body-small)] tabular-nums">{{ done.toLocaleString('en') }} of {{ total.toLocaleString('en') }}</span>
</div>
<Progress :model-value="done / total * 100" aria-labelledby="import-label" />
</div>
</template>A running task
The fill moves with motion.indicator. A status line says when the task starts and ends, not every step.
ProgressRunning.vue
<script setup lang="ts">
import { onBeforeUnmount, ref } from 'vue'
import { Button } from '@/components/ui/button'
import { Progress } from '@/components/ui/progress'
const value = ref(0)
const running = ref(false)
let timer: ReturnType<typeof setInterval> | undefined
function start() {
value.value = 0
running.value = true
clearInterval(timer)
timer = setInterval(() => {
value.value = Math.min(100, value.value + 10)
if (value.value === 100) {
clearInterval(timer)
running.value = false
}
}, 400)
}
onBeforeUnmount(() => clearInterval(timer))
</script>
<template>
<div class="flex w-full max-w-120 flex-col gap-(--bh-space-150)">
<Progress :model-value="value" aria-label="Stock sync progress" />
<div class="flex items-center gap-(--bh-space-150)">
<Button variant="outline" size="sm" :aria-disabled="running || undefined" @click="start">Sync stock</Button>
<!-- Says the state in words, for screen readers and for people who can't see the bar move. -->
<span role="status" class="text-(--bh-color-text-subtle) [font:var(--bh-font-body-small)]">
{{ running ? 'Syncing…' : value === 100 ? 'Stock synced' : '' }}
</span>
</div>
</div>
</template>