Notes
Progress mode
There are three basic modes of the progress bar:
indeterminate
is the simplest that shows progress continously until disabled (similar to loaders or spinners)default
shows the progress from the 0
to the value of the max
prop. The current value is stored in the value
proptimer
shows progress of the time defined in the timer
prop
The progress can be changed to indeterminate
at any time when using other modes. See the example below.
Example - props
<template>
<v-progress v-bind="example"></v-progress>
<v-progress
v-bind="example"
mod-progress="shape:square"
mod-progress-bar="variant:red shape:square"
class="mt-4"
>
<template #label="{ value, max }">
<span
class="absolute left-1/2 -translate-x-1/2 text-xs font-bold text-white"
>
{{ value.toFixed() }} / {{ max }}
</span>
</template>
</v-progress>
<v-progress
v-bind="example"
mod-progress="size:tiny"
mod-progress-bar="variant:gradient"
class="mt-4"
></v-progress>
<v-progress
mod-progress="size:tiny variant:transparent"
mod-progress-bar="variant:gradient"
:value="example.value"
:label="false"
:transition="example.transition"
class="fixed left-0 top-0 z-50 w-full"
></v-progress>
</template>
<script setup>
import { reactive } from "vue";
let example = reactive({
value: 20,
max: 100,
label: false,
precision: 2,
transition: true,
});
</script>
Example - indeterminate
Combined indeterminate and deteminate example
<template>
<v-progress
mod-progress="size:tiny"
mod-progress-bar="variant:gradient"
indeterminate
class="my-8"
></v-progress>
<v-card width="400px">
<div class="flex justify-center p-4">Checking for updates...</div>
<v-progress
mod-progress="size:tiny"
mod-progress-bar="variant:gradient"
indeterminate
class="m-2"
></v-progress>
</v-card>
<div class="my-6">Combined indeterminate and deteminate example</div>
<v-card width="400px">
<div class="flex justify-center p-4">
<span v-if="example.indeterminate">Checking for updates...</span>
<span v-if="!example.indeterminate">Updating...</span>
</div>
<v-progress
mod-progress="size:tiny"
mod-progress-bar="variant:gradient"
:value="example.value"
:label="false"
:indeterminate="example.indeterminate"
class="m-2"
></v-progress>
</v-card>
</template>
<script setup>
import { reactive, onMounted } from "vue";
let example = reactive({
value: 0,
label: false,
indeterminate: true,
});
onMounted(() => {
setInterval(() => {
example.indeterminate = !example.indeterminate;
if (example.indeterminate) return
example.value = 0;
let i = setInterval(() => {
example.value += 0.2;
if (example.value >= 100) {
clearInterval(i);
}
}, 10);
}, 3000);
});
</script>
Example - indeterminate custom animations
<template>
<v-progress
mod-progress="size:tiny width:long easing:inOut speed:fast"
mod-progress-bar="variant:gradient"
indeterminate
class="my-8"
></v-progress>
</template>
Example - timer progress
<template>
<v-progress
:timer="4000"
autostart-timer
mod-progress="size:medium shape:square"
mod-progress-bar="shape:square"
></v-progress>
</template>
<script setup>
import { reactive, ref } from "vue";
</script>