Skip to content

MProgress <m-progress> ​

A loading bar. A storm cloud rides the leading edge, pebbles lift off the ground and ゴゴゴ rumbles; at the end a burst, ドン! and a check. Emits done once each time it reaches 1.

Demo source
vue
<script setup lang="ts">
import { onBeforeUnmount, ref } from 'vue';
import { MButton, MProgress } from 'vue-manga-ui';

const value = ref(0);
let timer: ReturnType<typeof setInterval> | undefined;
function start(): void {
  clearInterval(timer);
  value.value = 0;
  timer = setInterval(() => {
    value.value = Math.min(1, value.value + Math.random() * 0.12);
    if (value.value >= 1) clearInterval(timer);
  }, 300);
}
onBeforeUnmount(() => {
  clearInterval(timer);
});
</script>

<template>
  <div class="col">
    <MProgress :value="value" label="Uploading" />
    <MButton variant="secondary" @click="start">Upload</MButton>
  </div>
</template>

Props ​

PropTypeDefaultDescription
valuenumber0Progress from 0 to 1.
labelstring""Visible and accessible label.

Other HTML attributes (id, class, aria-*, data-*…) fall through to the component’s element and are type-checked.

Events ​

EventPayloadDescription
done[]Fired once when the bar reaches 1.