@fiscozen/progress

中文文档
4.0.2发布于 2026/09/07MITES Module近 30 天下载 2436

Design System Progress component

原始使用文档
文档目录28 节
  1. Features
  2. Installation
  3. Components
  4. Basic Usage
  5. FzProgress
  6. FzProgressBar
  7. FzProgress
  8. With Custom Size
  9. FzProgressBar
  10. Basic Progress
  11. Custom Range
  12. Custom Label
  13. Contextual progress with valueText
  14. Custom Size
  15. Custom Color
  16. Props
  17. FzProgress Props
  18. FzProgressBar Props
  19. Behavior & Concepts
  20. Progress Calculation
  21. Custom Ranges
  22. Accessibility
  23. FzProgress
  24. FzProgressBar
  25. Future enhancements (nice to have)
  26. Notes
  27. Why Div Instead of HTML Progress Element?
  28. Related Components

@fiscozen/progress

Progress indicators for Vue 3 applications, including animated loading spinners and visual progress bars with customizable ranges.

Features

  • Loading Spinner: Animated spinner component for loading states
  • Progress Bar: Visual progress indicator with customizable min/max ranges
  • Custom Ranges: Support for negative values and custom ranges (e.g., -15 to 50)
  • Smooth Transitions: CSS transitions for progress bar updates
  • Accessibility: Full WCAG 2.1 AA compliance with ARIA attributes
  • TypeScript: Full type safety with TypeScript definitions

Installation

npm install @fiscozen/progress

Components

This package exports two components:

  • FzProgress - Animated loading spinner indicator
  • FzProgressBar - Visual progress bar with percentage display

Basic Usage

FzProgress

<script setup lang="ts">
import { FzProgress } from '@fiscozen/progress'
</script>

<template>
  <FzProgress />
</template>

FzProgressBar

<script setup lang="ts">
import { FzProgressBar } from '@fiscozen/progress'
</script>

<template>
  <FzProgressBar :current="50" />
</template>

FzProgress

With Custom Size

<template>
  <FzProgress size="sm" />
  <FzProgress size="lg" />
  <FzProgress size="xl" />
</template>

FzProgressBar

Basic Progress

<template>
  <!-- 0% -->
  <FzProgressBar :current="0" />
  
  <!-- 50% -->
  <FzProgressBar :current="50" />
  
  <!-- 100% -->
  <FzProgressBar :current="100" />
</template>

Custom Range

<template>
  <!-- Range from -15 to 50, current value 30 -->
  <FzProgressBar :current="30" :min="-15" :max="50" />
  
  <!-- Range from 0 to 200, current value 150 -->
  <FzProgressBar :current="150" :min="0" :max="200" />
</template>

Custom Label

<template>
  <FzProgressBar
    :current="75"
    label="Caricamento file"
  />
</template>

Contextual progress with valueText

<template>
  <FzProgressBar
    :current="3"
    :max="10"
    label="Caricamento file"
    valueText="Caricamento file 3 di 10"
  />
</template>

Custom Size

<template>
  <!-- Small size -->
  <FzProgressBar :current="50" size="sm" />
  
  <!-- Medium size (default) -->
  <FzProgressBar :current="50" size="md" />
</template>

Custom Color

<template>
  <!-- Purple (default) -->
  <FzProgressBar :current="50" color="purple" />
  
  <!-- Blue -->
  <FzProgressBar :current="50" color="blue" />
  
  <!-- Orange -->
  <FzProgressBar :current="50" color="orange" />
  
  <!-- Pink -->
  <FzProgressBar :current="50" color="pink" />
  
  <!-- Yellow -->
  <FzProgressBar :current="50" color="yellow" />
  
  <!-- Grey -->
  <FzProgressBar :current="50" color="grey" />
  
  <!-- Red (semantic error) -->
  <FzProgressBar :current="50" color="red" />
</template>

Props

FzProgress Props

PropTypeDefaultDescription
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl''lg'Spinner size
labelstring'Caricamento…'Accessible label announced via role="status" and rendered as visually-hidden text

FzProgressBar Props

PropTypeDefaultDescription
currentnumberrequiredCurrent progress value within the min-max range
maxnumber100Maximum value for progress calculation
minnumber0Minimum value for progress calculation
labelstring'Avanzamento'Accessible label announced via aria-label
valueTextstring—Optional human-readable text passed to aria-valuetext (e.g. 'Caricamento file 3 di 10')
size'sm' | 'md''md'Height of the progress bar
color'purple' | 'blue' | 'orange' | 'pink' | 'yellow' | 'grey' | 'red''purple'Color variant. yellow and red map to semantic-warning-* and semantic-error-* tokens

Behavior & Concepts

Progress Calculation

The progress bar calculates the percentage position of the current value within the [min, max] range:

percentage = ((current - min) / (max - min)) * 100

The result is clamped between 0% and 100% for CSS width.

Examples:

  • current=50, min=0, max=100 → 50%
  • current=30, min=-15, max=50 → (30 - (-15)) / (50 - (-15)) * 100 = 69%
  • current=-10, min=0, max=100 → 0% (clamped)
  • current=150, min=0, max=100 → 100% (clamped)

Custom Ranges

The component supports custom ranges including negative values:

<template>
  <!-- Temperature range: -25°C to 75°C, current 0°C -->
  <FzProgressBar
    :current="0"
    :min="-25"
    :max="75"
    label="Temperatura"
  />
  <!-- Result: (0 - (-25)) / (75 - (-25)) * 100 = 25% -->
</template>

Accessibility

FzProgress

  • Wrapper has role="status" (implicit aria-live="polite"), so screen readers announce the loading state when the spinner enters the DOM
  • aria-label defaults to 'Caricamento…', overridable via the label prop, and is mirrored as visually-hidden text for screen readers that prefer text content
  • The animation is disabled under @media (prefers-reduced-motion: reduce) to comply with WCAG 2.3.3
  • Consumer guidance: the container that toggles the spinner should set aria-busy="true" while loading, so the surrounding content is marked as not yet ready. Example:
    <div :aria-busy="loading">
      <FzProgress v-if="loading" />
      <slot v-else />
    </div>
    

FzProgressBar

Follows WCAG 2.1 AA and includes:

  • ARIA Attributes:
    • role="progressbar" for semantic meaning
    • aria-valuenow with current value (sanitized for NaN/Infinity)
    • aria-valuemin with minimum value
    • aria-valuemax with maximum value
    • aria-label from the label prop for screen reader description
    • aria-valuetext from the optional valueText prop for human-readable contextual progress
  • Reduced motion: the width transition uses motion-safe: Tailwind utilities, so it is automatically disabled under prefers-reduced-motion: reduce (WCAG 2.3.3)
  • Screen Reader Support: Progress values and contextual descriptions are accessible when navigating to the progress bar
  • Keyboard Navigation: Progress bar is accessible via keyboard (though not interactive)

Future enhancements (nice to have)

These are intentionally left out of the current API and tracked for future minor releases when a real consumer requires them:

  • Indeterminate state for FzProgressBar — a way to express "progress unknown" via animated stripes, travelling fill, or pulse, with aria-valuenow omitted (per ARIA APG). Will be added as an additive indeterminate?: boolean prop when needed.

Notes

Why Div Instead of HTML Progress Element?

We use div elements instead of the HTML <progress> element for better CSS cross-browser compatibility. The progress element requires browser-specific pseudo-elements (::-webkit-progress-bar, ::-moz-progress-bar) which can be inconsistent across browsers and harder to style with Tailwind CSS.

  • FzIcon: Used internally by FzProgress for icon rendering

版本与发布记录

@fiscozen/progress 共发布 11 个版本,首次发布于 2024/11/28;过去 12 个月发布了 9 个版本。

版本发布日期距今
4.0.2latest2026/09/072 个月前
4.0.12026/07/173 个月前
4.0.02026/04/286 个月前
3.0.12026/03/267 个月前
3.0.02026/03/038 个月前
2.0.02026/03/028 个月前

关于 @fiscozen/progress 的常见问题

@fiscozen/progress 是什么?

Design System Progress component

如何安装 @fiscozen/progress?

在项目目录运行 npm install @fiscozen/progress,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:tailwindcss(^3.4.1)、vue(^3.4.13)、@fiscozen/icons(^1.0.8)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fiscozen/progress 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fiscozen__progress 是否存在。

@fiscozen/progress 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@fiscozen/progress 可以商用吗?

@fiscozen/progress 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fiscozen/progress 的下载量有多少?

根据 npm 官方下载统计,@fiscozen/progress 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,436 次,日均约 81 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fiscozen/progress 还在维护吗?

最新版本 4.0.2 发布于 2026/09/07(2 个月前);至今共发布 11 个版本,其中过去 12 个月发布了 9 个;首次发布于 2024/11/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。