1e41f4b71Sopenharmony_ci# Progress Indicator (Progress) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ciThe **Progress** component is used to provide an indicator that shows the progress of an operation. For details, see [Progress](../reference/apis-arkui/arkui-ts/ts-basic-components-progress.md). 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci## Creating a Progress Indicator 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ciYou can create a progress indicator by calling the following API: 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci```ts 12e41f4b71Sopenharmony_ciProgress(options: {value: number, total?: number, type?: ProgressType}) 13e41f4b71Sopenharmony_ci``` 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ciIn this API, **value** indicates the initial progress, **total** indicates the total progress, and **type** indicates the style of the progress indicator. 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci```ts 19e41f4b71Sopenharmony_ciProgress({ value: 24, total: 100, type: ProgressType.Linear }) // Create a linear progress indicator whose total progress is 100 and initial progress is 24. 20e41f4b71Sopenharmony_ci``` 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci## Setting the Progress Indicator Style 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ciProgress indicators come in five styles. When creating a progress indicator, you can specify its style by setting the **ProgressType** parameter to any of the following: **ProgressType.Linear** (linear style), **ProgressType.Ring** (indeterminate ring style), **ProgressType.ScaleRing** (determinate ring style), **ProgressType.Eclipse** (eclipse style), and **ProgressType.Capsule** (capsule style). 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci- Linear style (default style) 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci >**NOTE** 34e41f4b71Sopenharmony_ci > 35e41f4b71Sopenharmony_ci > Since API version 9, the progress indicator adaptively switches to the vertical layout if its height is greater than the width and remains the horizontal layout if the height is equal to the width. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci ```ts 39e41f4b71Sopenharmony_ci Progress({ value: 20, total: 100, type: ProgressType.Linear }).width(200).height(50) 40e41f4b71Sopenharmony_ci Progress({ value: 20, total: 100, type: ProgressType.Linear }).width(50).height(200) 41e41f4b71Sopenharmony_ci ``` 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci  44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci- Indeterminate ring style 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci ```ts 48e41f4b71Sopenharmony_ci // The progress indicator in the indeterminate ring style on the left: Retain its default settings for the foreground color (blue gradient) and stroke width (2.0 vp). 49e41f4b71Sopenharmony_ci Progress({ value: 40, total: 150, type: ProgressType.Ring }).width(100).height(100) 50e41f4b71Sopenharmony_ci // The right progress indicator in the indeterminate ring style on the right. 51e41f4b71Sopenharmony_ci Progress({ value: 40, total: 150, type: ProgressType.Ring }).width(100).height(100) 52e41f4b71Sopenharmony_ci .color(Color.Grey) // Set the foreground color to gray. 53e41f4b71Sopenharmony_ci .style({ strokeWidth: 15}) // Set the stroke width to 15.0 vp. 54e41f4b71Sopenharmony_ci ``` 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci  57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci- Determinate ring style 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ci ```ts 61e41f4b71Sopenharmony_ci Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }).width(100).height(100) 62e41f4b71Sopenharmony_ci .backgroundColor(Color.Black) 63e41f4b71Sopenharmony_ci .style({ scaleCount: 20, scaleWidth: 5 }) // Set the total number of scales to 20 and the scale width to 5 vp. 64e41f4b71Sopenharmony_ci Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }).width(100).height(100) 65e41f4b71Sopenharmony_ci .backgroundColor(Color.Black) 66e41f4b71Sopenharmony_ci .style({ strokeWidth: 15, scaleCount: 20, scaleWidth: 5 }) // Set the stroke width to 15, the total number of scales to 20, and the scale width to 5 vp. 67e41f4b71Sopenharmony_ci Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }).width(100).height(100) 68e41f4b71Sopenharmony_ci .backgroundColor(Color.Black) 69e41f4b71Sopenharmony_ci .style({ strokeWidth: 15, scaleCount: 20, scaleWidth: 3 }) // Set the stroke width to 15, the total number of scales to 20, and the scale width to 3 vp. 70e41f4b71Sopenharmony_ci ``` 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci  73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ci- Eclipse style 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci ```ts 77e41f4b71Sopenharmony_ci // The progress indicator in the eclipse style on the left: Retain its default settings for the foreground color (blue). 78e41f4b71Sopenharmony_ci Progress({ value: 10, total: 150, type: ProgressType.Eclipse }).width(100).height(100) 79e41f4b71Sopenharmony_ci // The progress indicator in the eclipse style on the right: Set its foreground color to gray. 80e41f4b71Sopenharmony_ci Progress({ value: 20, total: 150, type: ProgressType.Eclipse }).color(Color.Grey).width(100).height(100) 81e41f4b71Sopenharmony_ci ``` 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci  84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_ci- Capsule style 86e41f4b71Sopenharmony_ci >**NOTE** 87e41f4b71Sopenharmony_ci > 88e41f4b71Sopenharmony_ci >- At both ends, the progress indicator in the capsule style works in a same manner as that in the eclipse style. 89e41f4b71Sopenharmony_ci >- In the middle part of the capsule, the progress indicator works in a same manner as the linear style. 90e41f4b71Sopenharmony_ci > 91e41f4b71Sopenharmony_ci >- If the height is greater than the width, the progress indicator adaptively switches to the vertical layout. 92e41f4b71Sopenharmony_ci 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci ```ts 95e41f4b71Sopenharmony_ci Progress({ value: 10, total: 150, type: ProgressType.Capsule }).width(100).height(50) 96e41f4b71Sopenharmony_ci Progress({ value: 20, total: 150, type: ProgressType.Capsule }).width(50).height(100).color(Color.Grey) 97e41f4b71Sopenharmony_ci Progress({ value: 50, total: 150, type: ProgressType.Capsule }).width(50).height(100).color(Color.Blue).backgroundColor(Color.Black) 98e41f4b71Sopenharmony_ci ``` 99e41f4b71Sopenharmony_ci 100e41f4b71Sopenharmony_ci  101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_ci## Example Scenario 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ciIn this example, the progress of the **Progress** component is updated by clicking the button. After the button is clicked, the value of **progressValue** is incremented and passed by the **value** attribute to the **Progress** component, which is then updated accordingly. 106e41f4b71Sopenharmony_ci 107e41f4b71Sopenharmony_ci```ts 108e41f4b71Sopenharmony_ci@Entry 109e41f4b71Sopenharmony_ci@Component 110e41f4b71Sopenharmony_cistruct ProgressCase1 { 111e41f4b71Sopenharmony_ci @State progressValue: number = 0 // Set the initial progress of the progress indicator to 0. 112e41f4b71Sopenharmony_ci build() { 113e41f4b71Sopenharmony_ci Column() { 114e41f4b71Sopenharmony_ci Column() { 115e41f4b71Sopenharmony_ci Progress({value:0, total:100, type:ProgressType.Capsule}).width(200).height(50).value(this.progressValue) 116e41f4b71Sopenharmony_ci Row().width('100%').height(5) 117e41f4b71Sopenharmony_ci Button ("Progress + 5") 118e41f4b71Sopenharmony_ci .onClick(()=>{ 119e41f4b71Sopenharmony_ci this.progressValue += 5 120e41f4b71Sopenharmony_ci if (this.progressValue > 100){ 121e41f4b71Sopenharmony_ci this.progressValue = 0 122e41f4b71Sopenharmony_ci } 123e41f4b71Sopenharmony_ci }) 124e41f4b71Sopenharmony_ci } 125e41f4b71Sopenharmony_ci }.width('100%').height('100%') 126e41f4b71Sopenharmony_ci } 127e41f4b71Sopenharmony_ci} 128e41f4b71Sopenharmony_ci``` 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_ci 132