syncfusion-angular-progress-bar
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing Syncfusion Angular Progress Bar
实现Syncfusion Angular Progress Bar
The Angular Progress Bar is a lightweight component that visually represents the progress of a task or process. It supports multiple shapes (linear, circular, semi-circular), progress modes (determinate, indeterminate, buffer), animations, and comprehensive customization options.
Angular Progress Bar是一款轻量级组件,用于可视化展示任务或流程的进度。它支持多种样式(线性、圆形、半圆形)、进度模式(确定、不确定、缓冲)、动画效果以及丰富的自定义选项。
When to Use This Skill
何时使用该技能
Use this skill when:
- You need to display progress of a task in Angular
- You want to show loading states with animations
- You need different progress bar shapes (linear, circular)
- You're building download/upload progress UI
- You need accessibility-compliant progress indicators
- You want to display multiple progress states (primary + secondary)
Don't use this skill for:
- Spinners (use Skeleton Loader for loading states)
- Step indicators (use Stepper component)
- Timeline visualization (use Timeline component)
在以下场景使用该技能:
- 需要在Angular中展示任务进度
- 想要通过动画展示加载状态
- 需要不同样式的进度条(线性、圆形)
- 正在构建下载/上传进度UI
- 需要符合无障碍标准的进度指示器
- 想要展示多种进度状态(主进度 + 副进度)
请勿在以下场景使用该技能:
- 加载动画(使用Skeleton Loader展示加载状态)
- 步骤指示器(使用Stepper组件)
- 时间线可视化(使用Timeline组件)
Component Overview
组件概述
The Syncfusion Progress Bar provides:
- Multiple Shapes: Linear, Circular, SemiCircular
- Progress Modes: Determinate, Indeterminate, Buffer
- Animations: Smooth progress transitions with customizable duration and delay
- Customization: Colors (progress, track, secondary), thickness, segments, corner radius, ranges
- Segment Support: Divide progress into segments with adjustable spacing
- Accessibility: Full WCAG compliance, keyboard navigation, ARIA attributes
- Events: Progress completion, value changes, text rendering
- Reactive: Works seamlessly with Angular's change detection
Syncfusion Progress Bar提供:
- 多种样式:线性、圆形、半圆形
- 进度模式:确定、不确定、缓冲
- 动画效果:流畅的进度过渡,支持自定义时长和延迟
- 自定义选项:颜色(进度条、轨道、副进度)、厚度、分段、圆角、范围
- 分段支持:将进度条划分为多个分段,可调整分段间距
- 无障碍访问:完全符合WCAG标准,支持键盘导航、ARIA属性
- 事件:进度完成、值变更、文本渲染
- 响应式:与Angular的变更检测无缝协作
Documentation and Navigation Guide
文档与导航指南
Getting Started
快速入门
📄 Read: references/getting-started.md
- Installation and package setup
- Angular dependencies and imports
- Basic progress bar implementation
- CSS theme configuration
- Minimal working example
- Common setup patterns
📄 阅读: references/getting-started.md
- 安装与包配置
- Angular依赖与导入
- 基础进度条实现
- CSS主题配置
- 最简运行示例
- 常见配置模式
Types and Shapes
类型与样式
📄 Read: references/types-and-shapes.md
- Linear progress bar
- Circular progress bar
- Semi-circular progress bar
- Shape-specific properties
- When to use each type
- Switching between types
📄 阅读: references/types-and-shapes.md
- 线性进度条
- 圆形进度条
- 半圆形进度条
- 样式专属属性
- 各类型适用场景
- 类型切换方法
Progress Modes
进度模式
📄 Read: references/progress-modes.md
- Determinate mode (known progress)
- Indeterminate mode (unknown progress)
- Buffer mode (primary + secondary progress)
- Mode selection guidelines
- Real-world scenarios for each mode
📄 阅读: references/progress-modes.md
- 确定模式(已知进度)
- 不确定模式(未知进度)
- 缓冲模式(主进度 + 副进度)
- 模式选择指南
- 各模式的实际应用场景
Customization
自定义配置
📄 Read: references/customization.md
- Sizing and thickness
- Color configuration (progress and track)
- Min, Max, and Value properties
- Radius and InnerRadius
- Segments and segments spacing
- Advanced styling patterns
📄 阅读: references/customization.md
- 尺寸与厚度
- 颜色配置(进度条与轨道)
- 最小值、最大值与当前值属性
- 半径与内半径
- 分段与分段间距
- 高级样式模式
Features and Interactions
功能与交互
📄 Read: references/features-and-interactions.md
- Annotations and labels
- Animation configuration
- Tooltip support
- Event handling (valueChanged, progressComplete)
- Range indicators
- Reactive data binding
📄 阅读: references/features-and-interactions.md
- 注释与标签
- 动画配置
- 提示框支持
- 事件处理(valueChanged、progressComplete)
- 范围指示器
- 响应式数据绑定
Accessibility
无障碍访问
📄 Read: references/accessibility.md
- WCAG 2.1 compliance
- WAI-ARIA attributes
- Keyboard navigation support
- Screen reader considerations
- Testing accessibility
- Best practices
📄 阅读: references/accessibility.md
- 符合WCAG 2.1标准
- WAI-ARIA属性
- 键盘导航支持
- 屏幕阅读器适配考量
- 无障碍测试
- 最佳实践
Quick Start Example
快速入门示例
typescript
import { Component } from '@angular/core';
import { ProgressBarModule } from '@syncfusion/ej2-angular-progressbar';
@Component({
selector: 'app-root',
standalone: true,
imports: [ProgressBarModule],
template: `
<div style="margin: 20px;">
<!-- Linear Progress -->
<h4>File Download</h4>
<ejs-progressbar
[value]="65"
height="20"
type="Linear"
style="width: 300px;">
</ejs-progressbar>
<!-- Circular Progress -->
<h4 style="margin-top: 20px;">Task Completion</h4>
<ejs-progressbar
[value]="65"
type="Circular"
height="200"
width="200">
</ejs-progressbar>
<!-- Semi-Circular Progress -->
<h4 style="margin-top: 20px;">System Status</h4>
<ejs-progressbar
[value]="65"
type="SemiCircular"
height="200"
width="200">
</ejs-progressbar>
</div>
`
})
export class AppComponent {
}typescript
import { Component } from '@angular/core';
import { ProgressBarModule } from '@syncfusion/ej2-angular-progressbar';
@Component({
selector: 'app-root',
standalone: true,
imports: [ProgressBarModule],
template: `
<div style="margin: 20px;">
<!-- Linear Progress -->
<h4>File Download</h4>
<ejs-progressbar
[value]="65"
height="20"
type="Linear"
style="width: 300px;">
</ejs-progressbar>
<!-- Circular Progress -->
<h4 style="margin-top: 20px;">Task Completion</h4>
<ejs-progressbar
[value]="65"
type="Circular"
height="200"
width="200">
</ejs-progressbar>
<!-- Semi-Circular Progress -->
<h4 style="margin-top: 20px;">System Status</h4>
<ejs-progressbar
[value]="65"
type="SemiCircular"
height="200"
width="200">
</ejs-progressbar>
</div>
`
})
export class AppComponent {
}Common Patterns
常见模式
Pattern 1: File Upload Progress
模式1:文件上传进度
typescript
export class FileUploadComponent {
uploadProgress = 0;
onFileUpload(file: File) {
// Simulate upload
const interval = setInterval(() => {
this.uploadProgress += Math.random() * 30;
if (this.uploadProgress >= 100) {
this.uploadProgress = 100;
clearInterval(interval);
}
}, 500);
}
}typescript
export class FileUploadComponent {
uploadProgress = 0;
onFileUpload(file: File) {
// Simulate upload
const interval = setInterval(() => {
this.uploadProgress += Math.random() * 30;
if (this.uploadProgress >= 100) {
this.uploadProgress = 100;
clearInterval(interval);
}
}, 500);
}
}Pattern 2: Loading State with Animation
模式2:带动画的加载状态
typescript
export class LoadingComponent {
@Input() isLoading = false;
}Template:
html
<ejs-progressbar
*ngIf="isLoading"
[isIndeterminate]="true"
[height]="4"
[animation]="{ enable: true, duration: 2000, delay: 0 }">
</ejs-progressbar>typescript
export class LoadingComponent {
@Input() isLoading = false;
}模板:
html
<ejs-progressbar
*ngIf="isLoading"
[isIndeterminate]="true"
[height]="4"
[animation]="{ enable: true, duration: 2000, delay: 0 }">
</ejs-progressbar>Pattern 3: Multiple Progress States
模式3:多进度状态
typescript
export class DownloadComponent {
primaryProgress = 35;
secondaryProgress = 65;
}Template:
html
<ejs-progressbar
[value]="primaryProgress"
[secondaryProgress]="secondaryProgress"
type="Linear">
</ejs-progressbar>typescript
export class DownloadComponent {
primaryProgress = 35;
secondaryProgress = 65;
}模板:
html
<ejs-progressbar
[value]="primaryProgress"
[secondaryProgress]="secondaryProgress"
type="Linear">
</ejs-progressbar>Key Props Reference
关键属性参考
| Property | Type | Purpose |
|---|---|---|
| number | Current progress value (0-100 or custom min/max) |
| string | Shape: 'Linear', 'Circular', 'SemiCircular' |
| boolean | Show indeterminate state when true |
| number | Buffer/secondary progress value |
| number | Minimum value of progress range (default: 0) |
| number | Maximum value of progress range (default: 100) |
| number|string | Progress bar height in pixels or percentage |
| number|string | Progress bar width in pixels or percentage |
| number | Track line thickness |
| number | Progress bar thickness |
| number | Secondary progress thickness |
| string | Progress bar color (hex, rgb, etc) |
| string | Secondary progress color |
| string | Track background color |
| string | 'Round' | 'Square' - Corner style |
| number|string | Outer radius for circular/semi-circular bars |
| number|string | Inner radius for donut-style appearance |
| number | Divide progress into N segments |
| number | Space between segments in pixels |
| boolean | Display progress percentage text |
| AnimationModel | Animation config: {enable, duration, delay} |
| 属性 | 类型 | 用途 |
|---|---|---|
| number | 当前进度值(0-100或自定义最小/最大值) |
| string | 样式:'Linear'、'Circular'、'SemiCircular' |
| boolean | 设为true时展示不确定状态 |
| number | 缓冲/副进度值 |
| number | 进度范围的最小值(默认:0) |
| number | 进度范围的最大值(默认:100) |
| number|string | 进度条高度(像素或百分比) |
| number|string | 进度条宽度(像素或百分比) |
| number | 轨道线条厚度 |
| number | 进度条厚度 |
| number | 副进度条厚度 |
| string | 进度条颜色(十六进制、RGB等) |
| string | 副进度条颜色 |
| string | 轨道背景色 |
| string | 'Round' | 'Square' - 边角样式 |
| number|string | 圆形/半圆形进度条的外半径 |
| number|string | 环形样式的内半径 |
| number | 将进度条划分为N个分段 |
| number | 分段间的像素间距 |
| boolean | 显示进度百分比文本 |
| AnimationModel | 动画配置:{enable, duration, delay} |
Events Reference
事件参考
The Progress Bar component emits several important events:
| Event | Description | Args |
|---|---|---|
| Fired when progress value changes | |
| Fired when progress reaches 100% | |
| Fired before rendering progress text | |
Note: Use event to customize the progress label display format.
(textRender)Progress Bar组件会触发多个重要事件:
| 事件 | 描述 | 参数 |
|---|---|---|
| 进度值变更时触发 | |
| 进度达到100%时触发 | |
| 进度文本渲染前触发 | |
注意: 使用事件自定义进度标签的显示格式。
(textRender)API Reference
API参考
A complete API reference for the Syncfusion Angular is available in the folder. It includes property types, method anchors, and event arg links that map to the official docs.
ProgressBarreferencesRead the API reference: references/api-reference.md
Syncfusion Angular 的完整API参考位于文件夹中,包含属性类型、方法锚点以及映射至官方文档的事件参数链接。
ProgressBarreferences阅读API参考:references/api-reference.md
Related Components
相关组件
- Skeleton Loader - For general loading indicators
- Spinner - For indeterminate loading states
- Stepper - For step-by-step progress
- Toast - For progress notifications
- Skeleton Loader - 用于通用加载指示器
- Spinner - 用于不确定加载状态
- Stepper - 用于分步进度展示
- Toast - 用于进度通知