Skip to content

Progress 进度条

用于展示操作进度

直线进度条

进度条内显示百分比标识

百分比不占用额外空间,适用于文件上传等场景。

自定义进度条的颜色

环形进度条

仪表盘形进度条

自定义内容

动画进度条

条纹进度条

API

Props

参数说明类型默认值
percentage百分比, 必填number0
type进度条类型enumline
stroke-width进度条的宽度number6
text-inside进度条显示文字内置在进度条内(仅 type 为 'line' 时可用)booleanfalse
status进度条当前状态enum
indeterminate是否为动画进度条booleanfalse
duration控制动画进度条速度和条纹进度条流动速度number3
color进度条背景色 进度条背景色 (会覆盖 status 状态颜色)string / function / Array''
width环形进度条画布宽度(只在 type 为 circle 或 dashboard 时可用)number126
show-text是否显示进度条文字内容booleantrue
stroke-linecapcircle/dashboard 类型路径两端的形状enumround
format指定进度条文字内容Function
striped在进度条上增加条纹booleanfalse
striped-flow让进度条上的条纹流动起来booleanfalse

Slots

名称说明
default自定义内容,参数为 { percentage }

类型定义

组件导出以下类型定义:

ts
import type { ProgressProps } from 'ryxon'

主题定制

样式变量

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

名称默认值描述
--r-progress-line-height6px直线进度高度
--r-progress-line-background-colorvar(--r-border-color-lighter)直线进度背景色
--r-progress-line-radius100px直线进度圆角
--r-progress-text-font-size14px进度条文字大小
--r-progress-text-colorvar(--r-text-color-regular)进度条文字颜色
--r-progress-text-margin-left5px-
--r-progress-inner-font-size12px进度条内置文字大小
--r-progress-inner-margin0 5px-

Released under the MIT License.