Skip to content

Circle

Circular progress bar component, supporting color customization, gradient colors, direction control and slot content.

Component Type

Basic Usage

Bind current progress through v-model, control center text through text.

html
<wd-circle v-model="current" :text="`${current}%`" />

Component Style

Width Control

Control progress bar width through stroke-width.

html
<wd-circle v-model="current" :stroke-width="6" />

Color Customization

Control progress bar color through color, control track color through layer-color.

html
<wd-circle v-model="current" color="#ee0a24" layer-color="#eee" />

Gradient Color

color supports object format to define gradient colors.

html
<wd-circle v-model="current" :color="gradientColor" />
ts
const gradientColor = {
  '0': 'red',
  '100': 'white'
}

Counter-clockwise Direction

Set clockwise to false, progress expands from counter-clockwise direction.

html
<wd-circle v-model="current" :clockwise="false" />

Size Customization

Control circle diameter through size.

html
<wd-circle v-model="current" :size="120" />

Content Form

Use Default Slot

When text is not passed, default slot can be used to customize center content.

html
<wd-circle v-model="current" :stroke-width="6">
  <view style="color: red">{{ current }}%</view>
</wd-circle>

Special Style

Progress Control

html
<wd-button type="primary" size="small" @click="doAdd">Increase</wd-button>
<wd-button type="danger" size="small" @click="doDecre">Decrease</wd-button>

Attributes

ParameterDescriptionTypeDefault Value
v-modelCurrent progressnumber0
sizeCircle diameter, unit pxnumber120
colorProgress bar color, supports string or gradient objectstring | Record<string, string>#1C64FD
layer-colorTrack colorstring#F2F3F5
fillFill colorstring-
speedAnimation speed, unit rate/snumber50
textCircle center textstring-
stroke-widthProgress bar width, unit pxnumber18
stroke-linecapEndpoint shape, optional values are butt, round, squarestringround
clockwiseWhether to increase clockwisebooleantrue
custom-classRoot node custom class namestring''
custom-styleRoot node custom stylestring''

Slots

nameDescriptionParameters
defaultCustom circle center content (only displayed when text is empty)-

主题定制

CSS 变量

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 全局配置

名称默认值描述
--wot-circle-text-colorcurrentColor圆环文字颜色
--wot-circle-text-size$typography-title-size-large圆环文字字号
--wot-circle-text-line-height$typography-title-line--height-size-large圆环文字行高

Source Code

Documentation
Component

Released under the MIT License.

Released under the MIT License.