CircleProgress
Ring progress component: the track circle and progress arc are drawn with the canvas 2d API (drawCircleTrack / drawCircleArc, unified in share core, identical on web and mini-programs), while the text is an absolutely positioned view layered over the canvas. Serves task progress, loading ratios, score ratios and similar scenarios.
Platform differences (registered): this port uses the canvas 2d form — mini-program templates cannot render SVG (the share circle-progress SVG styles target the web port), so this port consumes the same share-core drawing pure functions via
<canvas type="2d">; geometry (radius / sweep angle / counterclockwise conversion), color normalization and text formatting all reuse share core; the port only fetches the canvas context and schedules redraws. The component is event-free and fully controlled.
Basic usage
<template>
<lh-circle-progress :model-value="40" />
<lh-circle-progress :model-value="70" :size="140" :stroke-width="12" />
</template>Custom colors and gradients
color accepts a single color string or an array of colors; an array with 2 or more entries becomes a linear gradient whose endpoints follow the array order. When trackColor is omitted, the track token fallback color is used:
<lh-circle-progress :model-value="70" color="#B87800" track-color="#F0EBE2" />
<lh-circle-progress :model-value="80" :color="['#2B4C7C', '#C4A35A']" />
<lh-circle-progress :model-value="80" :color="['#5B8C5A', '#C4A35A', '#B23A3A']" />Counterclockwise and start angle
clockwise defaults to true (clockwise); startAngle counts from the 12 o'clock position as 0 degrees, positive clockwise:
<lh-circle-progress :model-value="55" :clockwise="false" />
<lh-circle-progress :model-value="55" :start-angle="90" />
<lh-circle-progress :model-value="55" :start-angle="135" :clockwise="false" />Custom text
The default text is the rounded percentage; format overrides formatting, the default slot replaces the whole text, and showText=false hides the text (the root gets the lh-circle-progress--no-text modifier):
<lh-circle-progress :model-value="42" :format="(v: number) => `${v} pts`" />
<lh-circle-progress :model-value="100">Done</lh-circle-progress>
<lh-circle-progress :model-value="30" :show-text="false" />Props
| Prop | Description | Type | Default |
|---|---|---|---|
| modelValue | Progress percentage 0-100 (controlled, clamped when out of range) | number | 0 |
| size | Ring size in px (diameter, canvas width and height) | number | 120 |
| strokeWidth | Stroke width in px | number | 6 |
| color | Progress color: single color or gradient array (>=2 entries become linear gradient endpoints) | `string | string[]` |
| trackColor | Track color (falls back to the token fallback color) | string | disabled color fallback |
| clockwise | Clockwise (false draws counterclockwise) | boolean | true |
| startAngle | Start angle in degrees (0 = 12 o'clock, positive clockwise) | number | 0 |
| showText | Show the default percentage text | boolean | true |
| format | Text formatter (rounded percentage by default) | (v: number) => string | — |
| linecap | Stroke linecap shape | `'butt' | 'round' |
| label | Accessibility label | string | — |
| customClass | Custom class (forwarded to the root node) | string | — |
| sx | sx quick layout props | LhSxProps | — |
Accessibility
The root node carries role="progressbar" with the aria-valuemin/max/now range semantics; label provides the accessible name (e.g. "Upload progress"), and modelValue is clamped into 0-100 before being announced.

