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

2.4 KiB

title, description, component, group
title description component group
Spinner 加载指示器 用于展示等待或处理中状态的加载指示组件 spinner 组件

用法

<script setup lang="ts">
import { Spinner } from "@heroui-vue/components";
</script>

示例

颜色

尺寸

速度

为单个 Spinner 添加动画工具类即可调整其旋转速度。请同时加上 motion-reduce:animate-none,以便在用户开启“减少动态效果”时保持静止。

自定义样式

Tailwind CSS

全局 CSS

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

@layer components {
  .hv-spinner {
    @apply animate-spin;
  }

  .hv-spinner--accent {
    color: var(--accent);
  }
}

样式参考

HeroUI 遵循 BEM 方法论,确保组件变体与状态可复用且易于自定义。

CSS 类

Spinner 使用以下 CSS 类:

基础类与尺寸类 [!toc]

  • .hv-spinner - 基础样式与默认尺寸
  • .hv-spinner--sm - 小尺寸变体
  • .hv-spinner--md - 中等尺寸变体(默认)
  • .hv-spinner--lg - 大尺寸变体
  • .hv-spinner--xl - 特大尺寸变体

颜色类 [!toc]

  • .hv-spinner--current - 继承当前文本颜色
  • .hv-spinner--accent - 强调色变体
  • .hv-spinner--danger - 危险色变体
  • .hv-spinner--success - 成功色变体
  • .hv-spinner--warning - 警告色变体

API 参考

Spinner

Prop 类型 默认值 描述
size "sm" | "md" | "lg" | "xl" "md" Spinner 的尺寸
color "current" | "accent" | "success" | "warning" | "danger" "accent" Spinner 的颜色变体
class string - 额外的 CSS 类名

根节点默认 role="status" 与 aria-label="Loading",可通过 attrs 覆盖。内部 SVG 标记 aria-hidden,使用 currentColor 渐变;嵌入 Button 时保持所选尺寸(如 size="sm" 为 16px),不被 Button 的普通 SVG 规则覆盖。