import{o as t,a,y as n}from"./vue-libs.b44bc779.js";const e={class:"van-doc-markdown-body"},l=n(`

Circle

Intro

Circular progress bar component, and supports gradient color animation.

Install

Register component globally via app.use, refer to Component Registration for more registration ways.

import { createApp } from 'vue';
import { Circle } from 'vant';

const app = createApp();
app.use(Circle);

Usage

Basic Usage

<van-circle
  v-model:current-rate="currentRate"
  :rate="30"
  :speed="100"
  :text="text"
/>
import { ref, computed } from 'vue';

export default {
  setup() {
    const currentRate = ref(0);
    const text = computed(() => currentRate.value.toFixed(0) + '%');

    return {
      text,
      currentRate,
    };
  },
};

Custom Width

<van-circle
  v-model:current-rate="currentRate"
  :rate="rate"
  :stroke-width="60"
  text="Custom Width"
/>

Custom Color

<van-circle
  v-model:current-rate="currentRate"
  :rate="rate"
  layer-color="#ebedf0"
  text="Custom Color"
/>

Gradient

<van-circle
  v-model:current-rate="currentRate"
  :rate="rate"
  :color="gradientColor"
  text="Gradient"
/>
import { ref } from 'vue';

export default {
  setup() {
    const currentRate = ref(0);
    const gradientColor = {
      '0%': '#3fecff',
      '100%': '#6149f6',
    };

    return {
      currentRate,
      gradientColor,
    };
  },
};

Counter Clockwise

<van-circle
  v-model:current-rate="currentRate"
  :rate="rate"
  :clockwise="false"
  text="Counter Clockwise"
/>

Custom Size

<van-circle
  v-model:current-rate="currentRate"
  :rate="rate"
  size="120px"
  text="Custom Size"
/>

Start Position

<van-circle
  v-model:current-rate="currentRate"
  :rate="rate"
  :text="Left"
  start-position="left"
/>
<van-circle
  v-model:current-rate="currentRate"
  :rate="rate"
  text="Right"
  start-position="right"
/>
<van-circle
  v-model:current-rate="currentRate"
  :rate="rate"
  text="Bottom"
  start-position="bottom"
/>

API

Props

AttributeDescriptionTypeDefault
v-model:current-rateCurrent ratenumber-
rateTarget ratenumber | string100
sizeCircle sizenumber | string100px
colorProgress color, passing object to render gradientstring | object#1989fa
layer-colorLayer colorstringwhite
fillFill colorstringnone
speedAnimate speed\uFF08rate/s\uFF09number | string0
textTextstring-
stroke-widthStroke widthnumber | string40
stroke-linecapStroke linecap, can be set to square buttstringround
clockwiseWhether to be clockwisebooleantrue
start-position v3.2.1Progress start position, can be set to left\u3001right\u3001bottomCircleStartPositiontop

Slots

NameDescription
defaultcustom text content

Types

The component exports the following type definitions:

import type { CircleProps, CircleStartPosition } from 'vant';

Theming

CSS Variables

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

NameDefault ValueDescription
--van-circle-size100px-
--van-circle-colorvar(--van-primary-color)-
--van-circle-layer-colorvar(--van-white)-
--van-circle-text-colorvar(--van-text-color)-
--van-circle-text-font-weightvar(--van-font-weight-bold)-
--van-circle-text-font-sizevar(--van-font-size-md)-
--van-circle-text-line-heightvar(--van-line-height-md)-
`,17),r=[l],h={__name:"README",setup(c,{expose:s}){return s({frontmatter:{}}),(o,d)=>(t(),a("div",e,r))}};export{h as default};