C

Progress 进度条

反馈组件

展示操作的当前进度,告知用户当前状态与剩余时长/进度。

何时使用

展示操作的当前完成进度,提供过程反馈。

代码示例

基础用法

tsx
import { Progress, ProgressTrack, ProgressIndicator, ProgressLabel, ProgressValue } from "@/components/ui/progress"

export function Basic() {
return (
  <Progress>
    <ProgressTrack>Content</ProgressTrack>
  </Progress>
)
}

API / Props

Progress

PropTypeDefault说明
classNamestring自定义样式类名
...restReact.HTMLAttributes透传原生 DOM 属性

注意事项

  • Client Component: 使用 "use client",依赖 React hooks/状态,需在客户端渲染。
  • 复合组件: 包含 4 个子组件(ProgressTrack, ProgressIndicator, ProgressLabel, ProgressValue),使用组合模式按需导入。
  • Base UI: 基于 @base-ui/react 无头(headless)原语构建,无障碍(a11y)开箱即用。

📘 完整交互式示例与控件属性请查看 Storybook 文档