Vitral 0.2
Messages

ProgressBar

How far along a task is, as a thin bar, with a value or indeterminate.

Import

main.ts
import { ProgressBar } from '@vitral/vue';

Determinate

Uploading photos
35%
<script setup lang="ts">import { Button, ProgressBar, StackPanel } from '@vitral/vue';import { onBeforeUnmount, ref } from 'vue'; const value = ref(35);let timer: ReturnType<typeof setInterval> | undefined; function run() {    clearInterval(timer);    value.value = 0;    timer = setInterval(() => {        value.value = Math.min(100, value.value + Math.round(Math.random() * 12));        if (value.value >= 100) clearInterval(timer);    }, 300);} onBeforeUnmount(() => clearInterval(timer));</script> <template>    <StackPanel orientation="horizontal" spacing="0.75rem" align="start" wrap>        <StackPanel spacing="0.375rem" style="width: 24rem">            <span id="pb-upload">Uploading photos</span>            <ProgressBar :value="value" aria-labelledby="pb-upload" />        </StackPanel>        <Button label="Run" icon="refresh" severity="secondary" size="small" @click="run" />    </StackPanel></template>

Label

`unit` follows the value and becomes its spoken text; `show-value` off hides it; the slot replaces it.

Copying files
64 of 100 files
No label
<script setup lang="ts">import { ProgressBar, StackPanel } from '@vitral/vue';</script> <template>    <StackPanel orientation="horizontal" spacing="0.75rem" align="start" wrap>        <StackPanel spacing="0.375rem" style="width: 24rem">            <span id="pb-files">Copying files</span>            <ProgressBar :value="64" unit=" of 100 files" aria-labelledby="pb-files" />        </StackPanel>        <StackPanel spacing="0.375rem" style="width: 24rem">            <span id="pb-quiet">No label</span>            <ProgressBar :value="80" :show-value="false" aria-labelledby="pb-quiet" />        </StackPanel>    </StackPanel></template>

Indeterminate

Work of unknown length; no value is announced.

Connecting…
<script setup lang="ts">import { ProgressBar, StackPanel } from '@vitral/vue';</script> <template>    <StackPanel spacing="0.375rem" style="width: 24rem">        <span id="pb-connect">Connecting…</span>        <ProgressBar mode="indeterminate" aria-labelledby="pb-connect" />    </StackPanel></template>

API

Read from packages/vue/src/components/ProgressBar/types.ts, so it says what the component actually accepts.

Props

NameTypeDescription
valuenumber0–100.
mode'determinate' | 'indeterminate'`'determinate'` (the default) or `'indeterminate'`, for work of unknown length.
showValuebooleanShow the value beside the bar. Defaults to true.
unitstringFollows the value in the label. Defaults to `'%'`.

Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.

Slots

NameSlot propsDescription
default(props: { value: number })Replaces the value label.