JGuang

Progress

Progress · Ant Design

Preview
npm install antd@6.6.5 @ant-design/icons@6.3.4 dayjs@1.11.23

Progress

Display the current progress of the operation.

When To Use

If it will take a long time to complete an operation, you can use Progress to show the current progress and status.

  • When an operation will interrupt the current interface, or it needs to run in the background for more than 2 seconds.
  • When you need to display the completion percentage of an operation.

Examples

  • Progress bar · line
  • Circular progress bar · circle
  • Mini size progress bar · line-mini
  • Responsive circular progress bar · circle-micro
  • Mini size circular progress bar · circle-mini
  • Dynamic · dynamic
  • Custom text format · format
  • Dashboard · dashboard
  • Progress bar with success segment · segment
  • Stroke Linecap · linecap
  • Custom line gradient · gradient-line
  • Progress bar with steps · steps
  • Circular progress bar with steps · circle-steps
  • Progress size · size
  • Change progress value position · info-position
  • Custom semantic dom styling · style-class

API

Common props ref:Common props

Properties that shared by all types.

PropertyDescriptionTypeDefaultVersionGlobal Config
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.06.0.0
formatThe template function of the contentfunction(percent, successPercent)(percent) => percent + %-×
percentTo set the completion percentagenumber0-×
railColorThe color of unfilled partstring--×
showInfoWhether to display the progress value and the status iconbooleantrue-×
statusTo set the status of the Progress, options: success exception normal active(line only)string--×
strokeColorThe color of progress barstring--×
strokeLinecapTo set the style of the progress linecapround | butt | square, see stroke-linecapround-×
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.06.0.0
successConfigs of successfully progress bar{ percent: number, strokeColor: string }--×
trailColorThe color of unfilled part. Please use railColor insteadstring--×
typeTo set the type, options: line circle dashboardstringline-×
sizeProgress sizenumber | [number | string, number] | { width: number, height: number } | "small" | "medium""medium"5.3.0, Object: 5.18.0×

type="line"

PropertyDescriptionTypeDefaultVersion
stepsThe total step countnumber--
roundingThe function to round the value(step: number) => numberMath.round5.24.0
strokeColorThe color of progress bar, render linear-gradient when passing an object, could accept string[] when has steps.string | string[] | { from: string; to: string; direction: string }-4.21.0: string[]
percentPositionProgress value position, passed in object, align indicates the horizontal position of the value, type indicates whether the value is inside or outside the progress bar{ align: string; type: string }{ align: "end", type: "outer" }5.18.0

type="circle"

PropertyDescriptionTypeDefaultVersion
stepsThe total step count. When passing an object, count refers to the number of steps, and gap refers to the distance between them. When passing a number, the default value for gap is 2.number | { count: number, gap: number }-5.16.0
strokeColorThe color of circular progress, render gradient when passing an objectstring | { number%: string }--
strokeWidthTo set the width of the circular progress, unit: percentage of the canvas widthnumber6-

type="dashboard"

PropertyDescriptionTypeDefaultVersion
stepsThe total step count. When passing an object, count refers to the number of steps, and gap refers to the distance between them. When passing a number, the default value for gap is 2.number | { count: number, gap: number }-5.16.0
gapDegreeThe gap degree of half circle, 0 ~ 295number75-
gapPlacementThe gap placement, options: top bottom start endstringbottom-
gapPositionThe gap position, options: top bottom left right, please use gapPlacement insteadstringbottom-
strokeWidthTo set the width of the dashboard progress, unit: percentage of the canvas widthnumber6-

Semantic DOM

Semantic nodeNative descriptionVersion
rootRoot element, set relative positioning and basic container styles—
bodyBody element, set progress bar layout and size styles—
railRail element, set background track color and border radius styles. Not exist in steps mode—
trackTrack element, set progress fill color and transition animation styles—
indicatorIndicator element, set percentage text or icon position and font styles—

Semantic description source: vendor/components/progress/demo/_semantic.tsx

Design Token

Types, inheritance and declarations retain the pinned native source. Defaults are computed by the native theme and may be overridden by ConfigProvider; this table does not invent static defaults.

TokenTypeNative description
defaultColorstringDefault color of progress bar
remainingColorstringColor of remaining part of progress bar
circleTextColorstringText color of circular progress bar
lineBorderRadiusnumberBorder radius of line progress bar
circleTextFontSizestringText size of circular progress bar
circleIconFontSizestringIcon size of circular progress bar

Declaration source: vendor/components/progress/style/index.ts

import type { CSSObject } from '@ant-design/cssinjs';

import { Keyframes } from '@ant-design/cssinjs';

import { resetComponent } from '../../style';

import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';

import { genStyleHooks, mergeToken } from '../../theme/internal';

export interface ComponentToken {
  /**
   * @desc 进度条默认颜色
   * @descEN Default color of progress bar
   */
  defaultColor: string;
  /**
   * @desc 进度条剩余部分颜色
   * @descEN Color of remaining part of progress bar
   */
  remainingColor: string;
  /**
   * @desc 圆形进度条文字颜色
   * @descEN Text color of circular progress bar
   */
  circleTextColor: string;
  /**
   * @desc 条状进度条圆角
   * @descEN Border radius of line progress bar
   */
  lineBorderRadius: number;
  /**
   * @desc 圆形进度条文本大小
   * @descEN Text size of circular progress bar
   */
  circleTextFontSize: string;
  /**
   * @desc 圆形进度条图标大小
   * @descEN Icon size of circular progress bar
   */
  circleIconFontSize: string;
}

/**
 * @desc Progress 组件的 Token
 * @descEN Token for Progress component
 */
interface ProgressToken extends FullToken<'Progress'> {
  /**
   * @desc 进度步骤最小宽度
   * @descEN Minimum width of progress step
   */
  progressStepMinWidth: number | string;
  /**
   * @desc 进度步骤右间距
   * @descEN Right margin of progress step
   */
  progressStepMarginInlineEnd: number | string;
  /**
   * @desc 进度条动画持续时间
   * @descEN Duration of progress bar animation
   */
  progressActiveMotionDuration: string;
}

Shared native props

Tips: The following generic properties apply to most antd components; those not supported are described separately.

PropertyDescriptionTypeDefault
styleThe additional styleCSSProperties-
classNameThe additional css classstring-
rootClassNameClassName on the root elementstring-
autoFocusAuto focus when component mounted, only effective for focusable elements like forms, links, etc.booleanfalse

Install and reproduce an example

npm install antd@6.6.5 @ant-design/icons@6.3.4 dayjs@1.11.23

Use ConfigProvider and native App; configure dayjs locale separately. Each example lists its complete source files and additional pinned dependencies in View code. Example names select demos, not universal component props. See the resource setup guide for theme, locale and SSR.

Native type references

The source viewer includes unchanged native implementations and the following source declarations. Inherited types remain in their native packages. English source comments are preserved as code reference.

  • vendor/components/progress/Circle.tsx
  • vendor/components/progress/Line.tsx
  • vendor/components/progress/Steps.tsx
  • vendor/components/progress/progress.tsx
  • vendor/components/progress/style/index.ts

Source and license

https://github.com/ant-design/ant-design/tree/4a39f54842eade4e565ab336ef6097cd7e723cdd

Original bilingual prose and executable examples are retained. Website-only embeds and token tables are expanded locally. Ant Design is MIT; separately listed dependency notices also apply. Upload previews block outbound requests and do not provide a backend.