跳转到内容

进度条 ​

基于 zw-progress 基础组件构建的样式化进度条。

@zeus-web/progress反馈zweb add progress自动生成

交互演示 ​

源码 ​

请选择与你的应用框架匹配的入口。

html
<script type="module">
  import '@zeus-web/progress/wc/auto'
</script>

<zw-progress value="64" max="100" label="Upload progress"></zw-progress>
tsx
import { Progress } from '@zeus-web/progress/react'

export function ProgressExample() {
  return <Progress value={64} max={100} label="Upload progress" />
}
vue
<script setup lang="ts">
import { Progress } from '@zeus-web/progress/vue'
</script>

<template>
  <Progress :value="64" :max="100" label="Upload progress" />
</template>

添加 ​

bash
zweb add progress

导入 ​

样式化 Registry 组件:

tsx
import { Progress } from '@/components/ui/progress'

基础组件 React 包装器:

tsx
import { Progress } from '@zeus-web/progress/react'

Web Component 入口:

ts
import '@zeus-web/progress/wc/auto'

属性 ​

属性类型默认值说明
valuenumber-当前进度值。
maxnumber100最大进度值。
indeterminateboolean-进度是否为不确定状态。
labelstring-进度条的无障碍标签。

事件 ​

暂无公开事件。

插槽 ​

插槽说明
default可选内容。

样式 ​

使用 Tailwind: 是

主题变量:

  • bg-primary
  • bg-primary/20

内部选择器:

  • [data-slot=progress-root]
  • [data-slot=progress-indicator]

Registry ​

Registry 源码:可用。

添加命令: zweb add progress

类型: component

依赖:

  • @zeus-web/progress

Registry 依赖:

  • cn
  • globals

文件:

  • templates/react/progress.tsx → components/ui/progress.tsx
  • templates/vue/progress.ts → components/ui/progress.ts

AI 使用规则 ​

建议:

  • 使用 Progress 表示任务完成度。

避免:

  • 不要把 Progress 当作通用加载指示器。

示例 ​

React 样式化用法 ​

tsx
import { Progress } from '@/components/ui/progress'

export function Example() {
  return <Progress value={60} label="Upload progress" />
}

基于 MIT 许可证发布。