1e41f4b71Sopenharmony_ci# progress
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **\<Progress>** component is used to provide a progress bar that displays the progress of content loading or an operation.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Child Components
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciNot supported
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## Attributes
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci| Name| Type| Default Value| Mandatory| Description|
18e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
19e41f4b71Sopenharmony_ci| type | string | horizontal | No| Type of the progress bar, which cannot be changed dynamically. Available values are as follows:<br>- **horizontal**: linear progress bar.<br>- **arc**: arc progress bar.|
20e41f4b71Sopenharmony_ci| id | string | - | No| Unique ID of the component.|
21e41f4b71Sopenharmony_ci| style | string | - | No| Style declaration of the component.|
22e41f4b71Sopenharmony_ci| class | string | - | No| Style class of the component, which is used to refer to a style table.|
23e41f4b71Sopenharmony_ci| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.|
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ciDifferent types of progress bars support different attributes.
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci- When **type** is set to **horizontal**, the following attributes are supported.
28e41f4b71Sopenharmony_ci    | Name| Type| Default Value| Mandatory| Description|
29e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- | -------- |
30e41f4b71Sopenharmony_ci  | percent | number | 0 | No| Current progress. The value ranges from 0 to 100.|
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci- When **type** is set to **arc**, the following attributes are supported.
33e41f4b71Sopenharmony_ci    | Name| Type| Default Value| Mandatory| Description|
34e41f4b71Sopenharmony_ci  | -------- | -------- | -------- | -------- | -------- |
35e41f4b71Sopenharmony_ci  | percent | number | 0 | No| Current progress. The value ranges from 0 to 100.|
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci## Events
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci| Name| Parameter| Description|
41e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
42e41f4b71Sopenharmony_ci| click | - | Triggered when the component is clicked. |
43e41f4b71Sopenharmony_ci| longpress | - | Triggered when the component is long pressed. |
44e41f4b71Sopenharmony_ci| swipe<sup>5+</sup> | [SwipeEvent](js-lite-common-events.md) | Triggered when a user quickly swipes on the component. |
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci## Styles
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci- When **type** is set to **horizontal**, the following styles are supported.
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci  | Name        | Type          | Default Value                                        | Mandatory| Description              |
52e41f4b71Sopenharmony_ci  | ------------ | -------------- | ---------------------------------------------- | ---- | ------------------ |
53e41f4b71Sopenharmony_ci  | color        | &lt;color&gt;  | \#6b9ac7                                       | No  | Color of the progress bar.|
54e41f4b71Sopenharmony_ci  | stroke-width | &lt;length&gt; | 32<sup>1-4 </sup>\| 4<sup>5+</sup>px | No  | Stroke width of the progress bar.|
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci- When **type** is set to **arc**, the following styles are supported.
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci  | Name            | Type          | Default Value| Mandatory| Description                                                        |
59e41f4b71Sopenharmony_ci  | ---------------- | -------------- | ------ | ---- | ------------------------------------------------------------ |
60e41f4b71Sopenharmony_ci  | color            | &lt;color&gt;  | -      | No  | Color of the arc progress bar.                                          |
61e41f4b71Sopenharmony_ci  | background-color | &lt;color&gt;  | -      | No  | Background color of the arc progress bar.                                        |
62e41f4b71Sopenharmony_ci  | stroke-width     | &lt;length&gt; | -      | No  | Width of the arc progress bar.<br>A larger width value means that the progress bar is closer to the center of the circle. The width is always within the radius range.|
63e41f4b71Sopenharmony_ci  | start-angle      | &lt;deg&gt;    | 240    | No  | Start angle of the arc progress bar, which starts from the direction of zero o'clock. The value ranges from 0 to 360 degrees (clockwise).|
64e41f4b71Sopenharmony_ci  | total-angle      | &lt;deg&gt;    | 240    | No  | Total length of the arc progress bar. The value ranges from –360 to 360. A negative number indicates anticlockwise.|
65e41f4b71Sopenharmony_ci  | center-x         | &lt;length&gt; | -      | No  | Center of the arc progress bar (with the upper left corner of this widget as the coordinate origin). This style must be used together with **center-y** and **radius**.|
66e41f4b71Sopenharmony_ci  | center-y         | &lt;length&gt; | -      | No  | Center of the arc progress bar (with the upper left corner of this widget as the coordinate origin). This style must be used together with **center-x** and **radius**.|
67e41f4b71Sopenharmony_ci  | radius           | &lt;length&gt; | -      | No  | Radius of the arc progress bar. This style must be used together with **center-x** and **center-y**.        |
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ciIn addition to the preceding styles, the following styles are supported.
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci| Name| Type| Default Value| Mandatory| Description|
72e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
73e41f4b71Sopenharmony_ci| width | &lt;length&gt; \| &lt;percentage&gt;<sup>5+</sup> | - | No| Component width.<br>If this attribute is not set, the default value **0** is used.|
74e41f4b71Sopenharmony_ci| height | &lt;length&gt; \| &lt;percentage&gt;<sup>5+</sup> | - | No| Component height.<br>If this attribute is not set, the default value **0** is used.|
75e41f4b71Sopenharmony_ci| padding | &lt;length&gt; | 0 | No| Shorthand attribute to set the padding for all sides.<br>The attribute can have one to four values:<br>- If you set only one value, it specifies the padding for all the four sides.<br>- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.<br>- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.<br>- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).|
76e41f4b71Sopenharmony_ci| padding-[left\|top\|right\|bottom] | &lt;length&gt; | 0 | No| Left, top, right, and bottom padding.|
77e41f4b71Sopenharmony_ci| margin | &lt;length&gt; \| &lt;percentage&gt;<sup>5+</sup> | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:<br>- If you set only one value, it specifies the margin for all the four sides.<br>- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.<br>- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.<br>- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).|
78e41f4b71Sopenharmony_ci| margin-[left\|top\|right\|bottom] | &lt;length&gt; \| &lt;percentage&gt;<sup>5+</sup> | 0 | No| Left, top, right, and bottom margins.|
79e41f4b71Sopenharmony_ci| border-width | &lt;length&gt; | 0 | No| Shorthand attribute to set the margin for all sides.|
80e41f4b71Sopenharmony_ci| border-color | &lt;color&gt; | black | No| Shorthand attribute to set the color for all borders.|
81e41f4b71Sopenharmony_ci| border-radius | &lt;length&gt; | - | No| Radius of round-corner borders.|
82e41f4b71Sopenharmony_ci| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:<br>- **flex**: flexible layout<br>- **none**: not rendered|
83e41f4b71Sopenharmony_ci| [left\|top] | &lt;length&gt; \| &lt;percentage&gt;<sup>6+</sup> | - | No| Edge of the element.<br>- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.<br>- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. |
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci## Example
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci```html
88e41f4b71Sopenharmony_ci<!-- xxx.hml -->
89e41f4b71Sopenharmony_ci<div class="container">
90e41f4b71Sopenharmony_ci  <progress type="horizontal" percent="{{horizontalVal}}" style="height: 10%;width: 40%;" onclick = "changeHorizontal"></progress>
91e41f4b71Sopenharmony_ci  <progress type="arc" class="min-progress" percent="{{arcVal}}" on:click="changeArc"></progress>
92e41f4b71Sopenharmony_ci</div>
93e41f4b71Sopenharmony_ci```
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci```css
96e41f4b71Sopenharmony_ci/* xxx.css */
97e41f4b71Sopenharmony_ci.container {
98e41f4b71Sopenharmony_ci  flex-direction: column;
99e41f4b71Sopenharmony_ci  height: 100%;
100e41f4b71Sopenharmony_ci  width: 100%;
101e41f4b71Sopenharmony_ci  align-items: center;
102e41f4b71Sopenharmony_ci}
103e41f4b71Sopenharmony_ci.min-progress {
104e41f4b71Sopenharmony_ci  width: 300px;
105e41f4b71Sopenharmony_ci  height: 300px;
106e41f4b71Sopenharmony_ci}
107e41f4b71Sopenharmony_ci```
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ci```javascript
110e41f4b71Sopenharmony_ci// xxx.js
111e41f4b71Sopenharmony_ciexport default {
112e41f4b71Sopenharmony_ci  data: {
113e41f4b71Sopenharmony_ci    arcVal: 0,
114e41f4b71Sopenharmony_ci    horizontalVal: 0
115e41f4b71Sopenharmony_ci  },
116e41f4b71Sopenharmony_ci  changeArc() {
117e41f4b71Sopenharmony_ci    this.arcVal+= 10;
118e41f4b71Sopenharmony_ci  },
119e41f4b71Sopenharmony_ci  changeHorizontal() {
120e41f4b71Sopenharmony_ci    this.horizontalVal+= 10;
121e41f4b71Sopenharmony_ci  }
122e41f4b71Sopenharmony_ci}
123e41f4b71Sopenharmony_ci```
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ci![progress](figures/progress-lite.png)
126