Keyboard shortcut: Ctrl + K
Get started

Progress linear

VProgressLinear displays task progress as a bar, or an animation when progress cannot be measured.

Usage

vue
Upload
<script setup lang="ts">
import { VProgressLinear } from 'vectis-ui'
</script>

<template>
  <VProgressLinear :value="40" label="Upload" />
</template>

Examples

Value

Set value and max to report progress. Values are clamped to the range.

vue
Upload

value = 40, max = 100

7 of 12 files, max = 12
<script setup lang="ts">
import { ref } from 'vue'
import { VButton, VProgressLinear, VTypography } from 'vectis-ui'

const value = ref(40)
const step = (delta: number) => (value.value += delta)
</script>

<template>
  <div class="column">
    <VProgressLinear :value="value" label="Upload" show-value />

    <div class="row">
      <VButton variant="outline" tone="neutral" size="sm" @click="step(-25)">-25</VButton>
      <VButton variant="outline" tone="neutral" size="sm" @click="step(25)">+25</VButton>
      <VTypography variant="body-sm" tone="muted">value = {{ value }}, max = 100</VTypography>
    </div>

    <VProgressLinear :value="7" :max="12" label="7 of 12 files, max = 12" show-value />
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-5);
  max-inline-size: 28rem;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vectis-space-3);
}
</style>

Indeterminate

indeterminate animates the bar without a percentage. The animation slows under reduced motion.

vue
Waiting for the server
Loading

For a server that reports no percentage. Under reduced motion the bar is slowed rather than stopped: a motionless loader no longer says that anything is happening, which is the one thing it exists to say.

<script setup lang="ts">
import { VProgressLinear, VTypography } from 'vectis-ui'
</script>

<template>
  <div class="column">
    <VProgressLinear indeterminate label="Waiting for the server" />

    <VProgressLinear indeterminate tone="neutral" size="md" label="Loading" />

    <VTypography variant="body-sm" tone="muted">
      For a server that reports no percentage. Under reduced motion the bar is slowed rather than
      stopped: a motionless loader no longer says that anything is happening, which is the one thing
      it exists to say.
    </VTypography>
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-5);
  max-inline-size: 28rem;
}
</style>

Tones

tone sets the semantic colour.

vue

accent

Upload, accent

success

Upload, success

warning

Upload, warning

danger

Upload, danger

neutral

Upload, neutral
<script setup lang="ts">
import { VProgressLinear, VTypography, type ProgressLinearTone } from 'vectis-ui'

const TONES: ProgressLinearTone[] = ['accent', 'success', 'warning', 'danger', 'neutral']
</script>

<template>
  <div class="column">
    <div v-for="tone in TONES" :key="tone" class="row">
      <VTypography variant="caption" tone="muted" class="name">{{ tone }}</VTypography>
      <VProgressLinear :value="60" :tone="tone" :label="`Upload, ${tone}`" hide-label />
    </div>
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-4);
  max-inline-size: 28rem;
}
.row {
  display: grid;
  grid-template-columns: 5rem 1fr;
  align-items: center;
  gap: var(--vectis-space-4);
}
.name {
  text-align: end;
}
</style>

Custom colours

color overrides the tone with a CSS colour.

vue

A hex value

Upload, A hex value

A CSS colour name

Upload, A CSS colour name

An oklch() colour

Upload, An oklch() colour
<script setup lang="ts">
import { VProgressLinear, VTypography } from 'vectis-ui'

const COLORS = [
  { value: '#7c3aed', caption: 'A hex value' },
  { value: 'teal', caption: 'A CSS colour name' },
  { value: 'oklch(0.72 0.19 45)', caption: 'An oklch() colour' },
]
</script>

<template>
  <div class="column">
    <div v-for="colour in COLORS" :key="colour.value" class="row">
      <VTypography variant="caption" tone="muted" class="name">{{ colour.caption }}</VTypography>
      <VProgressLinear
        :value="60"
        :color="colour.value"
        :label="`Upload, ${colour.caption}`"
        hide-label
      />
    </div>
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-4);
  max-inline-size: 28rem;
}
.row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  align-items: center;
  gap: var(--vectis-space-4);
}
.name {
  text-align: end;
}
</style>

Sizes

size sets the thickness of the bar, from 2 to 20 pixels, on the same scale as VMeter. The bar fills its container’s width.

vue

xs

Upload, xs

sm

Upload, sm

md

Upload, md

lg

Upload, lg

xl

Upload, xl
<script setup lang="ts">
import { VProgressLinear, VTypography, type ProgressLinearSize } from 'vectis-ui'

const SIZES: ProgressLinearSize[] = ['xs', 'sm', 'md', 'lg', 'xl']
</script>

<template>
  <div class="column">
    <div v-for="size in SIZES" :key="size" class="row">
      <VTypography variant="caption" tone="muted" class="name">{{ size }}</VTypography>
      <VProgressLinear :value="60" :size="size" :label="`Upload, ${size}`" hide-label />
    </div>
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-4);
  max-inline-size: 28rem;
}
.row {
  display: grid;
  grid-template-columns: 4rem 1fr;
  align-items: center;
  gap: var(--vectis-space-4);
}
.name {
  text-align: end;
}
</style>

Shape

shape selects rounded or square stroke ends.

vue

rounded, the default

Upload, rounded

square

Upload, square
<script setup lang="ts">
import { VProgressLinear, VTypography } from 'vectis-ui'
</script>

<template>
  <div class="column">
    <div class="labelled">
      <VTypography variant="caption" tone="muted">rounded, the default</VTypography>
      <VProgressLinear :value="60" size="lg" label="Upload, rounded" hide-label />
    </div>

    <div class="labelled">
      <VTypography variant="caption" tone="muted">square</VTypography>
      <VProgressLinear :value="60" size="lg" shape="square" label="Upload, square" hide-label />
    </div>
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-5);
  max-inline-size: 28rem;
}
.labelled {
  display: grid;
  gap: var(--vectis-space-2);
}
</style>

Value position

showValue displays the percentage. valuePosition writes it after the label or inside the bar, which needs size="xl". The default slot receives value, max and percent. Inside the bar it renders twice: use non-interactive content without side effects.

vue
valuePosition header
valuePosition start
55%
valuePosition center
55%
valuePosition end
55%
A slot of your own
<script setup lang="ts">
import { VProgressLinear, type ProgressLinearValuePosition } from 'vectis-ui'

const POSITIONS: ProgressLinearValuePosition[] = ['header', 'start', 'center', 'end']
</script>

<template>
  <div class="column">
    <!-- Inside the bar the slot renders twice; keep it non-interactive and free of side effects. -->
    <VProgressLinear
      v-for="position in POSITIONS"
      :key="position"
      :value="55"
      :size="position === 'header' ? 'sm' : 'xl'"
      show-value
      :value-position="position"
      :label="`valuePosition ${position}`"
    />

    <VProgressLinear :value="7" :max="12" label="A slot of your own">
      <template #default="{ value, max }">{{ value }} of {{ max }} files</template>
    </VProgressLinear>
  </div>
</template>

<style scoped>
.column {
  display: grid;
  gap: var(--vectis-space-5);
  max-inline-size: 28rem;
}
</style>

Orientation

orientation="vertical" fills from bottom to top. Set a height to control the bar’s length.

vue
Tank, 25 percent

25%

Tank, 60 percent

60%

Tank, 90 percent

90%

Filling

indeterminate

<script setup lang="ts">
import { VProgressLinear, VTypography } from 'vectis-ui'
</script>

<template>
  <div class="row">
    <div v-for="value in [25, 60, 90]" :key="value" class="gauge">
      <VProgressLinear
        :value="value"
        orientation="vertical"
        size="lg"
        :label="`Tank, ${value} percent`"
        hide-label
      />
      <VTypography variant="caption" tone="muted">{{ value }}%</VTypography>
    </div>

    <div class="gauge">
      <VProgressLinear indeterminate orientation="vertical" size="lg" label="Filling" hide-label />
      <VTypography variant="caption" tone="muted">indeterminate</VTypography>
    </div>
  </div>
</template>

<style scoped>
.row {
  display: flex;
  align-items: end;
  gap: var(--vectis-space-6);
}
.gauge {
  display: grid;
  justify-items: center;
  gap: var(--vectis-space-2);
  block-size: 9rem;
  grid-template-rows: 1fr auto;
}
</style>

API

Props

PropTypeDefault
valuenumber0
Progress value, clamped between 0 and max.
labelstringnone
Label above the bar, which also names it. Defaults to the dictionary as an accessible name; consumer ARIA naming attributes take precedence.
hideLabelbooleanfalse
Hides the label visually while keeping it as the bar name.
maxnumber100
Value representing completion.
indeterminatebooleanfalse
Animates without a measurable value. Ignores value.
toneProgressLinearTone'neutral' | 'accent' | 'danger' | 'success' | 'warning''accent'
Colour tone.
colorstringnone
Custom CSS colour overriding the tone.
sizeProgressLinearSize'xs' | 'sm' | 'md' | 'lg' | 'xl''sm'
Bar thickness. Only xl holds the value inside the bar.
shapeProgressLinearShape'rounded' | 'square''rounded'
Rounded or square stroke ends.
showValuebooleanfalse
Displays the percentage. Ignored in indeterminate mode.
valuePositionProgressLinearValuePosition'header' | 'start' | 'center' | 'end''header'
Text position: after the label, or along the bar. Vertical start is the bottom.
orientationProgressLinearOrientation'horizontal' | 'vertical''horizontal'
Horizontal or vertical bar. Vertical progress fills from bottom to top.

Slots

SlotType
defaultProgressLinearSlotProps
Content replacing the percentage. Receives value, max and percent. Renders twice inside the bar; keep content non-interactive and free of side effects.

Types

Types used in the API tables. Import exported types from vectis-ui.

export interface ProgressLinearSlotProps {
  value: number
  max: number
  percent: number
}

CSS variables

TokenValue
--vectis-control-size-bar-thickness-xs0.125rem
--vectis-control-size-bar-thickness-sm0.25rem
--vectis-control-size-bar-thickness-md0.5rem
--vectis-control-size-bar-thickness-lg0.75rem
--vectis-control-size-bar-thickness-xl1.25rem
--vectis-control-size-bar-length10rem