Skip to content

Progress ​

Displays task progress, supporting status colors, custom colors, and text formatting.

Basic usage ​

vue
<template>
  <lh-progress :percentage="42" />
</template>

Status ​

vue
<template>
  <lh-progress :percentage="70" status="success" />
  <lh-progress :percentage="70" status="warning" />
  <lh-progress :percentage="70" status="exception" />
  <lh-progress :percentage="100" />
</template>

When status is normal and the value reaches 100, it is automatically treated as success.

Stroke width and hidden text ​

vue
<template>
  <lh-progress :percentage="60" :stroke-width="12" />
  <lh-progress :percentage="60" :show-text="false" />
</template>

Custom color ​

A string is used directly as the bar color; a function returns a color based on the percentage.

vue
<template>
  <lh-progress :percentage="60" color="#C4A35A" />
  <lh-progress :percentage="60" :color="gradient" />
</template>

<script setup lang="ts">
const gradient = (p: number) => `rgb(${p}, 0, 0)`
</script>

Custom formatting and the text slot ​

vue
<template>
  <lh-progress :percentage="42" :format="format" />
  <lh-progress :percentage="42">
    <template #text="{ percentage }">
      <text>{{ percentage }} / 100</text>
    </template>
  </lh-progress>
</template>

<script setup lang="ts">
const format = (p: number) => `Progress ${p}`
</script>

Props ​

PropDescriptionTypeDefault
percentageProgress percentage 0-100 (clamped automatically when out of range)number0
typeType'line' | 'circle''line'
statusStatus'normal' | 'success' | 'warning' | 'exception''normal'
colorProgress bar color: a string, or a function that returns a color by percentagestring | ((percentage: number) => string)—
strokeWidthStroke width in pxnumber6
widthCanvas width in px for the circle modenumber126
showTextWhether to show the textbooleantrue
formatCustom text formatting(percentage: number) => string—
customClassCustom class namestring—
sxQuick layout propsLhSxProps—

Slots ​

SlotDescriptionScoped parameters
textCustom progress text{ percentage: number }

The circle type is not implemented yet

The Mini Program has limited svg support, so only the line type is implemented in the first release. Passing type="circle" renders as line and warns once during development (no silent degradation); circle is left for a later phase.