Files
maoyingjie 145a208687 docs: close documentation facts, structure and related-component mapping
HD-04 scope, against heroui ce90ea3 cn sources:

- stale/fictional content: input.md no longer claims TextField is
  unmigrated; color-field.md no longer claims ColorPicker is private;
  header.md drops the fictional Header.Root subcomponent and the stale
  'menus not migrated' wording (MenuSection label registration is now
  documented from HeaderRoot source); radio-group.md drops three copied
  CheckboxGroup wordings (variant override is Radio's, scalar emits,
  native single-value submit); input-otp.md drops the fictional
  data-complete state and lists the real missing upstream props
- toggle-button disabled row now matches the real CSS hooks
  (:disabled / [aria-disabled], with data-disabled as a marker only)
- part API / CSS classes / interactive states restored per pinned
  sources: button (full class lists + real variable-based global CSS),
  accordion (per-part tables + variant/state lists), card (per-part
  tables + variant list), switch (SwitchGroup snippet + Switch/
  SwitchGroup class lists + states), color-field Group (class list +
  states), input-otp (variant notes, global CSS, class/state lists);
  input-group gains the two upstream usage chapters
- RelatedComponents restored from the pinned componentRelationships
  (first-3, filtered against componentsMap): 64 pages rewritten,
  list-box/slider sections added, 7 empty-mapping pages' fabricated
  entries removed; RelatedShowcases left unmigrated with its real data
  inventory recorded (2 cases, showcase-site cards)
- defaults unified on implementation evidence: granularity (inferred
  day/minute) and visibleYears (full min-max span, no "or 20" fallback);
  HD-03 hand-offs resolved (trigger focus-visible noted for HD-06,
  width guards kept)
- new demos: header-collection-grouping (MenuSection/ListBoxSection
  label wiring), empty-state-collection (collection empty slot);
  empty-state page deduplicated with a boundary compatibility note
- ComponentPreview minHeight/isBgSolid restored per the 30 upstream
  marks; tabs-overflow max-w-full kept after measuring internal scroll
- tests: +3 header registration/demo cases, +1 empty-state collection
  case; full suite 110 files / 1630 tests, typecheck and build:docs
  pass
2026-10-28 22:32:10 +08:00

7.5 KiB
Raw Permalink Blame History

title, description, component, group
title description component group
ProgressCircle 环形进度条 环形进度指示器,用于展示确定或不确定的进度。 progress-circle 组件

用法

<script setup lang="ts">
import {
  ProgressCircle,
  ProgressCircleFillCircle,
  ProgressCircleTrack,
  ProgressCircleTrackCircle,
} from "@heroui-vue/components";
</script>

<template>
  <ProgressCircle aria-label="加载中" :value="60">
    <ProgressCircleTrack>
      <ProgressCircleTrackCircle />
      <ProgressCircleFillCircle />
    </ProgressCircleTrack>
  </ProgressCircle>
</template>

组件结构

<script setup lang="ts">
import {
  ProgressCircle,
  ProgressCircleFillCircle,
  ProgressCircleTrack,
  ProgressCircleTrackCircle,
} from "@heroui-vue/components";
</script>

<template>
  <ProgressCircle aria-label="Loading" :value="60">
    <ProgressCircleTrack>
      <ProgressCircleTrackCircle />
      <ProgressCircleFillCircle />
    </ProgressCircleTrack>
  </ProgressCircle>
</template>

ProgressCircle 渲染为 role="progressbar" 的容器。ProgressCircleTrack 是 SVG 轨道,TrackCircle / FillCircle 分别为背景圆环与进度弧。默认几何为 viewBox 0 0 36 36、圆心 18、半径 16、描边 4。

示例

尺寸

颜色

不确定进度

无法确定进度时使用 isIndeterminate。此时不输出 aria-valuenow,轨道进入旋转动画。

带标签

自定义 SVG 属性

各子部分均为可组合组件,可直接覆盖 strokeWidth、r、cx、cy、viewBox 等 SVG 属性。

自定义样式

Tailwind CSS

全局 CSS

若要自定义组件类,可使用 @layer components 指令。

@layer components {
  .hv-progress-circle {
    @apply inline-flex;
  }

  .hv-progress-circle__track {
    @apply size-12;
  }

  .hv-progress-circle__fill-circle {
    stroke: purple;
  }
}

样式参考

HeroUI 遵循 BEM 方法论,确保组件变体与状态可复用且易于自定义。类名前缀为 hv-。

CSS 类

ProgressCircle 组件使用以下 CSS 类(查看源码样式):

基础与元素类 [!toc]

  • .hv-progress-circle - 基础容器
  • .hv-progress-circle__track - SVG 元素
  • .hv-progress-circle__track-circle - 背景圆环
  • .hv-progress-circle__fill-circle - 进度弧

尺寸类 [!toc]

  • .hv-progress-circle--sm - 小尺寸
  • .hv-progress-circle--md - 中等尺寸(默认)
  • .hv-progress-circle--lg - 大尺寸

颜色类 [!toc]

  • .hv-progress-circle--default - 默认颜色
  • .hv-progress-circle--accent - 强调色
  • .hv-progress-circle--success - 成功色
  • .hv-progress-circle--warning - 警告色
  • .hv-progress-circle--danger - 危险色

API 参考

ProgressCircle

取值与格式化语义与 ProgressBar 相同。children 的渲染 prop 在 Vue 中改为默认作用域插槽。

属性 类型 默认值 描述
value number 0 当前值
minValue number 0 最小值
maxValue number 100 最大值
isIndeterminate boolean false 是否为不确定进度
size "sm" | "md" | "lg" "md" 圆环尺寸
color "default" | "accent" | "success" | "warning" | "danger" "accent" 进度弧颜色
formatOptions Intl.NumberFormatOptions { style: "percent" } 数值展示格式
valueLabel string | number - 自定义数值标签内容
class string | Array | Object - 合并到根元素
默认插槽 { percentage, valueText, isIndeterminate } - 内容或作用域插槽

ProgressBarRenderProps

属性 类型 描述
percentage number | undefined 进度百分比(0–100)
valueText string | undefined 格式化后的数值文案
isIndeterminate boolean 是否为不确定进度

ProgressCircleTrack

属性 类型 默认值 描述
viewBox string "0 0 36 36" SVG 视口
fill string "none" SVG fill
class string | Array | Object - 合并到 svg
默认插槽 - - 放置圆环子部件

渲染为 svg[data-slot="progress-circle-track"]。

ProgressCircleTrackCircle

属性 类型 默认值 描述
cx / cy string | number 18 圆心
r string | number 16 半径
strokeWidth string | number 4 描边宽度
class string | Array | Object - 合并到 circle

渲染为 circle[data-slot="progress-circle-track-circle"]。

ProgressCircleFillCircle

属性 类型 默认值 描述
cx / cy string | number 18 圆心
r string | number 16 半径
strokeWidth string | number 4 描边宽度
strokeDasharray string | number 周长 虚线数组
strokeDashoffset string | number 按进度 虚线偏移;不确定时为周长的 75%
strokeLinecap string "round" 线帽
transform string 旋转 -90° 变换
class string | Array | Object - 合并到 circle

渲染为 circle[data-slot="progress-circle-fill-circle"]。