113k

进度

显示一个指示器,用于展示任务的完成进度,通常以进度条形式显示。

x
"use client"

import * as React from "react"

安装

pnpm dlx shadcn@latest add progress

使用方法

import { Progress } from "@/components/ui/progress"
<Progress value={33} />

Composition

带标签和数值

使用 ProgressLabelProgressValue 添加标签和数值显示。

import {
  Progress,
  ProgressLabel,
  ProgressValue,
} from "@/components/ui/progress"
 
;<Progress value={56} className="w-full max-w-sm">
  <ProgressLabel>Upload progress</ProgressLabel>
  <ProgressValue />
</Progress>
Progress
├── ProgressLabel
├── ProgressValue
└── ProgressTrack
    └── ProgressIndicator

Examples

标签

使用 ProgressLabelProgressValue 添加标签和数值显示。

Upload progress
x
import {
  Progress,
  ProgressLabel,

受控组件

一个可以通过滑块控制的进度条。

x
"use client"

import * as React from "react"

RTL

要启用 shadcn/ui 中的 RTL(从右到左)支持,请参阅 RTL 配置指南

تقدم الرفع
x
"use client"

import * as React from "react"

API 参考

请查看 Base UI Progress 文档。