1e41f4b71Sopenharmony_ci# divider
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciThe **\<Divider>** component is used to separate content blocks and content elements. It can be used in a list or for UI layout.
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci> **NOTE**
7e41f4b71Sopenharmony_ci>
8e41f4b71Sopenharmony_ci> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Attributes
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciIn addition to the [universal attributes](js-service-widget-common-attributes.md), the following attributes are supported.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci| Name| Type| Default Value| Mandatory| Description|
15e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
16e41f4b71Sopenharmony_ci| vertical | boolean | false | No| Whether to use the vertical divider. The default value is **false**, indicating that the horizontal divider is used.|
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci## Styles
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ciOnly the following styles are supported.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci| Name| Type| Default Value| Mandatory| Description|
24e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- |
25e41f4b71Sopenharmony_ci| margin | &lt;length&gt; | 0 | No| Shorthand attribute to set the margin for all sides in a declaration. The attribute can have one to four values.|
26e41f4b71Sopenharmony_ci| margin-[left\|top\|right\|bottom] | &lt;length&gt; | 0 | No| Shorthand attribute of the length type to set left, top, right, and bottom margins attributes. Its unit is px and default value is **0**.|
27e41f4b71Sopenharmony_ci| color | &lt;color&gt; | - | No| Color of the divider.|
28e41f4b71Sopenharmony_ci| stroke-width | &lt;length&gt; | 1 | No| Stroke width of the divider.|
29e41f4b71Sopenharmony_ci| display | string | flex | No| Type of the bounding box generated by the divider. The value can be **flex** or **none**. The default value is **flex**.|
30e41f4b71Sopenharmony_ci| visibility | string | visible | No| Whether to display the divider. Invisible dividers also occupy space. **visible** indicates that the divider is displayed, and **hidden** indicates that the divider is not displayed.|
31e41f4b71Sopenharmony_ci| line-cap | string | butt | No| Cap style of the divider. The default value is **"butt"**. Available values are as follows:<br>- **"butt"**: The ends of the divider are squared off.<br>- **"round"**: A rounded cap is added to each end of the divider.<br>- **"square"**: A square cap is added to each end of the divider.<br>If the value is **"round"** or **"square"**, the divider length increases by the stroke width.|
32e41f4b71Sopenharmony_ci| flex | number | - | No| How to divide available space of the parent component for each divider. This is a shorthand attribute to set the **flex-grow** attribute.<br>This attribute takes effect only when the parent component is **\<div>**, **\<list-item>**, or **\<tabs>**.|
33e41f4b71Sopenharmony_ci| flex-grow | number | 0 | No| How much the divider will grow. The value specifies allocation of the remaining space on the main axis of the parent component. Size of available space = Container size - Total size of all child components. The value **0** indicates that the child component does not grow.<br>This attribute takes effect only when the parent component is **\<div>**, **\<list-item>**, or **\<tabs>**.|
34e41f4b71Sopenharmony_ci| flex-shrink | number | 1 | No| How much the divider will shrink. The shrink occurs only when the sum of default element widths is greater than that of the parent component. The value **0** indicates that the divider does not shrink.<br>This attribute takes effect only when the parent component is **\<div>**, **\<list-item>**, or **\<tabs>**.|
35e41f4b71Sopenharmony_ci| flex-basis | &lt;length&gt; | - | No| Initial length of the divider on the main axis.<br>This attribute takes effect only when the parent component is **\<div>**, **\<list-item>**, or **\<tabs>**.|
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci## Events
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ciNot supported
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci## Example
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci```html
47e41f4b71Sopenharmony_ci<!-- xxx.hml -->
48e41f4b71Sopenharmony_ci<div class="container">   
49e41f4b71Sopenharmony_ci  <div class="content">        
50e41f4b71Sopenharmony_ci    <divider class="divider" vertical="false"></divider>    
51e41f4b71Sopenharmony_ci  </div>
52e41f4b71Sopenharmony_ci</div>
53e41f4b71Sopenharmony_ci```
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci```css
57e41f4b71Sopenharmony_ci/* xxx.css */
58e41f4b71Sopenharmony_ci.container {    
59e41f4b71Sopenharmony_ci  margin: 20px;
60e41f4b71Sopenharmony_ci  flex-direction:column;
61e41f4b71Sopenharmony_ci  width:100%;
62e41f4b71Sopenharmony_ci  height:100%;
63e41f4b71Sopenharmony_ci  align-items:center;
64e41f4b71Sopenharmony_ci}
65e41f4b71Sopenharmony_ci.content{    
66e41f4b71Sopenharmony_ci  width:80%;
67e41f4b71Sopenharmony_ci  height:40%;
68e41f4b71Sopenharmony_ci  margin-top:100px;
69e41f4b71Sopenharmony_ci  border:1px solid #000000;
70e41f4b71Sopenharmony_ci  align-items: center;
71e41f4b71Sopenharmony_ci  justify-content: center;
72e41f4b71Sopenharmony_ci  flex-direction:column;
73e41f4b71Sopenharmony_ci}
74e41f4b71Sopenharmony_ci.divider {    
75e41f4b71Sopenharmony_ci  margin: 10px;
76e41f4b71Sopenharmony_ci  color: #ff0000ff;
77e41f4b71Sopenharmony_ci  stroke-width: 3px;
78e41f4b71Sopenharmony_ci  line-cap: round;
79e41f4b71Sopenharmony_ci}
80e41f4b71Sopenharmony_ci```
81e41f4b71Sopenharmony_ci**4 x 4 widget**
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci![divider](figures/divider.png)
84