加载状态#

一个官方尺寸的静态相位及状态文字。

启用 JavaScript 后可运行预览;源码和安装命令仍可直接查看。

用法
// The caller chooses the phase; the spinner schedules no frames.
icon := f.Slot().Size(24, 24)
components.PaintSpinner(canvas, theme, icon.Rect(), 2)
f.Text("Syncing workspace…").FontSize(theme.Metrics.FontSizeM).Weight(ui.WeightMedium)

八个相位#

同屏展示全部确定性相位,不启动动画循环。

启用 JavaScript 后可运行预览;源码和安装命令仍可直接查看。

用法
for index := range 8 {
    cell := f.Slot().Size(32, 32)
    components.PaintSpinner(canvas, theme, cell.Rect(), components.SpinnerPhase(index))
}

约束尺寸#

指示器在不同边界中居中并保持比例。

启用 JavaScript 后可运行预览;源码和安装命令仍可直接查看。

用法
for index, side := range [...]float32{16, 32, 48} {
    box := f.Slot().Size(side, side)
    canvas.RoundedBorder(box.Rect(), 5, 1, theme.Border, theme.Background)
    components.PaintSpinner(canvas, theme, box.Rect(), components.SpinnerPhase(index*2))
}

安装

将组件源码复制到自己的项目,直接修改。

仓库命令
go run ./cmd/viva add --out ./components/local spinner

源码组件用法#

此预览直接调用生产 Go 组件。稳定 ID、值与打开状态仍由应用持有;组件只负责绘制并声明交互语义。

  • 标题旁的源码链接列出了全部选项与视觉决策。
  • 请使用原生命令验证系统文本、焦点、无障碍与平台集成。
  • 浏览器预览验证共享布局和场景行为,不代表原生性能。

验证边界#

示例覆盖当前 API 的代表性状态,但不表示每个桌面后端都已完成真机验证。

键盘操作

Tab 在控件间移动;Ctrl/⌘ K 搜索组件。进入预览后,键盘事件由 Go 运行时处理。