Skip to content
LIBRARYFeedbackUpdated

Progress ​

MProgress shows how far a task has advanced, or a moving segment when its total is unknown. The app owns the task and supplies its state.

Next alpha

Available in 0.1.0-alpha.4.

Web preview
Open example ↗

Usage ​

vue
<m-progress :value="64" label="Collection download" tone="accent" />
<m-progress indeterminate label="Preparing collection" indeterminateLabel="Preparing" />

Props ​

PropTypeDefaultBehavior
valuenumber0Finite value, clamped between zero and max.
maxnumber100Finite, strictly positive upper bound.
labelstringrequiredNonempty accessible name; does not render visible text.
indeterminatebooleanfalseShows a moving segment instead of a known percentage.
indeterminateLabelstringLoadingNonempty accessible description for indeterminate work; translate in the app.
sizesm | md | lgmdTrack heights of 4, 8 and 12 DIP/px.
toneprimary | accent | success | warning | dangerprimaryThemed fill color.
celebratebooleanfalseA confetti burst when a known value reaches max. Skipped under reduced motion and in the background.
width / grow / shrinkdimension / number / numberauto / 0 / contextLayout participation, as in Box.
id / accessibilityHiddenstring / boolean— / falseOptional identifier and accessibility exclusion.

Numbers use DIP on native and px on Web. In Column, the track fills available width; in Row, give it a width or use width=0 with grow=1. Invalid numeric inputs throw RangeError, including in indeterminate mode; empty labels throw TypeError. The accessible percentage is rounded to at most one decimal. It is not a promise of automatic announcements for each update.

State and motion ​

There are no slots or events. Add visible labels, percentages, cancel/retry actions and success/error messages alongside the track. A full bar does not complete a task, change its tone or remove itself. The fill animates to each new value. With reduced motion it settles immediately.

Jolt moves the indeterminate segment over a 1.6-second cycle on Web and NativeScript. Reduced motion holds the segment in the centre. A hidden Web tab or a backgrounded app pauses playback. Removing the component releases it.

The native element exposes a progress-bar role and a percentage or indeterminate description. Web uses role=progressbar, min/max and the current value; indeterminate mode omits aria-valuenow. Supply a concise label. There is no circular variant, task service or estimated completion time.

Library demonstrates preparation, progress, cancellation and retry using local timers, without transferring files.

Expressive motion ​

Known values follow with a short spring that stays clipped by the track, while aria-valuenow changes at once. Reaching max gives the track a quick pulse, plus a haptic and confetti with celebrate. The indeterminate segment squashes against each wall and stretches while it crosses the middle.

Desktop ​

On the Mac and on Windows the bar fills to its value and a busy bar moves a segment, which stays still in the middle with reduced motion. celebrate is accepted and has no effect, because confetti has no desktop driver. See Desktop components.

Full example ​

View source
vue
<script setup lang="ts">
import { useCatalogLocale } from '../locale'
import { computed, ref } from 'vue'

const { t, locale } = useCatalogLocale(() => props.lang)

const props = withDefaults(defineProps<{ lang?: 'en' | 'pt' }>(), { lang: undefined })
const copy = computed(() =>
  (props.lang ?? locale.value) === 'pt'
    ? {
        eyebrow: 'CADA PASSO CONTA',
        moving: 'A caminho.',
        preparing: 'Preparando sua coleção.',
        description: 'Uma boa ideia merece ir com você.',
        label: 'Download da coleção',
        pending: 'Preparando',
        advance: 'Avançar',
        reset: 'Zerar',
        value: 'Valor do progresso',
        indeterminate: 'Progresso indeterminado',
        helper: 'Use quando o tamanho da tarefa ainda não é conhecido.',
        hide: 'Ocultar indicador',
        show: 'Mostrar indicador',
        sizes: 'O peso certo para cada contexto.',
        thickness: 'Espessura',
      }
    : {
        eyebrow: 'EVERY STEP COUNTS',
        moving: 'On its way.',
        preparing: 'Preparing your collection.',
        description: 'A good idea deserves to go with you.',
        label: 'Collection download',
        pending: 'Preparing',
        advance: 'Advance',
        reset: 'Reset',
        value: 'Progress value',
        indeterminate: 'Indeterminate progress',
        helper: 'Use when the size of the task is not yet known.',
        hide: 'Hide indicator',
        show: 'Show indicator',
        sizes: 'The right weight for every context.',
        thickness: 'Thickness',
      },
)
const value = ref(64)
const indeterminate = ref(false)
const visible = ref(true)
const percent = computed(() => `${Math.round(value.value)}%`)
</script>

<template>
  <m-column gap="lg" id="progress-demo">
    <m-card gap="lg">
      <m-row justify="between" gap="sm">
        <m-text variant="overline" tone="primary">{{ t(copy.eyebrow) }}</m-text>
        <m-icon name="download" tone="primary" />
      </m-row>
      <m-column gap="xs">
        <m-text variant="display" tone="primary">{{
          t(indeterminate ? copy.moving : percent)
        }}</m-text>
        <m-text tone="muted">{{ t(indeterminate ? copy.preparing : copy.description) }}</m-text>
      </m-column>
      <m-progress
        v-if="visible"
        id="progress-example"
        :value="value"
        :indeterminate="indeterminate"
        :label="t(copy.label)"
        :indeterminateLabel="copy.pending"
        size="lg"
        celebrate
      />
      <m-row gap="sm" wrap>
        <m-button
          size="sm"
          :disabled="indeterminate || value === 100"
          @click="value = Math.min(100, value + 20)"
          >{{ t(copy.advance) }}</m-button
        >
        <m-button size="sm" variant="ghost" :disabled="indeterminate" @click="value = 0">{{
          t(copy.reset)
        }}</m-button>
      </m-row>
    </m-card>
    <m-slider v-model="value" :disabled="indeterminate" :label="t(copy.value)" />
    <m-switch v-model="indeterminate" :label="t(copy.indeterminate)" :helperText="t(copy.helper)" />
    <m-button size="sm" variant="secondary" @click="visible = !visible">{{
      t(visible ? copy.hide : copy.show)
    }}</m-button>
    <m-column gap="md">
      <m-text variant="heading">{{ t(copy.sizes) }}</m-text>
      <m-column v-for="size in ['sm', 'md', 'lg'] as const" :key="size" gap="sm">
        <m-text variant="caption" tone="muted">{{ t(size) }}</m-text>
        <m-progress
          :value="72"
          :size="size"
          tone="accent"
          :label="t(`${copy.thickness} ${size}`)"
        />
      </m-column>
    </m-column>
  </m-column>
</template>

Components for NativeScript and Web. Starting with Vue.