Skip to content

Rolling Progress Bar

Star

TuiRollingProgress is a composite component specifically designed for displaying dynamic data lists. It perfectly combines the seamless scrolling engine of TuiRolling with the progress display capabilities of TuiProgress. It is ideal for building sales leaderboards, real-time production monitoring, or Top N data dashboards.

Basic Usage

Basic List

Wrap TuiRollingProgressItem with TuiRollingProgress. You must specify visibleLength to control the number of items displayed within the viewport.

html
<script setup>
import { ref } from 'vue';

const dataList = ref([
  { label: "Data Center A", value: 35 },
  { label: "Data Center B", value: 68 },
  { label: "Data Center C", value: 89 },
  { label: "Data Center D", value: 45 },
  { label: "Data Center E", value: 12 }
]);
</script>

<template>
  <div style="height: 300px">
    <TuiRollingProgress :visibleLength="4" autoRolling seamless>
      <TuiRollingProgressItem 
        v-for="(item, index) in dataList" 
        :key="index"
        :label="item.label"
        :value="item.value"
      />
    </TuiRollingProgress>
  </div>
</template>

Data Configuration

Through the progressConfig property, you can uniformly configure the behavior of all internal progress bars, such as value types, units, and color thresholds.

Values and Units

  • valueType: 'percent' (default 0-100) or 'number' (absolute value).
  • unit: Suffix unit for the numerical value.
html
<TuiRollingProgress 
  :progressConfig="{ 
    valueType: 'number', 
    unit: 'k USD' 
  }"
>
  ...
</TuiRollingProgress>

Smart Color Thresholds

Supports configuring a thresholds object to automatically change the progress bar color based on the value. For example: below 30 is danger, and above 70 is success.

html
<script setup>
const myThresholds = {
  danger: 0,    // 0-30 Red
  warning: 30,  // 30-50 Yellow
  normal: 50,   // 50-70 Blue
  success: 70   // 70+ Green
};
</script>

<template>
  <TuiRollingProgress 
    :progressConfig="{ thresholds: myThresholds }"
  >
    ...
  </TuiRollingProgress>
</template>

Ranking and Serial Numbers

The component features built-in support for leaderboard styles.

  • hasIndex: Whether to display a serial number on the left.
  • showRankings: Whether to enable highlighting effects for the top three items (Gold, Silver, and Bronze styles).
html
<TuiRollingProgress 
  :visibleLength="5" 
  hasIndex 
  showRankings 
>
  <TuiRollingProgressItem 
    v-for="(item, index) in list" 
    :index="index + 1" 
    v-bind="item" 
  />
</TuiRollingProgress>

Scrolling Control

Inherits powerful control capabilities from TuiRolling:

  • mode: 'item' (scroll by item) / 'page' (scroll by page).
  • seamless: Whether to enable seamless looping.
  • interval: Scrolling interval (ms).
  • motionBlur: Enables motion blur to improve visual smoothness during fast scrolling.

API Reference

TuiRollingProgress Props

PropertyTypeDefaultDescription
visibleLengthNumber1Required. Number of items displayed in the visible area.
intervalNumber-Automatic scroll interval (ms).
modeString'item'Scrolling mode. Options: item, page.
seamlessBooleantrueWhether to enable seamless loop scrolling.
showControlBooleantrueWhether to display the page control bar.
motionBlurBooleantrueWhether to enable motion blur.
hasIndexBooleanfalseWhether to display serial numbers.
showRankings
V0.0.6+
BooleanfalseWhether to enable ranking highlight styles (special styles for top three).
progressConfigObject-Uniform configuration for internal progress bars (valueType, unit, thresholds, color).
tagConfigObject-Uniform configuration for serial number Tag styles.
tipConfigObject-Uniform configuration for tooltip message styles.
resizeObserverString'global'Size monitoring strategy.

TuiRollingProgressItem Props

PropertyTypeDefaultDescription
labelStringRequiredLabel/name of the progress bar.
valueNumberRequiredProgress value.
indexNumber-Ranking index (used for hasIndex display).
statusString-Forces a specific status color (success, warning, danger, etc.).
colorString-Forces a specific custom color (CSS color value).
iconString-Icon class name next to the label.
showStatusIconBooleanfalseWhether to display the status icon.

Emits

Event NameDescriptionCallback Parameters
startTriggered when scrolling starts.-
rollingTriggered continuously during the scrolling process.(offset)

Credits

This component was inspired by the scrollRankingBoard component from the @jiaminghi/data-view library. As it was a heavily used component in earlier career projects, the development of the TechUI version aimed to expand its functionality by rebuilding it entirely on top of the TuiRolling component.

Released under the MIT License.