Skip to content

Progress Bar

TuiProgress is used to display the current progress of an operation, percentages of statistical data, or dashboard indicators. It supports three display forms: Linear (Bar), Circular (Circle), and Dashboard (Guage), and features built-in status colors and animation effects.

Basic Usage

Linear Progress Bar (Bar)

The default form. Use value to set the progress value (default 0-100).

  • label: Sets the text for the left-side label.
  • status: Sets the status color (success, warning, danger, etc.).
html
<template>
  <div class="demo-gap">
    <TuiProgress :value="30" label="Basic Progress" />
    <TuiProgress :value="50" label="Completed" status="success" />
    <TuiProgress :value="70" label="Warning" status="warning" />
    <TuiProgress :value="90" label="Error" status="danger" />
  </div>
</template>

Form Variants

Switch the display form using the type attribute.

Circular Progress Bar (Circle)

Set type="circle".

  • icon: An icon can be displayed in the center of the circle.
html
<template>
  <TuiProgress type="circle" :value="30" label="Normal" />
  
  <TuiProgress 
    type="circle" 
    :value="75" 
    status="success" 
    icon="tui-icon ti-check" 
  />
</template>

Dashboard (Guage)

Set type="guage". Typically used for Dashboard displays.

html
<TuiProgress 
  type="guage" 
  :value="80" 
  :strokeWidth="12" 
  label="CPU Usage" 
/>

Values and Thresholds

Smart Thresholds

Through the thresholds attribute, colors and statuses can change automatically based on the progress value. The object key is the status name (success, warning, etc.), and the value is the numerical node that triggers that status.

html
<script setup>
// Define thresholds: 0-59 is danger, 60-119 is warning, 120+ is success
const myThresholds = {
  danger: 59,
  warning: 119,
  success: 260
};
</script>

<template>
  <TuiProgress 
    :value="currentValue" 
    :maxValue="300" 
    :thresholds="myThresholds" 
    unit="Tons"
  />
</template>

Content Formatting (Format)

Customize the text content on the right or in the center via the format function or slots.

html
<script setup>
const formatText = (props) => {
  if (props.value === 100) return 'Full';
  return `${props.value}%`;
};
</script>

<template>
  <TuiProgress :value="100" :format="formatText" />

  <TuiProgress :value="60">
    <template #default="{ value }">
      <span style="color: blue">{{ value }} / 100 Points</span>
    </template>
  </TuiProgress>
</template>

Layout and Appearance

Label Layout

  • labelNewline: Whether the label occupies a single line above the progress bar.
  • labelWidth: Fixed label width, used for multi-line alignment.
html
<TuiProgress :value="40" label="Long title with automatic line break" labelNewline />

Internal Display (Value Inside)

For linear progress bars, setting valuePosition="inside" displays the percentage value inside the progress bar.

html
<TuiProgress :value="70" :strokeWidth="18" valuePosition="inside" />

Animations and Special Effects

  • striped: Enables the striped effect.
  • stripedFlow: Enables the flowing stripe animation (commonly used for loading).
  • indeterminate: Enables the loading animation for indeterminate progress.
html
<TuiProgress :value="50" status="warning" striped stripedFlow />
<TuiProgress :value="30" indeterminate />

API Reference

Props

PropertyTypeDefaultDescription
valueNumber0Required. Current progress value.
typeString'bar'Type. Options: bar, circle, guage.
statusString-Status. Options: normal, success, danger, warning, emphasis, critical.
maxValueNumber0Maximum value (used to calculate ratio). Defaults to 100 if not set.
thresholdsObject-Threshold configuration object { status: number }.
colorString-Custom progress bar color (overrides status).
strokeWidthNumber-Progress bar width (px).
widthNumber-Canvas width (used for Circle/Guage).
indeterminateBooleanfalseWhether to use indeterminate progress animation.
stripedBooleanfalseWhether to display stripes.
stripedFlowBooleanfalseWhether stripes flow.
strokeLinecapString'round'End cap shape. Options: butt, round, square.
labelString-Label text on the left/top.
labelNewlineBooleanfalseWhether the label is displayed on a new line.
labelWidthNumber-Fixed width of the label area.
showValueBooleantrueWhether to display numerical values.
valuePositionString'default'Value position. Options: default, newline, inside.
formatFunction-Content formatting function (props) => string.
unitString-Numerical value unit suffix.
iconString-Icon class name.
showStatusIconBooleantrueWhether to show the icon corresponding to the status (e.g., checkmark, exclamation mark).

Slots

Slot NameDescriptionParameters
defaultCustomize the content of the progress numerical area.{ value }
labelCustomize the content of the label area.-
iconCustomize the content of the icon area.-

Released under the MIT License.