<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p3248828131212"><aname="p3248828131212"></a><aname="p3248828131212"></a>Content used to generate the QR code</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p2248182810126"><aname="p2248182810126"></a><aname="p2248182810126"></a>QR code type. Available values are as follows:</p>
<aname="ul19772143474918"></a><aname="ul19772143474918"></a><ulid="ul19772143474918"><li><strongid="b1932091716183"><aname="b1932091716183"></a><aname="b1932091716183"></a>rect</strong>: rectangular QR code</li><li><strongid="b13684142218183"><aname="b13684142218183"></a><aname="b13684142218183"></a>circle</strong>: round QR code</li></ul>
</td>
</tr>
</tbody>
</table>
## Styles<a name="section439317598552"></a>
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
>- If the values of **width** and **height** are different, the smaller value is used as the length of the QR code. The generated QR code is center displayed.
>- If either **width** or **height** is set, the value is used as the length of the QR code. If neither of them is set, the default length is 200 px.
## Events<a name="section1948820711216"></a>
Events in [Universal Events](js-components-common-events.md) are supported.
## Methods<a name="section2279124532420"></a>
Methods in [Universal Methods](js-components-common-methods.md) are supported.
## Example<a name="section81001951259"></a>
```
## Attributes
In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported.
| Name | Type | Default Value | Mandatory | Description |
| color | <color> | \#000000 | No | Color of the QR code. |
| background-color | <color> | \#ffffff | No | Background color of the QR code.|
> **NOTE**
> - If the values of **width** and **height** are different, the smaller value is used as the length of the QR code. The generated QR code is centered.
>
>
> - If either **width** or **height** is set, the value is used as the length of the QR code. If neither of them is set, the default length 200 px is used.
>
## Events
The [universal events](../arkui-js/js-components-common-events.md) are supported.
## Methods
The [universal methods](../arkui-js/js-components-common-methods.md) are supported.
The atomic layout implements adaptive layout for screens of different sizes and types. Designers can use the atomic layout to define adaptive rules for elements on UIs of different forms. Developers can use the atomic layout to implement the adaptive UI features matching the design effect for a variety of screens.
> This component is supported since API version 5. Updates will be marked with a superscript to indicate their earliest API version.
## Hiding Components
You can set priority flags for a flex layout that does not support cross-row display to define the display priorities for elements in the horizontal or vertical direction. The elements are hidden based on available space of the container.
<tdclass="cellrowborder"valign="top"width="59.5%"headers="mcps1.1.5.1.4 "><pid="p75481189562"><aname="p75481189562"></a><aname="p75481189562"></a>Hide child components according to the ascending order of their <strongid="b9988192710556"><aname="b9988192710556"></a><aname="b9988192710556"></a>display-index</strong> values when the space on the flex main axis of the container is insufficient to display all content.</p>
<pid="p11989182765511"><aname="p11989182765511"></a><aname="p11989182765511"></a>Child components with the same <strongid="b189887271559"><aname="b189887271559"></a><aname="b189887271559"></a>display-index</strong> value are hidden at the same time.</p>
<pid="p1363375318"><aname="p1363375318"></a><aname="p1363375318"></a>You can use the default value (<strongid="b1163178316"><aname="b1163178316"></a><aname="b1163178316"></a>0</strong>) for a child component, which means that it will be hidden.</p>
<pid="p3505181129"><aname="p3505181129"></a><aname="p3505181129"></a>This style is applicable only to child components in a container that supports the flex layout, such as <strongid="b16943743133013"><aname="b16943743133013"></a><aname="b16943743133013"></a><div></strong>.</p>
</td>
</tr>
</tbody>
</table>
| Name | Type| Description|
| -------- | -------- | -------- |
| display-index | number | Display index of a child component. Child components are hidden according to the ascending order of their **display-index** values when the space on the flex main axis of the container is insufficient to display all content. Child components with the same display-index value are hidden at the same time.<br>Default value: **0** (means not to hide the child component)|
## Proportion
## Proportion<a name="section13725752194418"></a>
In a flex layout that does not support cross-row display, child components with the proportion style configured are always arranged with the set proportions in the container.
In a flex layout that does not support cross-row display, elements with the proportion style configured are always arranged with the set proportions in the container.
| Name | Type| Description|
| -------- | -------- | -------- |
| flex-weight | number | Size weight of a child component on the flex main axis. If this style is set for all child components in the container: Child component size = Container main axis size x flex-weight / Sum of size weights of all child components. If this style is set for only some child components in the container, the container first lays out the child components for which this style is not set and then allocates the remaining space to the set child components. Size of the set child component = Remaining space x flex-weight / Sum of size weights of all child components.|
<tdclass="cellrowborder"valign="top"width="59.5%"headers="mcps1.1.5.1.4 "><pid="p234101512916"><aname="p234101512916"></a><aname="p234101512916"></a>Size weight of an element on the flex main axis. </p>
<pid="p5749319913"><aname="p5749319913"></a><aname="p5749319913"></a>Element size = Container main axis size x <strongid="b37418311916"><aname="b37418311916"></a><aname="b37418311916"></a>flex-weight</strong> / Sum of all element size weights. </p>
<pid="p337111112521"><aname="p337111112521"></a><aname="p337111112521"></a>This style takes effect only when it is set for all elements in the container.</p>
</td>
</tr>
</tbody>
</table>
## Fixed Ratio<a name="section922215811557"></a>
## Fixed Ratio
A component with fixed ratio can be scaled up and down while retaining its aspect ratio.
<tdclass="cellrowborder"valign="top"width="59.5%"headers="mcps1.1.5.1.4 "><pid="p12776121918313"><aname="p12776121918313"></a><aname="p12776121918313"></a>Aspect ratio of the component. The value is a floating-point value greater than 0.</p>
<pid="p3793145491117"><aname="p3793145491117"></a><aname="p3793145491117"></a>The value is subjective to the upper and lower limits of the component size.</p>
<pid="p15216164731415"><aname="p15216164731415"></a><aname="p15216164731415"></a>In a flex layout, the main axis size is adjusted first, based on which the cross axis size is adjusted.</p>
</td>
</tr>
</tbody>
</table>
| Name | Type| Description|
| -------- | -------- | -------- |
| aspect-ratio | number | Aspect ratio of the component. The value is a floating-point value greater than 0.<br>The value is subjective to the upper and lower limits of the component size.<br>In a flex layout, the main axis size is adjusted first, based on which the cross axis size is adjusted.|
# Custom Font Styles<a name="EN-US_TOPIC_0000001173324599"></a>
**font-face** is used to define the font style. You can define **font-face** in **style** to specify a font name and resource for your application and then reference this font from **font-family**.
# Custom Font Styles
The custom font can be loaded from the font file in a project. The font file must be in .ttf or .otf format.
> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
## Defining @font-face
```
@font-face {
...
...
@@ -19,29 +22,31 @@ Customize a font.
**src**
Supported sources of customized fonts:
Supported sources of custom fonts:
- Font file in the project: Specify the absolute path of the font file in the project through **url**. For details, see [File Access Rules](../../ui/js-framework-file.md).
- Font file in the project: Specify the path of the font file in the project through **url**. \(You can use absolute paths only. For details, see [Resources and File Access Rules](../../ui/js-framework-file.md#section6620355202117).\)
-You can set only one **src** attribute.
- You can set only one **src** attribute.
## Using font-face<a name="section713052011710"></a>
## Using font-face
You can set **font-face** in **style** and specify the name of the **font-face** using **font-family**.
You can set **font-face** in **style** and specify the name of the **font-face** using**font-family**.
**Example**
Page layout:
```
```html
<!-- xxx.hml -->
<div>
<text class="demo-text">Test the customized font.</text>
<textclass="demo-text">Test the custom font.</text>
| flex-direction | string | row | No | Main axis direction of the flex container, which defines how items are placed in the container. Available values are as follows:<br>- **column**: Items are placed vertically from top to bottom.<br>- **row**: Items are placed horizontally from left to right.|
| flex-wrap | string | nowrap | No | Whether items in the flex container are displayed in a single line or multiple lines. The value cannot be dynamically updated. Available values are as follows:<br>- **nowrap**: Items are displayed on a single axis.<br>- **wrap**: Items are displayed on multiple axes.|
| justify-content | string | flex-start | No | How items are aligned along the main axis of the flex container. Available values are as follows:<br>- **flex-start**: Items are packed towards the start row.<br>- **flex-end**: Items are packed towards the end row.<br>- **center**: Items are centered along the row.<br>- **space-between**: Items are positioned with space between the rows.<br>- **space-around**: Items are positioned with space before, between, and after the rows.<br>- **space-evenly**<sup>5+</sup>: Items are arranged with even space between each two.|
| align-items | string | stretch<br>| No | How items are aligned along the cross axis of the flex container. Available values are as follows:<br>- **stretch**: Items are stretched to the same height or width as the container in the cross axis direction.<br>- **flex-start**: Items are aligned to the start of the cross axis.<br>- **flex-end**: Items are aligned to the end of the cross axis.<br>- **center**: Items are aligned in the center of the cross axis.|
| align-content | string | flex-start | No | Multi-row alignment mode when there is extra space in the cross axis. Available values are as follows:<br>- **flex-start**: All rows are packed towards the start of the cross axis. The start edge of the cross axis of the first row is aligned with the start edge of the cross axis of the container. All subsequent rows are aligned with the previous row.<br>- **flex-end**: All rows are packed towards the end of the cross axis. The end of the cross axis of the last row is aligned with the end of the cross axis of the container. All subsequent rows are aligned with the previous row.<br>- **center**: All rows are packed towards the center of the container. Rows are close to each other and aligned with the center of the container. The spacing between the start edge of the container's cross axis and the first row is equal to the spacing between the end edge of the container's cross axis and the last row.<br>- **space-between**: All rows are evenly distributed in the container. The spacing between two adjacent rows is the same. The start and end edges of the container's cross axis are aligned with the edges of the first and last rows, respectively.<br>- **space-around**: All rows are evenly distributed in the container, and the spacing between two adjacent lines is the same. The spacing between the start edge of the container's cross axis and the first row and that between the end edge and the last row are half of the spacing between two adjacent rows.|
| display | string | flex | No | Type of the view box of the item. The value cannot be dynamically updated. Available values are as follows:<br>- **flex**: flexible layout.<br>- **grid**: grid layout.<br>- **none**: The box is disabled.<br>- **inline-flex**<sup>9+</sup>: layout with the **flex** and **inline-block** effects.|
| grid-template-[columns\|rows] | string | 1 row, 1 column | No | Number of rows and columns in the current grid layout. If this attribute is not set, one row and one column are displayed by default. This attribute is valid only when **display** is set to **grid**.<br>Below are some example values of **grid-template-columns**:<br>- **50px 100px 60px**: There are three columns. The first column is 50 px, the second column is 100 px, and the third column is 60 px.<br>- **1fr 1fr 2fr**: There are three columns, and the width allowed by the parent component is divided into four equal shares. The first column occupies one share, the second column occupies one share, and the third column occupies two shares.<br>- **30% 20% 50%**: There are three columns. The first column occupies 30% of the total width allowed by the parent component, the second column occupies 20%, and the third column occupies 50%.<br>- **repeat (2,100px)**: There are two columns. The first column is 100 px, and the second column is 100 px.<br>- **repeat(auto-fill,100px)**<sup>5+</sup>: Each column is 100 px and repeats to fill the cross axis. The number of columns is calculated based on the column size and the cross axis size.<br>- **auto 1fr 1fr**: There are three columns. The first column is adaptive to the width required by its child components. The remaining space is divided into two equal shares, one share occupied by each of the rest two columns.|
| grid-[columns\|rows]-gap | \<length> | 0 | No | Size of the gap between two consecutive rows or columns in a grid layout. You can also use **grid-gap** to set the same size of the gap between rows and columns. This attribute is valid only when **display** is set to **grid**.|
| grid-row-[start\|end] | number | - | No | Start and end row numbers of the current item in the grid layout. This attribute is valid only when the item's parent component is a **\<div>** container whose **display** style is set to **grid**.|
| grid-column-[start\|end] | number | - | No | Start and end column numbers of the current item in the grid layout. This attribute is valid only when the item's parent component is a **\<div>** container whose **display** style is set to **grid**.|
| grid-auto-flow<sup>5+</sup> | string | - | No | How grid items are laid out automatically. Available values are as follows:<br>- **row**: Elements are filled row by row. When there is no horizontal space in a row, a new row is added.<br>- **column**: Elements are filled column by column. When there is no vertical space in a column, a new column is added.|
| overflow<sup>6+</sup> | string | visible | No | Display mode when the content exceeds the container size. Available values are as follows:<br>- **visible**: Displays the extra content outside the container.<br>- **hidden**: Truncates the excess content.<br>- **scroll**: Scrolls the content vertically, with a scrollbar provided.<br>**scroll** works for elements whose size is fixed. By default, the scrolling direction is the same as the container direction.|
| align-items<sup>6+</sup> | string | - | No | How items are aligned along the cross axis in a flex container. Available values are as follows:<br>- **stretch**: Items are stretched to the same height or width as the container in the cross axis direction.<br>- **flex-start**: Items are aligned to the start of the cross axis.<br>- **flex-end**: Items are aligned to the end of the cross axis.<br>- **center**: Items are aligned in the center of the cross axis.<br>- **baseline**: In a vertical layout, items are aligned to the start of the cross axis, which means that this value is equivalent of **flex-start**. In a horizontal layout, items are aligned with the text baseline if there is text involved, and aligned to the bottom otherwise.|
| scrollbar-color<sup>6+</sup> | \<color> | - | No | Color of the scrollbar. |
| scrollbar-width<sup>6+</sup> | \<length> | - | No | Width of the scrollbar. |
| overscroll-effect<sup>6+</sup> | string | - | No | How the scrollbar behaves when it reaches the edge of the scrolling area. Available values are as follows:<br>- **spring**: Similar to the physical dynamic effect of a spring. After scrolling to the edge, you can continue to scroll for a distance based on the initial speed or by touching the knob of the scrollbar. After you release your hand, the knob is rebounded.<br>- **fade**: Similar to the physical dynamic effect of fade. When you scroll to the edge, a wave shape fades. The fade changes according to the speed and scrolling distance.<br>- **none**: No effect after the scroll bar is moved to the edge.|
| Name | Type | Default Value | Mandatory| Description |
| flex-direction | string | row | No | Main axis direction of the flex container, which defines how items are placed in the container. Available values are as follows:<br>- **column**: Items are placed vertically from top to bottom.<br>- **row**: Items are placed horizontally from left to right.|
| flex-wrap | string | nowrap | No | Whether items in the flex container are displayed in a single line or multiple lines. The value cannot be dynamically updated. Available values are as follows:<br>- **nowrap**: Flex items are displayed in a single line.<br>- **wrap**: Flex items are displayed in multiple lines.|
| justify-content | string | flex-start | No | How items are aligned along the main axis of the flex container. Available values are as follows:<br>- **flex-start**: Items are packed toward the start edge of the container along the main axis.<br>- **flex-end**: Items are packed toward the end edge of the container along the main axis.<br>- **center**: Items are packed toward the center of the container along the main axis.<br>- **space-between**: Items are positioned with space between the rows.<br>- **space-around**: Items are positioned with space before, between, and after the rows.<br>- **space-evenly**<sup>5+</sup>: Items are distributed within the container along the main axis, with even space between each two.|
| align-items | string | stretch<br>| No | How items are aligned along the cross axis of the flex container. Available values are as follows:<br>- **stretch**: Items are stretched to the same height or width as the container along the cross axis.<br>- **flex-start**: Items are packed toward the start edge of the cross axis.<br>- **flex-end**: Items are packed toward the end edge of the cross axis.<br>- **center**: Items are packed toward the center of the cross axis.<br>- **baseline**: In a vertical layout, items are aligned to the start of the cross axis, which means that this value is equivalent of **flex-start**. In a horizontal layout, items are aligned with the text baseline if there is text involved, and aligned to the bottom otherwise.|
| align-content | string | flex-start | No | Multi-row alignment mode when there is extra space in the cross axis. Available values are as follows:<br>- **flex-start**: All rows are packed toward the start edge of the cross axis. The start edge of the cross axis of the first row is aligned with the start edge of the cross axis of the container. All subsequent rows are aligned with the previous row.<br>- **flex-end**: All rows are packed toward the end edge of the cross axis. The end of the cross axis of the last row is aligned with the end of the cross axis of the container. All subsequent rows are aligned with the previous row.<br>- **center**: All rows are packed toward the center of the cross axis. Rows are close to each other and aligned with the center of the container. The spacing between the start edge of the container's cross axis and the first row is equal to the spacing between the end edge of the container's cross axis and the last row.<br>- **space-between**: All rows are evenly distributed in the container. The spacing between two adjacent rows is the same. The start and end edges of the container's cross axis are aligned with the edges of the first and last rows, respectively.<br>- **space-around**: All rows are evenly distributed in the container. The spacing between two adjacent rows is the same. The spacing between the start edge of the container's cross axis and the first row and that between the end edge and the last row are half of the spacing between two adjacent rows.|
| display | string | flex | No | Type of the view box of the item. The value cannot be dynamically updated. Available values are as follows:<br>- **flex**: flexible layout<br>- **grid**: grid layout<br>- **none**: not rendered<br>- **inline-flex**<sup>9+</sup>: layout with the **flex** and **inline-block** effects.|
| grid-template-[columns\|rows] | string | 1 row, 1 column | No | Number of rows and columns in the current grid layout. If this attribute is not set, one row and one column are displayed by default. This attribute is valid only when **display** is set to **grid**.<br>Below are some example values of **grid-template-columns**:<br>- **50px 100px 60px**: There are three columns. The first column is 50 px, the second column is 100 px, and the third column is 60 px.<br>- **1fr 1fr 2fr**: There are three columns, and the width allowed by the parent component is divided into four equal shares. The first column occupies one share, the second column occupies one share, and the third column occupies two shares.<br>- **30% 20% 50%**: There are three columns. The first column occupies 30% of the total width allowed by the parent component, the second column occupies 20%, and the third column occupies 50%.<br>- **repeat (2,100px)**: There are two columns. The first column is 100 px, and the second column is 100 px.<br>- **repeat(auto-fill,100px)**<sup>5+</sup>: Each column is 100 px and repeats to fill the cross axis. The number of columns is calculated based on the column size and the cross axis size.<br>- **auto 1fr 1fr**: There are three columns. The first column is adaptive to the width required by its child components. The remaining space is divided into two equal shares, one share occupied by each of the rest two columns.|
| grid-[columns\|rows]-gap | <length> | 0 | No | Size of the gap between two consecutive rows or columns in a grid layout. You can also use **grid-gap** to set the same size of the gap between rows and columns. This attribute is valid only when **display** is set to **grid**.|
| grid-row-[start\|end] | number | - | No | Start and end row numbers of the current item in the grid layout. This attribute is valid only when the item's parent component is a **\<div>** container whose **display** style is set to **grid**.|
| grid-column-[start\|end] | number | - | No | Start and end column numbers of the current item in the grid layout. This attribute is valid only when the item's parent component is a **\<div>** container whose **display** style is set to **grid**.|
| grid-auto-flow<sup>5+</sup> | string | - | No | How grid items are laid out automatically. Available values are as follows:<br>- **row**: Elements are filled row by row. When there is no horizontal space in a row, a new row is added.<br>- **column**: Elements are filled column by column. When there is no vertical space in a column, a new column is added.|
| overflow<sup>6+</sup> | string | visible | No | Display mode when the content exceeds the container size. Available values are as follows:<br>- **visible**: Displays the excess content outside the container.<br>- **hidden**: Truncates the excess content.<br>- **scroll**: Scrolls the content vertically, with a scrollbar provided.<br>**scroll** works for elements whose size is fixed. By default, the scrolling direction is the same as the container direction.|
| align-items<sup>6+</sup> | string | - | No | How items are aligned along the cross axis in a flex container. Available values are as follows:<br>- **stretch**: Items are stretched to the same height or width as the flex container along the cross axis.<br>- **flex-start**: Items are aligned to the start of the cross axis.<br>- **flex-end**: Items are aligned to the end of the cross axis.<br>- **center**: Items are aligned in the center of the cross axis.<br>- **baseline**: In a vertical layout, items are aligned to the start of the cross axis, which means that this value is equivalent of **flex-start**. In a horizontal layout, items are aligned with the text baseline if there is text involved, and aligned to the bottom otherwise.|
| scrollbar-color<sup>6+</sup> | <color> | - | No | Color of the scrollbar. |
| scrollbar-width<sup>6+</sup> | <length> | - | No | Width of the scrollbar. |
| overscroll-effect<sup>6+</sup> | string | - | No | How the scrollbar behaves when it reaches the edge of the scrolling area. Available values are as follows:<br>- **spring**: Similar to the physical dynamic effect of a spring. When the scrollbar reaches the edge, it can continue to scroll for a distance based on the initial speed or a touch event. It rebounds after being released.<br>- **fade**: Similar to the physical dynamic effect of fade. When the scrollbar reaches the edge, a wave shape fades. The fade changes according to the speed and scrolling distance.<br>- **none**: No effect when the scrollbar reaches the edge.|
## Events
...
...
@@ -59,7 +61,7 @@ In addition to the [universal events](../arkui-js/js-components-common-events.md
In addition to the [universal methods](js-components-common-methods.md), the following methods are supported.
| getScrollOffset<sup>6+</sup> | - | ScrollOffset | Obtains the scrolling offset of the element content.<br>To use this method, **overflow** must be set to **scroll**.|
| scrollBy<sup>6+</sup> | ScrollParam | - | Sets the scrolling offset of the element content.<br>To use this method, **overflow** must be set to **scroll**.|
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p46212038248"><aname="p46212038248"></a><aname="p46212038248"></a>Button text at the bottom of the customized step navigator. Dynamic modification is not supported. If this attribute is not set, <strongid="b244691335510"><aname="b244691335510"></a><aname="b244691335510"></a>BACK</strong> and <strongid="b128548113558"><aname="b128548113558"></a><aname="b128548113558"></a>NEXT</strong> will be used by default as button text in case the system language is not Chinese. For the first step, there is no previous button. For the last step, the text on the next button is <strongid="b8844136185718"><aname="b8844136185718"></a><aname="b8844136185718"></a>START</strong> for non-Chinese languages by default.</p>
<tdclass="cellrowborder"valign="top"width="71.41%"headers="mcps1.2.5.1.4 "><pid="p8969202219"><aname="p8969202219"></a><aname="p8969202219"></a>Text content of the previous button at the bottom of the step navigator.</p>
<tdclass="cellrowborder"valign="top"width="71.41%"headers="mcps1.2.5.1.4 "><pid="p159691801223"><aname="p159691801223"></a><aname="p159691801223"></a>Text content of the next button at the bottom of the step navigator.</p>
<tdclass="cellrowborder"valign="top"width="71.41%"headers="mcps1.2.5.1.4 "><pid="p491230493"><aname="p491230493"></a><aname="p491230493"></a>Initial status of the current step in the step navigator. Available values are as follows:</p>
<aname="ul15229514162318"></a><aname="ul15229514162318"></a><ulid="ul15229514162318"><li><strongid="b1154153512114"><aname="b1154153512114"></a><aname="b1154153512114"></a>normal</strong>: The right button is clickable and can navigate users to the next step when it is clicked.</li></ul>
<aname="ul5182101916236"></a><aname="ul5182101916236"></a><ulid="ul5182101916236"><li><strongid="b24961139713"><aname="b24961139713"></a><aname="b24961139713"></a>disabled</strong>: The right button is grayed out and unavailable.</li></ul>
<aname="ul16451423182317"></a><aname="ul16451423182317"></a><ulid="ul16451423182317"><li><strongid="b193436428112"><aname="b193436428112"></a><aname="b193436428112"></a>waiting</strong>: The right button is not displayed, and a progress bar is displayed instead.</li></ul>
</td>
</tr>
</tbody>
</table>
## Styles<a name="section1326042123512"></a>
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
<tdclass="cellrowborder"valign="top"width="40.01599840015999%"headers="mcps1.1.6.1.5 "><pid="p536014229815"><aname="p536014229815"></a><aname="p536014229815"></a>Whether the text size changes with the system's font size settings.</p>
<tdclass="cellrowborder"valign="top"width="40.01599840015999%"headers="mcps1.1.6.1.5 "><pid="p10377104215812"><aname="p10377104215812"></a><aname="p10377104215812"></a>Text font style. Available values are as follows:</p>
<aname="ul6878946122313"></a><aname="ul6878946122313"></a><ulid="ul6878946122313"><li><strongid="b696623911113"><aname="b696623911113"></a><aname="b696623911113"></a>normal</strong>: standard font style</li><li><strongid="b157518456114"><aname="b157518456114"></a><aname="b157518456114"></a>italic</strong>: italic font style</li></ul>
<tdclass="cellrowborder"valign="top"width="40.01599840015999%"headers="mcps1.1.6.1.5 "><pid="p107081551486"><aname="p107081551486"></a><aname="p107081551486"></a>Text font weight. The number value must be an exact multiple of 100 ranging from 100 to 900. The default value is 400. A larger value indicates a bigger weight. Available values of the string type are <strongid="b5723193018461"><aname="b5723193018461"></a><aname="b5723193018461"></a>lighter</strong>, <strongid="b2072493013464"><aname="b2072493013464"></a><aname="b2072493013464"></a>normal</strong>, <strongid="b8724173034612"><aname="b8724173034612"></a><aname="b8724173034612"></a>bold</strong>, or <strongid="b127259306468"><aname="b127259306468"></a><aname="b127259306468"></a>bolder</strong>.</p>
<tdclass="cellrowborder"valign="top"width="40.01599840015999%"headers="mcps1.1.6.1.5 "><pid="p169212584815"><aname="p169212584815"></a><aname="p169212584815"></a>Text decoration. Available values are as follows:</p>
<aname="ul1768145382318"></a><aname="ul1768145382318"></a><ulid="ul1768145382318"><li><strongid="b1627816474112"><aname="b1627816474112"></a><aname="b1627816474112"></a>underline</strong>: An underline is used.</li><li><strongid="b245013501810"><aname="b245013501810"></a><aname="b245013501810"></a>line-through</strong>: A strikethrough is used.</li><li><strongid="b27555510116"><aname="b27555510116"></a><aname="b27555510116"></a>none</strong>: The standard text is used.</li></ul>
<tdclass="cellrowborder"valign="top"width="40.01599840015999%"headers="mcps1.1.6.1.5 "><pid="p18361661099"><aname="p18361661099"></a><aname="p18361661099"></a>Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the font specified by <ahref="js-components-common-customizing-font.md">Custom Font Styles</a> is used for the text.</p>
>- Height and width styles are not supported. The width of each item is the same as that of its container. The height of each item is the difference between the container height and the bottom button height.
>- The **posit** style is not supported.
## Events<a name="section121081858163714"></a>
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
<tdclass="cellrowborder"valign="top"width="45.5945594559456%"headers="mcps1.1.4.1.3 "><pid="p18545172132717"><aname="p18545172132717"></a><aname="p18545172132717"></a>Triggered when this step is displayed.</p>
<tdclass="cellrowborder"valign="top"width="45.5945594559456%"headers="mcps1.1.4.1.3 "><pid="p14545162142719"><aname="p14545162142719"></a><aname="p14545162142719"></a>Triggered when this step disappears.</p>
</td>
</tr>
</tbody>
</table>
## Methods<a name="section2279124532420"></a>
Methods in [Universal Methods](js-components-common-methods.md) are not supported.
## Example<a name="section10326712123215"></a>
For details, see the [stepper example code](js-components-container-stepper.md).
## Attributes
In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| label | Label | No| Button text at the bottom of the customized step navigator. Dynamic modification is not supported. If this attribute is not set, **BACK** and **NEXT** will be used by default as button text in case the system language is not Chinese. For the first step, there is no previous button. For the last step, the text on the next button is **START** for non-Chinese languages by default.|
**Table 1** label
| Name| Type| Default Value| Description|
| -------- | -------- | -------- | -------- |
| prevLabel | string | - | Text content of the previous button at the bottom of the step navigator.|
| nextLabel | string | - | Text content of the next button at the bottom of the step navigator.|
| status | string | normal | Initial status of the current step in the step navigator. Available values are as follows:<br>- **normal**: The right button is clickable and can navigate users to the next step when it is clicked.<br>- **disabled**: The right button is grayed out and unavailable.<br>- **waiting**: The right button is not displayed, and a progress bar is displayed instead.|
## Styles
In addition to the [universal styles](../arkui-js/js-components-common-styles.md), the following styles are supported.
| font-size | <length> | - | No| Text size.|
| allow-scale | boolean | true | No| Whether the font size changes with the system's font size settings.|
| font-style | string | normal | No| Text font style. Available values are as follows:<br>- **normal**: standard font style<br>- **italic**: italic font style|
| font-weight | number\|string | normal | No| Text font weight. The number value must be an exact multiple of 100 ranging from 100 to 900. The default value is 400. A larger value indicates a bigger weight. Available values of the string type are **lighter**, **normal**, **bold**, or **bolder**.|
| text-decoration | string | none | No| Text decoration. Available values are as follows:<br>- **underline**: An underline is used.<br>- **line-through**: A strikethrough is used.<br>- **none**: The standard text is used.|
| font-family | string | sans-serif | No| Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the specified [custom font](../arkui-js/js-components-common-customizing-font.md) is used for the text.|
> **NOTE**
> - Height and width styles are not supported. The width of each item is the same as that of its container. The height of each item is the difference between the container height and the bottom button height.
>
> - The **posit** style is not supported.
## Events
In addition to the [universal events](../arkui-js/js-components-common-events.md), the following events are supported.
| Name| Parameter| Description|
| -------- | -------- | -------- |
| appear | - | Triggered when this step is displayed.|
| disappear | - | Triggered when this step disappears.|
## Method
The [universal methods](../arkui-js/js-components-common-methods.md) are supported.
## Example
For details, see **Example** in [stepper](../arkui-js/js-components-container-stepper.md).
**<tab-content\>** is a child component of [<tabs\>](js-components-container-tabs.md) and is used to provide the area for displaying the tab content. By default, its height is such that all the remaining space of the **<tabs\>** component is filled. The child components are arranged horizontally. When **<tab-content\>** is used as a child element in a container, the length on the main axis direction must be specified. Otherwise, the child element cannot be displayed.
**<tab-content\>**is a child component of **[<tabs\>](js-components-container-tabs.md)** and is used to provide the area for displaying the tab content. By default, its height is such that all the remaining space of the **<tabs\>** component is filled. The child components are arranged horizontally. When **<tab-content\>** is used as a child element in a container, its length along the main axis must be specified. Otherwise, it cannot be displayed.
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p1062618163010"><aname="p1062618163010"></a><aname="p1062618163010"></a>Whether the tabs can be switched by swiping left or right. The default value is <strongid="b84843195512"><aname="b84843195512"></a><aname="b84843195512"></a>true</strong>. If this attribute is set to <strongid="b1775133913552"><aname="b1775133913552"></a><aname="b1775133913552"></a>false</strong>, tab switching is implemented only through the association with <strongid="b6395111416560"><aname="b6395111416560"></a><aname="b6395111416560"></a>tab-bar</strong>.</p>
</td>
</tr>
</tbody>
</table>
## Styles<a name="section15751323144115"></a>
Styles in [Universal Styles](js-components-common-styles.md) are supported.
Events in [Universal Events](js-components-common-events.md) are supported.
## Example<a name="section11929165914411"></a>
For details, see the [tabs example code](js-components-container-tabs.md#section14993155318710).
## Attributes
In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported.
| Name | Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| scrollable | boolean | No| Whether the tabs can be switched by swiping left or right. The default value is **true**. If this attribute is set to **false**, tab switching is implemented only through the association with **tab-bar**.|
## Styles
The [universal styles](../arkui-js/js-components-common-styles.md) are supported.
## Events
The [universal events](../arkui-js/js-components-common-events.md) are supported.
## Example
For details, see **Example** in [tabs](../arkui-js/js-components-container-tabs.md#example).
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p62121758111517"><aname="p62121758111517"></a><aname="p62121758111517"></a>X-coordinate of the circle center. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p125961416161611"><aname="p125961416161611"></a><aname="p125961416161611"></a>Y-coordinate of the circle center. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p78950185420"><aname="p78950185420"></a><aname="p78950185420"></a>Radius of the circle. Attribute animations are supported.</p>
</td>
</tr>
</tbody>
</table>
## Example<a name="section360556124815"></a>
```
## Child Components
The following are supported: [\<animate>](js-components-svg-animate.md), [\<animateMotion>](js-components-svg-animatemotion.md), and [\<animateTransform>](js-components-svg-animatetransform.md).
## Attributes
The [universal attributes](../arkui-js/js-components-svg-common-attributes.md) and the attributes listed below are supported.
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Fill color of an element using the shorthand attribute. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="adbe7ecbee96b4f938b04a4b8d62791bf"><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a>Opacity of a fill color. The value ranges from <strongid="b372234019102"><aname="b372234019102"></a><aname="b372234019102"></a>0</strong> to <strongid="b572294061011"><aname="b572294061011"></a><aname="b572294061011"></a>1</strong>. The value <strongid="b13723174011104"><aname="b13723174011104"></a><aname="b13723174011104"></a>1</strong> means opaque, and <strongid="b157233405107"><aname="b157233405107"></a><aname="b157233405107"></a>0</strong> means completely transparent. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="aa0471c31e05e465aa9c42312b9ab9f6f"><aname="aa0471c31e05e465aa9c42312b9ab9f6f"></a><aname="aa0471c31e05e465aa9c42312b9ab9f6f"></a>Opacity of an element. The value ranges from <strongid="b1748232615116"><aname="b1748232615116"></a><aname="b1748232615116"></a>0</strong> to <strongid="b14836266111"><aname="b14836266111"></a><aname="b14836266111"></a>1</strong>. The value <strongid="b64831526121110"><aname="b64831526121110"></a><aname="b64831526121110"></a>1</strong> means opaque, and <strongid="b144843268112"><aname="b144843268112"></a><aname="b144843268112"></a>0</strong> means completely transparent. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p62121758111517"><aname="p62121758111517"></a><aname="p62121758111517"></a>Color of the stroke. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p125961416161611"><aname="p125961416161611"></a><aname="p125961416161611"></a>Length of the dashes and notches. The format is [length length length length]. The length values of dashes and notches are separated by a space and appear in pairs.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p7603151814225"><aname="p7603151814225"></a><aname="p7603151814225"></a>Offset for rendering the associated dash line array. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p740434541717"><aname="p740434541717"></a><aname="p740434541717"></a>The shape used at the corner of a path when stroked.</p>
<pid="p1432771818271"><aname="p1432771818271"></a><aname="p1432771818271"></a><strongid="b114014162159"><aname="b114014162159"></a><aname="b114014162159"></a>bevel</strong>: connects paths with bevel corners.</p>
<pid="p16327131852712"><aname="p16327131852712"></a><aname="p16327131852712"></a><strongid="b1130012305156"><aname="b1130012305156"></a><aname="b1130012305156"></a>miter</strong>: connects paths with mitered corners.</p>
<pid="p1232715183278"><aname="p1232715183278"></a><aname="p1232715183278"></a><strongid="b43026401159"><aname="b43026401159"></a><aname="b43026401159"></a>round</strong>: connects paths with rounded corners.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p1256204215175"><aname="p1256204215175"></a><aname="p1256204215175"></a>The shape used at the end of paths when stroked.</p>
<pid="p15561202832912"><aname="p15561202832912"></a><aname="p15561202832912"></a><strongid="b12870164116174"><aname="b12870164116174"></a><aname="b12870164116174"></a>butt</strong>: The stroke for each path does not extend beyond its two endpoints.</p>
<pid="p10561428172914"><aname="p10561428172914"></a><aname="p10561428172914"></a><strongid="b5823111013184"><aname="b5823111013184"></a><aname="b5823111013184"></a>round</strong>: At the end of each path the stroke is extended by a half circle with a diameter equal to the stroke width.</p>
<pid="p175611728152917"><aname="p175611728152917"></a><aname="p175611728152917"></a><strongid="b16607112114516"><aname="b16607112114516"></a><aname="b16607112114516"></a>square</strong>: At the end of each path the stroke is extended by a half circle, with the width being equal to half of the stroke width, and the height being equal to the stroke width.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p16598135132713"><aname="p16598135132713"></a><aname="p16598135132713"></a>Limit value when the sharp angle is drawn as a miter. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p104188333270"><aname="p104188333270"></a><aname="p104188333270"></a>Opacity of the stroke. The value ranges from <strongid="b8690125911451"><aname="b8690125911451"></a><aname="b8690125911451"></a>0</strong> to <strongid="b17690195910457"><aname="b17690195910457"></a><aname="b17690195910457"></a>1</strong>. The value <strongid="b1469145934519"><aname="b1469145934519"></a><aname="b1469145934519"></a>1</strong> means opaque, and <strongid="b15691165954514"><aname="b15691165954514"></a><aname="b15691165954514"></a>0</strong> means completely transparent. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p18219124683417"><aname="p18219124683417"></a><aname="p18219124683417"></a>Coordinate transformation parameters of the component and its child components.</p>
<pid="p183345463353"><aname="p183345463353"></a><aname="p183345463353"></a>The following formats are supported:</p>
<pid="p97754703611"><aname="p97754703611"></a><aname="p97754703611"></a><strongid="b20384820194811"><aname="b20384820194811"></a><aname="b20384820194811"></a>translate(<x> [<y>])</strong>: translates along the x[y]-axis.</p>
<pid="p2853121513620"><aname="p2853121513620"></a><aname="p2853121513620"></a><strongid="b182151374485"><aname="b182151374485"></a><aname="b182151374485"></a>scale(<x> [<y>])</strong>: scales along the x[y]-axis.</p>
<pid="p08302534363"><aname="p08302534363"></a><aname="p08302534363"></a><strongid="b195865430485"><aname="b195865430485"></a><aname="b195865430485"></a>rotate(<a> [<x><y>])</strong>: rotates at an angle of <strongid="b117161113533"><aname="b117161113533"></a><aname="b117161113533"></a>a</strong> with (x,y) as the center.</p>
<pid="p91741924123618"><aname="p91741924123618"></a><aname="p91741924123618"></a><strongid="b187551240134919"><aname="b187551240134919"></a><aname="b187551240134919"></a>skewX(<a>)</strong>: skews at an angle of <strongid="b173605136532"><aname="b173605136532"></a><aname="b173605136532"></a>a</strong> along the x-axis.</p>
<pid="p192841756133515"><aname="p192841756133515"></a><aname="p192841756133515"></a><strongid="b75191724115317"><aname="b75191724115317"></a><aname="b75191724115317"></a>skewY(<a>)</strong>: skews at an angle of <strongid="b1252062495318"><aname="b1252062495318"></a><aname="b1252062495318"></a>a</strong> along the y-axis.</p>
| fill | <color> | black | No| Fill color of an element using the shorthand attribute. Attribute animations are supported.|
| fill-opacity | number | 1 | No| Opacity of a fill color. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. Attribute animations are supported.|
| opacity | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. Attribute animations are supported.|
| stroke | <color> | - | No| Color of the stroke. Attribute animations are supported.|
| stroke-dasharray | <string> | - | No| Length of the dashes and notches. The format is [length length length length]. The length values of dashes and notches are separated by a space and appear in pairs.|
| stroke-dashoffset | <length> | 0 | No| Offset for rendering the associated dash line array. Attribute animations are supported.|
| stroke-linejoin | [bevel \| miter \| round] | miter | No| The shape used at the corner of a path when stroked.<br>**bevel**: connects paths with bevel corners.<br>**miter**: connects paths with mitered corners.<br>**round**: connects paths with rounded corners.|
| stroke-linecap | [butt \| round \| square] | butt | No| The shape used at the end of paths when stroked.<br>**butt**: The stroke for each path does not extend beyond its two endpoints.<br>**round**: At the end of each path the stroke is extended by a half circle with a diameter equal to the stroke width.<br>**square**: At the end of each path the stroke is extended by a half circle, with the width being equal to half of the stroke width, and the height being equal to the stroke width.|
| stroke-miterlimit | number | 4 | No| Limit value when the sharp angle is drawn as a miter. Attribute animations are supported.|
| stroke-opacity | number | 1 | No| Opacity of the stroke. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. Attribute animations are supported.|
| transform | <string> | - | No| Coordinate transformation parameters of the component and its child components.<br>The following formats are supported:<br>**translate(\<x> [\<y>])**: translates along the x[y]-axis.<br>**scale(\<x> [\<y>])**: scales along the x[y]-axis.<br>**rotate(\<a> [\<x> \<y>])**: rotates at an angle of **a** with point (x,y) as the center.<br>**skewX(\<a>)**: skews at an angle of **a** along the x-axis.<br>**skewY(\<a>)**: skews at an angle of **a** along the y-axis. |
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p62121758111517"><aname="p62121758111517"></a><aname="p62121758111517"></a>X-coordinate of the oval shape. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p125961416161611"><aname="p125961416161611"></a><aname="p125961416161611"></a>Y-coordinate of the oval shape. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p78950185420"><aname="p78950185420"></a><aname="p78950185420"></a>Radius of the oval shape on the x-axis. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p107241750205414"><aname="p107241750205414"></a><aname="p107241750205414"></a>Radius of the oval shape on the y-axis. Attribute animations are supported.</p>
</td>
</tr>
</tbody>
</table>
## Example<a name="section360556124815"></a>
```
## Child Components
The following are supported: [\<animate>](js-components-svg-animate.md), [\<animateMotion>](js-components-svg-animatemotion.md), and [\<animateTransform>](js-components-svg-animatetransform.md).
## Attributes
The [universal attributes](../arkui-js/js-components-svg-common-attributes.md) and the attributes listed below are supported.
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p62121758111517"><aname="p62121758111517"></a><aname="p62121758111517"></a>X-coordinate of the start point of the line. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p125961416161611"><aname="p125961416161611"></a><aname="p125961416161611"></a>Y-coordinate of the start point of the line. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p78950185420"><aname="p78950185420"></a><aname="p78950185420"></a>X-coordinate of the end point of the line. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p107241750205414"><aname="p107241750205414"></a><aname="p107241750205414"></a>Y-coordinate of the end point of the line. Attribute animations are supported.</p>
</td>
</tr>
</tbody>
</table>
## Example<a name="section360556124815"></a>
```
## Child Components
The following are supported: [\<animate>](js-components-svg-animate.md), [\<animateMotion>](js-components-svg-animatemotion.md), and [\<animateTransform>](js-components-svg-animatetransform.md).
## Attributes
The [universal attributes](../arkui-js/js-components-svg-common-attributes.md) and the attributes listed below are supported.
// square: At the end of each path the stroke is extended by a half circle, with the width being equal to half of the stroke width, and the height being equal to the stroke width.
**animate**, **animateMotion**, and **animateTransform** are supported.
## Attributes<a name="section2907183951110"></a>
The [universal attributes](js-components-svg-common-attributes.md) and the attributes listed below are supported. The configured universal attributes are passed to the child components.
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="adbe7ecbee96b4f938b04a4b8d62791bf"><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a>Shape of the path. The value contains a group of character instructions. Uppercase letters are absolute paths, and lowercase letters are relative paths.</p>
<pid="p46751932620"><aname="p46751932620"></a><aname="p46751932620"></a>The meanings of the letters are as follows:</p>
The following are supported: [\<animate>](js-components-svg-animate.md), [\<animateMotion>](js-components-svg-animatemotion.md), and [\<animateTransform>](js-components-svg-animatetransform.md).
## Attributes
The [universal attributes](js-components-svg-common-attributes.md) and the attributes listed below are supported. The configured universal attributes are passed to the child components.
| id | string | - | No| Unique ID of the component.|
| d | string | - | No| Shape of the path. The value contains a group of character instructions. Uppercase letters are absolute paths, and lowercase letters are relative paths.<br>The meanings of the letters are as follows:<br>- M/m = moveto<br>- L/l = lineto<br>- H/h = horizontal lineto<br>- V/v = vertical lineto<br>- C/c = curveto<br>- S/s = smooth curveto<br>- Q/q = quadratic Belzier curve<br>- T/t = smooth quadratic Belzier curveto<br>- A/a = elliptical Arc<br>- Z/z = closepath |
## Example
```html
<!-- xxx.hml -->
<divclass="container">
<svgwidth="400"height="400">
...
...
@@ -70,5 +39,5 @@ The [universal attributes](js-components-svg-common-attributes.md) and the att
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="adbe7ecbee96b4f938b04a4b8d62791bf"><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a>Multiple coordinates of the polygon.</p>
<pid="p158933814449"><aname="p158933814449"></a><aname="p158933814449"></a>The format is [x1,y1 x2,y2 x3,y3].</p>
<pid="p78913383449"><aname="p78913383449"></a><aname="p78913383449"></a>Attribute animations are supported. If the number of coordinates of the animation change value set in the attribute animation is different from the format of the original points, the attribute animation is invalid.</p>
</td>
</tr>
</tbody>
</table>
## Example<a name="section360556124815"></a>
```
## Child Components
The following are supported: [\<animate>](js-components-svg-animate.md), [\<animateMotion>](js-components-svg-animatemotion.md), and [\<animateTransform>](js-components-svg-animatetransform.md).
## Attributes
The [universal attributes](../arkui-js/js-components-svg-common-attributes.md) and the attributes listed below are supported.
| id | string | - | No| Unique ID of the component.|
| points | string | - | No| Multiple coordinates of the polygon.<br>The format is [x1,y1 x2,y2 x3,y3].<br>Attribute animations are supported. If the number of coordinates of the animation change value set in the attribute animation is different from the format of the original points, the attribute animation is invalid.|
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="adbe7ecbee96b4f938b04a4b8d62791bf"><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a>Multiple coordinates of the polyline.</p>
<pid="p14934164010422"><aname="p14934164010422"></a><aname="p14934164010422"></a>The format is [x1,y1 x2,y2 x3,y3].</p>
<pid="p8934164015424"><aname="p8934164015424"></a><aname="p8934164015424"></a>Attribute animations are supported. If the number of coordinates of the animation change value set in the attribute animation is different from the format of the original points, the attribute animation is invalid.</p>
</td>
</tr>
</tbody>
</table>
## Example<a name="section360556124815"></a>
```
## Child Components
The following are supported: [\<animate>](js-components-svg-animate.md), [\<animateMotion>](js-components-svg-animatemotion.md), and [\<animateTransform>](js-components-svg-animatetransform.md).
## Attributes
The [universal attributes](../arkui-js/js-components-svg-common-attributes.md) and the attributes listed below are supported.
| id | string | - | No| Unique ID of the component.|
| points | string | - | No| Multiple coordinates of the polyline.<br>The format is [x1,y1 x2,y2 x3,y3].<br>Attribute animations are supported. If the number of coordinates of the animation change value set in the attribute animation is different from the format of the original points, the attribute animation is invalid.|
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="adbe7ecbee96b4f938b04a4b8d62791bf"><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a>Width of a rectangle. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p64638784216"><aname="p64638784216"></a><aname="p64638784216"></a>Height of a rectangle. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p62121758111517"><aname="p62121758111517"></a><aname="p62121758111517"></a>X-coordinate of the upper left corner of the rectangle. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p125961416161611"><aname="p125961416161611"></a><aname="p125961416161611"></a>Y-coordinate of the upper left corner of the rectangle. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p78950185420"><aname="p78950185420"></a><aname="p78950185420"></a>Radius of the rectangle rounded corner in the x-axis direction. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p107241750205414"><aname="p107241750205414"></a><aname="p107241750205414"></a>Radius of the rectangle rounded corner in the y-axis direction. Attribute animations are supported.</p>
</td>
</tr>
</tbody>
</table>
## Example<a name="section360556124815"></a>
```
## Child Components
The following are supported: [\<animate>](js-components-svg-animate.md), [\<animateMotion>](js-components-svg-animatemotion.md), and [\<animateTransform>](js-components-svg-animatetransform.md).
## Attributes
The [universal attributes](../arkui-js/js-components-svg-common-attributes.md) and the attributes listed below are supported.
| id | string | - | No| Unique ID of the component.|
| width | <length>\|<percentage> | 0 | No| Width of the rectangle. Attribute animations are supported.|
| height | <length>\|<percentage> | 0 | No| Height of the rectangle. Attribute animations are supported.|
| x | <length>\|<percentage> | 0 | No| X-coordinate of the upper left corner of the rectangle. Attribute animations are supported.|
| y | <length>\|<percentage> | 0 | No| Y-coordinate of the upper left corner of the rectangle. Attribute animations are supported.|
| rx | <length>\|<percentage> | 0 | No| Radius of the rectangle rounded corner in the x-axis direction. Attribute animations are supported.|
| ry | <length>\|<percentage> | 0 | No| Radius of the rectangle rounded corner in the y-axis direction. Attribute animations are supported.|
## Example
```html
<!-- xxx.hml -->
<divclass="container">
<svgfill="white"width="400"height="400">
...
...
@@ -125,5 +47,5 @@ The [universal attributes](js-components-svg-common-attributes.md) and the att
@@ -4,6 +4,7 @@ The **\<text>** component is used to display a piece of textual information.
> **NOTE**
>
> - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
>
> - The text content must be written in the content area. The **tspan** sub-element label can be nested to segment the text content. The **textPath** sub-element label can be nested to draw the text content based on the specified path.
...
...
@@ -19,7 +20,7 @@ None
## Child Components
The **\<tspan>**, **\<textPath>**, **\<animate>**, and **\<animateTransform>** child components are supported.
The following are supported: [\<tspan>](js-components-svg-tspan.md), [\<textpath>](js-components-svg-textpath.md), [\<animate>](js-components-svg-animate.md), and [\<animateTransform>](js-components-svg-animatetransform.md).
## Attributes
...
...
@@ -29,16 +30,16 @@ The attributes in the following table are supported.
| Name | Type | Default Value | Mandatory | Description |
| id | string | - | No | Unique ID of the component. |
| x | <length>\|<percentage> | 0 | No | X-coordinate of the upper left corner of the component. |
| y | <length>\|<percentage> | 0 | No | Y-coordinate of the upper left corner of the component. |
| dx | <length>\|<percentage> | 0 | No | Offset of the text on the x-axis. |
| dy | <length>\|<percentage> | 0 | No | Offset of the text on the y-axis. |
| x | <length>\|<percentage> | 0 | No | X-coordinate of the upper left corner of the component. |
| y | <length>\|<percentage> | 0 | No | Y-coordinate of the upper left corner of the component. |
| dx | <length>\|<percentage> | 0 | No | Offset of the text on the x-axis. |
| dy | <length>\|<percentage> | 0 | No | Offset of the text on the y-axis. |
| rotate | number | 0 | No | Rotation of the text around its lower left corner. A positive number indicates clockwise rotation, and a negative number indicates counterclockwise rotation. |
| font-size | <length> | 30px | No | Font size. |
| fill | <color> | black | No | Fill color of the text. |
| fill-opacity | number | 1.0 | No | Fill opacity of the text. |
| opacity | number | 1 | No | Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. Attribute animations are supported.|
| stroke | <color> | black | No | Stroke and stroke color. |
| stroke | <color> | black | No | Stroke color. |
| stroke-width | number | 1px | No | Stroke width. |
| stroke-opacity | number | 1.0 | No | Stroke opacity. |
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="adbe7ecbee96b4f938b04a4b8d62791bf"><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a><aname="adbe7ecbee96b4f938b04a4b8d62791bf"></a>Shape of the path.</p>
<pid="p46751932620"><aname="p46751932620"></a><aname="p46751932620"></a>The meanings of the letters are as follows:</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p125961416161611"><aname="p125961416161611"></a><aname="p125961416161611"></a>Start offset of the text drawing along the path.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p1661813321247"><aname="p1661813321247"></a><aname="p1661813321247"></a>Font fill color.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p1551320143814"><aname="p1551320143814"></a><aname="p1551320143814"></a>Attribute offset relative to the specified animation. The default value of <strongid="b47896415258"><aname="b47896415258"></a><aname="b47896415258"></a>from</strong> is the original attribute value.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="aa0471c31e05e465aa9c42312b9ab9f6f"><aname="aa0471c31e05e465aa9c42312b9ab9f6f"></a><aname="aa0471c31e05e465aa9c42312b9ab9f6f"></a>Opacity of an element. The value ranges from <strongid="b79611410473"><aname="b79611410473"></a><aname="b79611410473"></a>0</strong> to <strongid="b129720146470"><aname="b129720146470"></a><aname="b129720146470"></a>1</strong>. The value <strongid="b998914144710"><aname="b998914144710"></a><aname="b998914144710"></a>1</strong> means opaque, and <strongid="b10991814184713"><aname="b10991814184713"></a><aname="b10991814184713"></a>0</strong> means completely transparent. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p8618113232414"><aname="p8618113232414"></a><aname="p8618113232414"></a>Font fill opacity.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p11619183202419"><aname="p11619183202419"></a><aname="p11619183202419"></a>Stroke and stroke color.</p>
The following is an example of the **textspan** attribute. The **textpath** text is drawn along the path specified by the **path** attribute, and the start point is offset by 20% of the **path** length. \(The drawn element **<path\>** curve is for reference only.\)
| path | string | 0 | Shape of the path.<br>The meanings of the letters are as follows:<br>- M = moveto<br>- L = lineto<br>- H = horizontal lineto<br>- V = vertical lineto<br>- C = curveto<br>- S = smooth curveto<br>- Q = quadratic Belzier curve<br>- T = smooth quadratic Belzier curveto<br>- A = elliptical Arc<br>- Z = closepath<br>Default value: **0**|
| startOffset | <length>\|<percentage> | 0 | Offset of the text start point relative to the path start point.<br>Default value: **0** |
| fill | <color> | black | Font fill color.<br>Default value: **black** |
| by | number | - | Attribute offset relative to the specified animation. By default, **from** is the original attribute value. |
| opacity | number | 1 | Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. Attribute animations are supported.<br>Default value: **0**|
| fill-opacity | number | 1.0 | Font fill opacity.<br>Default value: **1.0** |
The following is an example of the **\<textspan>** attributes, where text is drawn along the path specified by **path**, and the start point is offset by 20% of the **path** length. (The drawn **\<path>** curve is for reference only.)
```html
<!-- xxx.hml -->
<divclass="container">
<svgfill="#00FF00"x="50">
...
...
@@ -187,11 +59,23 @@ The following is an example of the **textspan** attribute. The **textpath**
</div>
```
![](figures/textpath-part1.png)
```css
/* xxx.css */
.container{
flex-direction:row;
justify-content:flex-start;
align-items:flex-start;
height:1200px;
width:600px;
}
```
Combination of **textpath** and **tspan**
![textpath-part1](figures/textpath-part1.png)
```
Combination of **\<textpath>** and **\<tspan>**
```html
<!-- xxx.hml -->
<divclass="container">
<svgfill="#00FF00"x="50">
...
...
@@ -207,9 +91,9 @@ Combination of **textpath** and **tspan**
</div>
```
![](figures/textpath-part2.png)
![textpath-part2](figures/textpath-part2.png)
```
```html
<!-- xxx.hml -->
<divclass="container">
<svgfill="#00FF00"x="50">
...
...
@@ -227,9 +111,9 @@ Combination of **textpath** and **tspan**
</div>
```
![](figures/textpath-part3.png)
![textpath-part3](figures/textpath-part3.png)
```
```html
<!-- xxx.hml -->
<divclass="container">
<svgfill="#00FF00"x="50">
...
...
@@ -248,11 +132,11 @@ Combination of **textpath** and **tspan**
</div>
```
![](figures/textpath-part4.png)
![textpath-part4](figures/textpath-part4.png)
The following is an example of the **startOffset** animation. When the text is drawn, the start offset is moved from 10% to 40%, and the text whose length exceeds the path length range is not drawn.
The following is an example of the **startOffset** animation, where the value of **startOffset** changes from 10% to 40%, and the text is not drawn when its length exceeds the path length range.
```
```css
/* xxx.css */
.container{
flex-direction:row;
...
...
@@ -263,7 +147,7 @@ The following is an example of the **startOffset** animation. When the text is
}
```
```
```html
<!-- xxx.hml -->
<divclass="container">
<svgfill="#00FF00">
...
...
@@ -280,11 +164,11 @@ The following is an example of the **startOffset** animation. When the text is
\(1\) "tspan attribute x|rotate" indicates that the text drawing start point moves from 50 px to 100 px and rotates clockwise by 0 degrees to 360 degrees.
(1) **"tspan attribute x|rotate"**: The beginning of the text is offset from 50 px to 100 px, and the text rotates clockwise by 0 degrees to 360 degrees.
\(2\) "tspan attribute dx|opacity" is drawn after the "tspan static." drawing is complete. The offset moves from 0% to 30%, and the opacity changes from shallow to deep.
(2) **"tspan attribute dx|opacity"**: The text is drawn after the "tspan static." drawing is complete. The horizontal offset moves from 0% to 30%, and the opacity changes from shallow to deep.
\(3\)**tspan move**: After the previous **tspan** is drawn, the next tspan is drawn with an offset of 5% to show the effect of following the previous **tspan**.
(3) **tspan move**: After the previous **\<tspan>** is drawn, the next **\<tspan>** is drawn with an offset of 5%, creating the effect of following the previous **\<tspan>**.
Animation and effect of the combination of **textpath** and **tspan**
Attribute animation of the **\<textPath>** and **\<tspan>** in combination
```
```html
<!-- xxx.hml -->
<divclass="container">
<svgfill="#00FF00">
...
...
@@ -347,19 +231,19 @@ Animation and effect of the combination of **textpath** and **tspan**
\(1\)**This is TextPath**.: Draw the first paragraph of text on the path without offset. The size is 30px, and the color is "\#D2691E".
(1) **"This is TextPath."**: The first segment of text, in the size of 30px and color of \#D2691E is drawn on the path without offset.
\(2\) The value of **tspan attribute fill|fill-opacity** is 20px offset from the end of the previous text segment. The color is from blue to red, and the opacity is from light to deep.
(2) **"tspan attribute fill|fill-opacity"**: The new segment of text is 20px offset from the end of the previous text segment. The text color changes from blue to red, and the opacity changes from light to deep.
\(3\)**tspan attribute font-size**: The drawing start point is 20px offset from the end of the previous segment. The start point is static, and the font size ranges from 10px to 50px. The overall length is continuously prolonged.
(3) **"tspan attribute font-size"**: The new segment of text is 20px offset from the end of the previous text segment. While the start point of the text is static, the font size shifts from 10px to 50px and the overall length is continuously prolonged.
\(4\)**Single tspan**: Draw a horizontal line at the end of the previous segment to follow the previous segment.
(4) **"Single tspan"**: A horizontal line is drawn at the end of the previous segment, creating the effect of following the previous segment.
Animation and effect of the combination of **textpath** and **tspan**
Attribute animation of the **\<textPath>** and **\<tspan>** in combination
```
```html
<!-- xxx.hml -->
<divclass="container">
<svgfill="#00FF00">
...
...
@@ -384,9 +268,8 @@ Animation and effect of the combination of **textpath** and **tspan**
</div>
```
![](figures/textpath-animate4.gif)
\(1\)**tspan attribute stroke**: The stroke color gradually changes from red to green.
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p62121758111517"><aname="p62121758111517"></a><aname="p62121758111517"></a>X-coordinate of the upper left corner of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p125961416161611"><aname="p125961416161611"></a><aname="p125961416161611"></a>Y-coordinate of the upper left corner of the component. This parameter is invalid for the <strongid="b157256585436"><aname="b157256585436"></a><aname="b157256585436"></a>textpath</strong> child component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p78950185420"><aname="p78950185420"></a><aname="p78950185420"></a>Offset of the text on the x-axis.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p107241750205414"><aname="p107241750205414"></a><aname="p107241750205414"></a>Offset of the text on the y-axis. This parameter is invalid for the <strongid="b16523710174412"><aname="b16523710174412"></a><aname="b16523710174412"></a>textpath</strong> child component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p34692079335"><aname="p34692079335"></a><aname="p34692079335"></a>Rotates the lower left corner of the font based on the circle center. A positive number indicates clockwise rotation, and a negative number indicates counterclockwise rotation.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p1398555152918"><aname="p1398555152918"></a><aname="p1398555152918"></a>Font fill color.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="aa0471c31e05e465aa9c42312b9ab9f6f"><aname="aa0471c31e05e465aa9c42312b9ab9f6f"></a><aname="aa0471c31e05e465aa9c42312b9ab9f6f"></a>Opacity of an element. The value ranges from <strongid="b146141522124413"><aname="b146141522124413"></a><aname="b146141522124413"></a>0</strong> to <strongid="b86151522104410"><aname="b86151522104410"></a><aname="b86151522104410"></a>1</strong>. The value <strongid="b1661672294413"><aname="b1661672294413"></a><aname="b1661672294413"></a>1</strong> means opaque, and <strongid="b1261762218443"><aname="b1261762218443"></a><aname="b1261762218443"></a>0</strong> means completely transparent. Attribute animations are supported.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p96263816305"><aname="p96263816305"></a><aname="p96263816305"></a>Font fill opacity.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p127182592324"><aname="p127182592324"></a><aname="p127182592324"></a>Stroke and stroke color.</p>
| id | string | - | No | Unique ID of the component. |
| x | <length>\|<percentage> | 0 | No | X-coordinate of the upper left corner of the component. |
| y | <length>\|<percentage> | 0 | No | Y-coordinate of the upper left corner of the component. This attribute is invalid when the component is a child component of the **\<textpath>**. |
| dx | <length>\|<percentage> | 0 | No | Offset of the text on the x-axis. |
| dy | <length>\|<percentage> | 0 | No | Offset of the text on the y-axis. This attribute is invalid when the component is a child component of the **\<textpath>**. |
| rotate | number | 0 | No | Rotation of the text around its lower left corner. A positive number indicates clockwise rotation, and a negative number indicates counterclockwise rotation. |
| font-size | <length> | 30px | No | Font size. |
| fill | <color> | black | No | Fill color of the text. |
| opacity | number | 1 | No | Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. Attribute animations are supported.|
| fill-opacity | number | 1.0 | No | Fill opacity of the text. |
| stroke | <color> | black | No | Stroke color. |
| stroke-width | number | 1px | No | Stroke width. |
| stroke-opacity | number | 1.0 | No | Stroke opacity. |
## Example
```html
<!-- xxx.hml -->
<divclass="container">
<svg>
...
...
@@ -207,22 +61,22 @@ The attributes in the following table are supported.
The **<svg\>** component is a basic container. It can be used as the root node of an SVG document or be used to nest an SVG fragment into an SVG document.
The **\<svg>** component is a basic container. It can be used as the root node of an SVG document or be used to nest an SVG fragment into an SVG document.
**svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polygon**, **polyline**, **text**, **animate**, and **animateTransform** are supported.
## Attributes<a name="section2907183951110"></a>
The [universal attributes](js-components-svg-common-attributes.md) and the attributes listed below are supported. The configured universal attributes are passed to the child components.
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="a1a1731af05554f119fa365748f276bb2"><aname="a1a1731af05554f119fa365748f276bb2"></a><aname="a1a1731af05554f119fa365748f276bb2"></a>Unique ID of the component.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p62121758111517"><aname="p62121758111517"></a><aname="p62121758111517"></a>X-coordinate of the current <strongid="b2724124631610"><aname="b2724124631610"></a><aname="b2724124631610"></a><svg></strong> component. The settings do not work for the root <strongid="b172085410165"><aname="b172085410165"></a><aname="b172085410165"></a><svg></strong> node.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p125961416161611"><aname="p125961416161611"></a><aname="p125961416161611"></a>Y-coordinate of the current <strongid="b122841519181716"><aname="b122841519181716"></a><aname="b122841519181716"></a><svg></strong> component. The settings do not work for the root <strongid="b4285131991713"><aname="b4285131991713"></a><aname="b4285131991713"></a><svg></strong> node.</p>
<tdclass="cellrowborder"valign="top"width="35.76%"headers="mcps1.1.6.1.5 "><pid="p740434541717"><aname="p740434541717"></a><aname="p740434541717"></a>View box of the current <strongid="b1055718459177"><aname="b1055718459177"></a><aname="b1055718459177"></a><svg></strong> component. The supported format is <strongid="b166865102189"><aname="b166865102189"></a><aname="b166865102189"></a><number number number number></strong>. The four parameters indicate the <strongid="b2507112919184"><aname="b2507112919184"></a><aname="b2507112919184"></a>min-x</strong>, <strongid="b11665531141816"><aname="b11665531141816"></a><aname="b11665531141816"></a>min-y</strong>, <strongid="b6237133461814"><aname="b6237133461814"></a><aname="b6237133461814"></a>width</strong>, and <strongid="b1424418412185"><aname="b1424418412185"></a><aname="b1424418412185"></a>height</strong>. The width and height of the view box are different from those of the <strongid="b53631556121813"><aname="b53631556121813"></a><aname="b53631556121813"></a><svg></strong> component. The view box is scaled in center-aligned mode.</p>
</td>
</tr>
</tbody>
</table>
## Example<a name="section360556124815"></a>
```
## Child Components
The following are supported: [\<svg>](js-components-svg.md), [\<rect>](js-components-svg-rect.md), [\<circle>](js-components-svg-circle.md), [\<ellipse>](../arkui-js/js-components-svg-ellipse.md), [\<path>](js-components-svg-path.md), [\<line](../arkui-js/js-components-svg-line.md), [\<polygon>](../arkui-js/js-components-svg-polygon.md), [\<polyline>](js-components-svg-polyline.md), [\<text>](js-components-svg-text.md), [\<animate>](js-components-svg-animate.md), and [\<animateTransform>](js-components-svg-animateTransform.md).
## Attributes
The [universal attributes](../arkui-js/js-components-svg-common-attributes.md) and the attributes listed below are supported. The configured universal attributes are passed to the child components.
| x | <length>\|<percentage> | - | No| X-coordinate of the current **\<svg>** component. The settings do not work for the root **\<svg>** node. |
| y | <length>\|<percentage> | | No| Y-coordinate of the current **\<svg>** component. The settings do not work for the root **\<svg>** node. |
| viewBox | string | - | No| View box of the current **\<svg>** component. The supported format is \<number number number number>. The four parameters indicate **min-x**, **min-y**, **width**, and **height**, respectively. The width and height of the view box are different from those of the **\<svg>** component. The view box is scaled in center-aligned mode. |
## Example
```html
<!-- xxx.hml -->
<divclass="container">
<svgwidth="400"height="400">
...
...
@@ -119,5 +52,5 @@ The [universal attributes](js-components-svg-common-attributes.md) and the att
You can use @Preview to decorate a custom component so that it can be previewed in DevEco Studio. This component is created and displayed when the page where it is located is loaded.
You can use **@Preview** to decorate a custom component so that it can be previewed in real time in DevEco Studio. This component is created and displayed when the page where it is located is loaded. Dynamic pictures and dynamic preview are not yet supported.
> **NOTE**
>
> In a source file, at most one custom component can be decorated by @Preview.
> In a source file, at most 10 custom components can be decorated by **@Preview**. For details, see [@Preview](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-previewing-app-service-0000001218760596#section146052489820).
The lifecycle callbacks of a custom component are used to notify users of the lifecycle of the component. These callbacks are private and are invoked by the development framework at a specified time at runtime. They cannot be manually invoked from applications.
## Lifecycle Callback Definition
## Lifecycle Callback Definitions
| Function | Description |
| -------- | -------- |
| aboutToAppear | Invoked after a new instance of the custom component is created and before its build function is executed. You can change state variables in the **aboutToAppear** function. The change will take effect when you execute the **build** function next time. |
| aboutToDisappear | Invoked before the destructor of the custom component is consumed. Do not change state variables in the **aboutToDisappear** function as doing this can cause unexpected errors. For example, the modification of the **@Link** decorated variable may cause unstable application running.|
| onPageShow | Invoked when a page is displayed. This callback is used in the routing process or scenarios where the application is switched to the foreground or background. Only the custom components decorated by **@Entry** take effect. |
| onPageHide | Invoked when a page is hidden. This callback is used in the routing process or scenarios where the application is switched to the foreground or background. Only the custom components decorated by **@Entry** take effect. |
| onBackPress | Invoked when a user clicks the back button. Only the custom components decorated by **@Entry** take effect.<br/>- The value **true** is returned if the page processes the return logic instead of performing page routing.<br/>- The value **false** is returned if the default return logic is used.<br/>- If no value is returned, the default return logic is used. |
| aboutToAppear | Invoked after a new instance of the custom component is created and before its **build** function is executed. You can change state variables in the **aboutToAppear** function. The change will take effect when you execute the **build** function next time.|
| aboutToDisappear | Invoked before the destructor of the custom component is consumed. Do not change state variables in the **aboutToDisappear** function as doing this can cause unexpected errors. For example, the modification of the **@Link** decorated variable may cause unstable application running.|
| onPageShow | Invoked when a page is displayed. This callback is used in the routing process or scenarios where the application is switched to the foreground or background. Only the custom components decorated by **@Entry** take effect.|
| onPageHide | Invoked when a page is hidden. This callback is used in the routing process or scenarios where the application is switched to the foreground or background. Only the custom components decorated by **@Entry** take effect.|
| onBackPress | Invoked when a user clicks the back button. Only the custom components decorated by **@Entry** take effect.<br>The value **true** is returned if the page processes the return logic instead of performing page routing.<br>The value **false** is returned if the default return logic is used.<br>If no value is returned, the default return logic is used.|
The example above shows that lifecycle functions are critical for CountDownTimerComponent to manage its timer resources. Similar functions include loading resources asynchronously from the network.
The example above shows that lifecycle functions are critical for **CountDownTimerComponent** to manage its timer resources. Similar functions include loading resources asynchronously from the network.
> **NOTE**
>
> - Promise and asynchronous callback functions can be used in lifecycle functions, for example, network resource getters and timer setters.
>
> - Do not use **async await** in lifecycle functions.
@@ -8,7 +8,7 @@ As a tool to provide layout auxiliary lines, the grid system is handy in graphic
2. Provides a unified positioning method for the system to ensure layout consistency among modules on different devices.
3. Provides a flexible spacing adjustment method for applications to keep up with layout in special scenarios.
To implement grid layout, the declarative paradigm provides the [GridContainer](../reference/arkui-ts/ts-container-gridcontainer.md) grid container component, which works with the common attribute useSizeType of its subcomponents to implement grid layout.
To implement grid layout, the declarative paradigm provides the [\<GridContainer>](../reference/arkui-ts/ts-container-gridcontainer.md) component, which works with the **useSizeType** attribute of its child components to implement grid layout.
## Grid System
...
...
@@ -19,10 +19,15 @@ The grid system works in terms of gutter, margin, and column.
1. Gutter:
Spacing between elements. You can define different clutter values for different device sizes as part of the overall grid layout specifications. For better results, make sure the gutter is not greater than the margin.
2. Margin:
Spacing around an item in the grid container. You can define different margin values for different device sizes as part of the overall grid layout specifications.
3. Column:
Main tool for positioning items in the grid layout. The grid container is divided into various numbers of columns based on the device size. The width per column is calculated based on the total number of columns while respecting the margin and clutter specifications.
...
...
@@ -30,7 +35,7 @@ The grid system works in terms of gutter, margin, and column.
Breakpoints in the grid system are set in terms of the device's screen pixel density. The grid system defines a set of breakpoint rules based on the mapping between the numbers of columns and device screen widths.
Depending on the screen width, devices are classified into different width types. The table below provides the mappings of the grid breakpoint ranges, device width types, default total number of columns, margins, and gutters.
Depending on the screen width, devices are classified into different width types. The table below provides the mappings of the grid breakpoint ranges, device width types, default total number of columns, margin, and gutter.
@@ -48,13 +53,15 @@ Create a grid container, define the grid layout, and set the number of columns f
Use the `GridContainer(options?: { columns?: number | 'auto', sizeType?: SizeType, gutter?: Length, margin?: Length})` API to create a grid container. All child components in the grid container follow the grid layout.
- Use the **columns**, **gutter**, and **margin** parameters to define your grid layout. In the sample below, the grid container is divided into six columns, with the gutter (spacing between columns) of 10 vp and the margin (spacing around a column) of 20 vp.
- Use the **columns**, **gutter**, and **margin** parameters to define your grid layout.
In the example below, the grid container is divided into six columns, with the gutter (spacing between columns) of 10 vp and the margin (spacing around a column) of 20 vp.
```ts
GridContainer({columns:6,gutter:10,margin:20}){}
```
In the sample below, the grid container does not have any parameter set. In this case, it follows the default layout, as in the case when sizeType is set to SizeType.Auto.
In the example below, the grid container does not have any parameter set. In this case, it follows the default layout, as in the case when **sizeType** is set to **SizeType.Auto**.
```ts
GridContainer(){}
...
...
@@ -62,7 +69,7 @@ Use the `GridContainer(options?: { columns?: number | 'auto', sizeType?: SizeTyp
On a small-sized device (**SizeType.SM**), the grid container is divided into four columns by default, with the gutter of 24 vp and the margin of 24 vp. On a medium-sized device (**SizeType.MD**), the grid container is divided into eight columns by default, with the gutter of 24 vp and the margin of 32 vp.
- You can also use **sizeType** to configure child components in the grid container to follow the grid settings for a specific device width type, as shown below:
- You can also use **sizeType** to configure child components in the grid container to follow the grid settings of a specific device width type, as shown below:
```ts
GridContainer({sizeType:SizeType.SM}){
...
...
@@ -70,7 +77,7 @@ Use the `GridContainer(options?: { columns?: number | 'auto', sizeType?: SizeTyp
Text('1')
.useSizeType({
xs:{span:2,offset:0},
sm:{span:2,offset:0},
sm:{span:3,offset:0},
md:{span:6,offset:2},
lg:{span:8,offset:2},
})
...
...
@@ -78,11 +85,11 @@ Use the `GridContainer(options?: { columns?: number | 'auto', sizeType?: SizeTyp
}
```
In the preceding example, the **\<Text>** component uses the grid setting of the **SizeType.SM** type regardless of the actual width type of the device. That is, the **\<Text>** component occupies three columns and is placed in the first column.
In the preceding example, the **\<Text>** component uses the grid settings of the **SizeType.SM** type regardless of the actual device width type. That is, the **\<Text>** component takes up three columns and is placed in the first column.
### Grid Settings of Child Components in the Grid Container
Use the universal attribute **useSizeType** to configure the positioning of child components in the grid container. **span** indicates the number of columns occupied by the child component.**offset** indicates the column offset, that is, the column where the component is located. The sample code is as follows:
Use the universal attribute **useSizeType** to configure how child components are positioned in the grid container. **useSizeType** comes with the **span** and **offset** sub-attributes. **span** indicates the number of columns occupied by the child component;**offset** indicates the column offset, that is, the column where the component is located. The sample code is as follows:
```ts
GridContainer(){
...
...
@@ -90,16 +97,16 @@ GridContainer() {
Text('1')
.useSizeType({
xs:{span:2,offset:0},
sm:{span:0,offset:0},
sm:{span:2,offset:0},
md:{span:6,offset:2},
lg:{span:8,offset:2},
})
}
}
```
In the preceding example, `sm: { span: 2, offset: 0 }` indicates that on a medium-sized device, the **\<Text>** component occupies two columns and is placed in the first column of the grid container.
In the preceding example, `sm: { span: 2, offset: 0 }` indicates that on a medium-sized device, the **\<Text>** component takes up two columns and is placed in the first column of the grid container.