Back to Ant Design

Progress

components/progress/index.en-US.md

6.3.75.4 KB
Original Source

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

<!-- prettier-ignore -->

<code src="./demo/line.tsx">Progress bar</code> <code src="./demo/circle.tsx">Circular progress bar</code> <code src="./demo/line-mini.tsx">Mini size progress bar</code> <code src="./demo/circle-micro.tsx">Responsive circular progress bar</code> <code src="./demo/circle-mini.tsx">Mini size circular progress bar</code> <code src="./demo/dynamic.tsx">Dynamic</code> <code src="./demo/format.tsx">Custom text format</code> <code src="./demo/dashboard.tsx">Dashboard</code> <code src="./demo/segment.tsx">Progress bar with success segment</code> <code src="./demo/linecap.tsx">Stroke Linecap</code> <code src="./demo/gradient-line.tsx">Custom line gradient</code> <code src="./demo/steps.tsx">Progress bar with steps</code> <code src="./demo/circle-steps.tsx" version="5.16.0">Circular progress bar with steps</code> <code src="./demo/size.tsx">Progress size</code> <code src="./demo/info-position.tsx" version="5.18.0">Change progress value position</code> <code src="./demo/style-class.tsx" version="6.0.0">Custom semantic dom styling</code>

API

Common props ref:Common props

Properties that shared by all types.

PropertyDescriptionTypeDefaultVersion
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-
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>-
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 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 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

<code src="./demo/_semantic.tsx" simplify="true"></code>

Design Token

<ComponentTokenTable component="Progress"></ComponentTokenTable>