The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
type Resource = import('../api/global/resource').Resource
Defines reference resources for component attributes. Resource files must be stored and managed in specific subdirectories. For examples of resource directories, see Resource Categories.
| Type | Description |
|---|---|
| import('../api/global/resource').Resource | Resource reference type. |
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
You can use $r or $rawfile to create a Resource object, but its attribute values cannot be changed.
$r('belonging.type.name')
belonging: group to which the resource belongs, which can be 'sys' or 'app'.
type: resource type, which can be 'boolean', 'color', 'float', 'intarray', 'integer', 'pattern', 'plural', 'strarray', 'string', or 'media'.
name: resource name, which is determined during resource definition.
$rawfile('filename')
filename: name of the file in the resources/rawfile directory of the project.
When a resource type is referenced, ensure that the data type in the resource type object is consistent with the type of the attribute method that uses the resource type as a parameter. For example, if an attribute method supports setting string | Resource, the data type should also be string when the Resource reference type is used.
When a resource type is referenced, ensure that the usage of the resource type object is currently supported. Otherwise, the effect of the attribute that uses the resource type as a parameter will be the same as when the attribute is not set.
$rawfile does not support preview through the Previewer.
type Length = string | number | Resource
Defines a size unit.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| string | String type. Specify the length unit explicitly, for example, '10px', or provide the length in percentage, for example, '100%'. NOTE If the unit is not specified, the default unit vp is used, in which case '10' is equivalent to 10 vp. |
| number | Number type. The default unit is vp. |
| Resource | Size referenced from system or app resources. |
type LengthMetricsUnit = import('../api/arkui/Graphics').LengthMetricsUnit
Defines the unit of a length attribute.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| import('../api/arkui/Graphics').LengthMetricsUnit | Unit of a length attribute. |
type LengthMetrics = import('../api/arkui/Graphics').LengthMetrics
Defines a length attribute.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| import('../api/arkui/Graphics').LengthMetrics | Length attribute. |
declare type ColorMetrics = import('../api/arkui/Graphics').ColorMetrics
Defines a mixed color.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| import('../api/arkui/Graphics').ColorMetrics | Mixed color. |
type ResourceStr = string | Resource
Defines the types that can be used by input parameters of the string type.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| string | String type. |
| Resource | String referenced from system or app resources. |
type Padding = { top: Length; right: Length; bottom: Length; left: Length; }
Defines the paddings in different directions of a component.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
|---|---|---|---|
| top | Length | No | Top padding, the size between the inner element of the component and the top edge of the component. |
| right | Length | No | Right padding, the size between the inner element of the component and the right boundary of the component. |
| bottom | Length | No | Bottom padding, the size between the inner element of the component and the bottom edge of the component. |
| left | Length | No | Left padding, the size between the inner element of the component and the left boundary of the component. |
Defines the paddings in different directions of a component.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| top | LengthMetrics12+ | No | Yes | Height of the padding on the top of the component. |
| end | LengthMetrics12+ | No | Yes | Width of the padding on the right of the component. Width of the padding on the left of the component in RTL mode. |
| bottom | LengthMetrics12+ | No | Yes | Height of the padding at the bottom of the component. |
| start | LengthMetrics12+ | No | Yes | Width of the padding on the left of the component. Width of the padding on the right of the component in RTL mode. |
type Margin = Padding
Defines the margins in different directions of a component.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| Padding | Margin type, used to describe the margins in different directions of a component. Its type is the same as the padding type. |
type LocalizedMargin = LocalizedPadding
Defines the margins in different directions of a component.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| LocalizedPadding | Margin type, used to describe the margins in different directions of a component. Its type is the same as the padding type. |
type EdgeWidths = { top: Length; right: Length; bottom: Length; left: Length; }
Defines component edge widths for absolute directions.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
type EdgeWidth = EdgeWidths
Border width type, used to describe the widths of a component's border in different directions.
To reference this object, at least one parameter must be passed.
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| EdgeWidths | Widths of a component's border in different directions. |
Defines component edge widths for localized logical directions.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| top | LengthMetrics12+ | No | Yes | Width of the top edge of the component. |
| end | LengthMetrics12+ | No | Yes | Width of the right edge of the component. Width of the left edge of the component in RTL mode. |
| bottom | LengthMetrics12+ | No | Yes | Width of the bottom edge of the component. |
| start | LengthMetrics12+ | No | Yes | Width of the left edge of the component. Width of the right edge of the component in RTL mode. |
type BorderRadiuses = { topLeft: Length; topRight: Length; bottomLeft: Length; bottomRight: Length; }
Defines the corner radius of a component's border.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
|---|---|---|---|
| topLeft | Length | No | Radius of the top-left corner of the component. |
| topRight | Length | No | Radius of the top-right corner of the component. |
| bottomLeft | Length | No | Radius of the bottom-left corner of the component. |
| bottomRight | Length | No | Radius of the bottom-right corner of the component. |
Defines the corner radius of a component's border.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| topStart | LengthMetrics12+ | No | Yes | Radius of the top-left corner of the component. For right-to-left scripts, this indicates the radius of the top-right corner of the component. |
| topEnd | LengthMetrics12+ | No | Yes | Radius of the top-right corner of the component. For right-to-left scripts, this indicates the corner radius of the top-left corner of the component. |
| bottomStart | LengthMetrics12+ | No | Yes | Radius of the bottom-left corner of the component. For right-to-left scripts, this indicates the corner radius of the bottom-right corner of the component. |
| bottomEnd | LengthMetrics12+ | No | Yes | Radius of the bottom-right corner of the component. For right-to-left scripts, this indicates the corner radius of the bottom-left corner of the component. |
type EdgeColors = { top: ResourceColor; right: ResourceColor; bottom: ResourceColor; left: ResourceColor; }
Defines the edge colors of a component.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
|---|---|---|---|
| top | ResourceColor | No | Color of the top border of the component. |
| right | ResourceColor | No | Color of the right border of the component. |
| bottom | ResourceColor | No | Color of the bottom border of the component. |
| left | ResourceColor | No | Color of the left border of the component. |
Defines the edge colors of a component.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| top | ResourceColor | No | Yes | Color of the top edge of the component. |
| end | ResourceColor | No | Yes | Color of the right edge of the component. Color of the left edge of the component in RTL mode. |
| bottom | ResourceColor | No | Yes | Color of the bottom edge of the component. |
| start | ResourceColor | No | Yes | Color of the left edge of the component. Color of the right edge of the component in RTL mode. |
type EdgeStyles = { top: BorderStyle; right: BorderStyle; bottom: BorderStyle; left: BorderStyle; }
Defines the edge styles of a component.
To reference this object, at least one parameter must be passed.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Mandatory | Description |
|---|---|---|---|
| top | BorderStyle | No | Style of the top border of the component. |
| right | BorderStyle | No | Style of the right border of the component. |
| bottom | BorderStyle | No | Style of the bottom border of the component. |
| left | BorderStyle | No | Style of the left border of the component. |
type Offset = { dx: Length; dy: Length; }
Defines the offset coordinates of a component in the layout.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
type ResourceColor = Color | number | string | Resource
Defines the color types of resources.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| Color | Color enums. |
| number | Color in HEX format. RGB and ARGB are supported. Examples: 0xffffff and 0xffff0000. The input length is not checked; the format is determined by the value range. For example, 0x00ffffff is parsed as RGB. |
| string | Color in RGB, RGBA, or ARGB format. RGB examples: '#ffffff' and 'rgb(255, 100, 255)' RGBA example: 'rgba(255, 100, 255, 0.5)' ARGB example: '#ff000000' |
| Resource | Color referenced from system or app resources. |
type LengthConstrain = { minLength: Length; maxLength: Length; }
Defines the maximum and minimum lengths of a component.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
Sets the text style.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| size | Length | No | Yes | Font size. If the value is of the number type, the unit fp is used. Percentage strings are not supported. Default value: 16.0 |
| weight | FontWeight | number | string | No | Yes | Font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. A larger value indicates a thicker font. Default value: 400 | FontWeight.Normal |
| family | string | Resource | No | Yes | Font family. Default font: 'HarmonyOS Sans'. To specify multiple fonts, separate them with commas (,), and fonts are applied in priority order. Example: 'Arial, HarmonyOS Sans'. |
| style | FontStyle | No | Yes | Font style. Default value: FontStyle.Normal |
Defines the area information of a component.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| width | Length | No | No | Width of the target element. Unit: vp |
| height | Length | No | No | Height of the target element. Unit: vp |
| position | Position | No | No | Position of the top-left corner of the target element in the component coordinate system based on the parent element. |
| globalPosition | Position | No | No | Position of the top-left corner of the target element in the current window coordinate system. |
Defines the coordinates of a point.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
Defines the coordinates of a point.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| start | LengthMetrics | No | Yes | X-coordinate relative to the left for left-to-right (LTR) scripts; X-coordinate relative to the right for right-to-left (RTL) scripts. |
| top | LengthMetrics | No | Yes | Y-coordinate. |
Defines the offset relative to the four edges. If both top and bottom are set, only top takes effect. If both left and right are set, only left takes effect.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
Defines the offset relative to the four edges. If both top and** bottom **are set, only top takes effect. If both start and end are set, only start takes effect.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| top | LengthMetrics | No | Yes | Offset relative to the top edge. |
| bottom | LengthMetrics | No | Yes | Offset relative to the bottom edge. |
| start | LengthMetrics | No | Yes | Offset relative to the left in LTR mode; offset relative to the right in RTL mode. |
| end | LengthMetrics | No | Yes | Offset relative to the right in LTR mode; offset relative to the left in RTL mode. |
Defines the size constraints of a component during layout.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| minWidth | Length | No | Yes | Minimum width of the component. |
| maxWidth | Length | No | Yes | Maximum width of the component. |
| minHeight | Length | No | Yes | Minimum height of the component. |
| maxHeight | Length | No | Yes | Maximum height of the component. |
In the Row, Column, and RelativeContainer components, setting width and height to auto means that the size adapts to the size of their child components. In the TextInput component, setting width to auto means that the width adapts to the width of the text content.
Defines the width and height of a component during layout.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
Defines border information.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| width | EdgeWidths9+ | Length | LocalizedEdgeWidths12+ | No | Yes | Border width. Atomic service API: This API can be used in atomic services since API version 11. Widget capability: This API can be used in ArkTS widgets since API version 9. |
| color | EdgeColors9+ | ResourceColor | LocalizedEdgeColors12+ | No | Yes | Border color. Atomic service API: This API can be used in atomic services since API version 11. Widget capability: This API can be used in ArkTS widgets since API version 9. |
| radius | BorderRadiuses9+ | Length | LocalizedBorderRadiuses12+ | No | Yes | Border corner radius. Atomic service API: This API can be used in atomic services since API version 11. Widget capability: This API can be used in ArkTS widgets since API version 9. |
| style | EdgeStyles9+ | BorderStyle | No | Yes | Border style. Atomic service API: This API can be used in atomic services since API version 11. Widget capability: This API can be used in ArkTS widgets since API version 9. |
| dashGap12+ | EdgeWidths | LengthMetrics | LocalizedEdgeWidths | No | Yes | Sets the gap between dashed line segments. This attribute takes effect only when the border style is dashed. Percentage values are not supported. Atomic service API: This API can be used in atomic services since API version 12. Model restriction: This API can be used only in the stage model. Widget capability: This API cannot be used in ArkTS widgets. |
| dashWidth12+ | EdgeWidths | LengthMetrics | LocalizedEdgeWidths | No | Yes | Sets the length of dashed line segments. This attribute takes effect only when the border style is dashed. Percentage values are not supported. Atomic service API: This API can be used in atomic services since API version 12. Model restriction: This API can be used only in the stage model. Widget capability: This API cannot be used in ArkTS widgets. |
Defines a color filter with a 4 x 5 matrix.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
constructor(value: number[])
Constructor of ColorFilter, which creates a color filter with a 4*5 matrix.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| value | number[] | Yes | Value of the 4*5 color matrix. [m*n] is the matrix value at row m and column n. The matrix is row-major. |
Defines a custom UI content builder for component attribute methods.
| Name | Type | Description |
|---|---|---|
| CustomBuilder | (() => any) | void | Builder used to generate a custom UI component when used with the @Builder decorator. |
type CustomBuilderT<T> = (t: T) => void
Defines a custom UI content builder. Compared with CustomBuilder, this API supports one input parameter.
Widget capability: This API can be used in ArkTS widgets since API version 23.
Atomic service API: This API can be used in atomic services since API version 23.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| t | T | Yes | Used with @Builder to generate a custom component and accepts one input parameter. |
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| strokeColor | ResourceColor | No | Yes | Color of the inner icon. Default value: Color.White |
| size | Length | No | Yes | Size of the inner icon, in vp. The default size is the same as the width of the check box component. Percentage values are not supported. If an invalid value is set, the default value is used. |
| strokeWidth | Length | No | Yes | Thickness of the inner icon, in vp. Percentage values are not supported. If an invalid value is set, the default value is used. Default value: 2 |
Enumerates full-screen modal transition types.
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Description |
|---|---|
| NONE | No transition animation for the modal. |
| DEFAULT | Slide-up and slide-down animation for the modal. |
| ALPHA | Opacity gradient animation for the modal. |
Defines the outline options.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.ArkUI.ArkUI.Full
Widget capability: This API can be used in ArkTS widgets since API version 11.
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| width | EdgeOutlineWidths | Dimension | No | Yes | Sets the outline width. Percentages are not supported. Default value: 0. In the outline effect, width is mandatory; otherwise, the outline is not displayed. |
| color | EdgeColors | ResourceColor | LocalizedEdgeColors12+ | No | Yes | Sets the outline color. Default value: Color.Black |
| radius | OutlineRadiuses | Dimension | No | Yes | Sets the outline border radius. Percentages are not supported. Default value: 0 Maximum effective value: component width/2 + outlineWidth or component height/2 + outlineWidth. |
| style | EdgeOutlineStyles | OutlineStyle | No | Yes | Sets the outline style. Default value: OutlineStyle.SOLID |
To reference this object, at least one parameter must be passed.
Atomic service API: This API can be used in atomic services since API version 12.
Widget capability: This API can be used in ArkTS widgets since API version 11.
To reference this object, at least one parameter must be passed.
Atomic service API: This API can be used in atomic services since API version 12.
Widget capability: This API can be used in ArkTS widgets since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
To reference this object, at least one parameter must be passed.
Atomic service API: This API can be used in atomic services since API version 12.
Widget capability: This API can be used in ArkTS widgets since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| left | OutlineStyle | No | Yes | Style of the left outline. |
| right | OutlineStyle | No | Yes | Style of the right outline. |
| top | OutlineStyle | No | Yes | Style of the top outline. |
| bottom | OutlineStyle | No | Yes | Style of the bottom outline. |
type Dimension = PX | VP | FP | LPX | Percentage | Resource
Defines a size unit.
Widget capability: This API can be used in ArkTS widgets since API version 23.
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| PX | Physical pixel unit type. The unit px must be included, for example, '10px'. |
| VP | Viewport pixel unit. The unit vp can be included or omitted, for example, 10 or '10vp'. |
| FP | Font pixel unit type. The unit fp must be included, for example, '10fp'. |
| LPX | Logical pixel unit type. The unit lpx must be included, for example, '10lpx'. |
| Percentage | Specifies the percentage unit, for example, '10%'. |
| Resource | Size referenced from system or app resources. |
type PX = { number }px
Defines a length in px.
Widget capability: This API can be used in ArkTS widgets since API version 23.
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| { number }px | The value must be specified in px, for example, '10px'. |
type VP = { number }vp | number
Length type, used to describe a length in vp.
Widget capability: This API can be used in ArkTS widgets since API version 23.
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| { number }vp | number | A number or a vp pixel unit must be specified, for example, 10 or '10vp'. |
type FP = { number }fp
Defines a length in fp.
Widget capability: This API can be used in ArkTS widgets since API version 23.
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| { number }fp | The value must be specified in fp, for example, '10fp'. |
type LPX = { number }lpx
Defines a length in lpx.
Widget capability: This API can be used in ArkTS widgets since API version 23.
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| { number }lpx | Specifies the value in lpx pixel units, for example, '10lpx'. |
type Percentage = { number }%
Length type, used to describe a length in percentage units.
Widget capability: This API can be used in ArkTS widgets since API version 23.
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| { number }% | The percentage unit must be specified, for example, '10%'. |
type Degree = ${number}deg
Angle type, used to describe an angle in deg.
Atomic service API: This API can be used in atomic services since API version 11.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| { number }deg | The unit must be deg, for example, '10deg'. |
Defines the coordinates of the touch point. If it is not set, the touch point is centered.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
type VoidCallback = () => void
Function callback type with no parameters and no return value, used to define callback scenarios where no data needs to be passed and no result is returned.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
type Callback<T, V = void> = (data: T) => V;
Defines the callback with parameters.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
Defines divider information.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| strokeWidth | LengthMetrics | No | Yes | Width of the divider line. |
| color | ResourceColor | No | Yes | Color of the divider. |
| startMargin | LengthMetrics | No | Yes | Distance between the divider and the start edge of the menu. |
| endMargin | LengthMetrics | No | Yes | Distance between the divider and the end edge of the menu. |
| mode19+ | DividerMode | No | Yes | Sets the divider mode. |
Defines the layout weight of a component in a chain.
Atomic service API: This API can be used in atomic services since API version 14.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| horizontal | number | No | Yes | Layout weight of the component in the horizontal direction. It takes effect when set to a value greater than 0. Default value: 0 Invalid values are treated as 0. |
| vertical | number | No | Yes | Layout weight of the component in the vertical direction. It takes effect when set to a value greater than 0. Default value: 0 Invalid values are treated as 0. |
Defines the color mode and font scale.
Widget capability: This API can be used in ArkTS widgets since API version 9.
Atomic service API: This API can be used in atomic services since API version 11.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| colorMode | string | Yes | No | Color mode. |
| fontScale | number | Yes | No | Font scale. |
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| accessibilityPreferred | boolean | No | Yes | If accessibilityPreferred is set to true, the accessibility text of this child node is prioritized during depth-first traversal of each child node. If accessibilityText is empty, the component's Text is used. The concatenated text is set for the parent node whose accessibilityText and text are both empty. If accessibilityPreferred is set to false, this feature is disabled. Default value: false Atomic service API: This API can be used in atomic services since API version 14. |
| stateControllerRoleType23+ | AccessibilityRoleType | No | Yes | Type of the target child component. After a container component with accessibilityGroup enabled performs accessibility grouping, the selection state and state announcement text of the child component of the specified type are used as the state and announcement text of the grouped component. This aggregates state announcements during screen reading and eliminates the need to focus on child components individually. NOTE If multiple child components of the same type exist in the grouped component, the first matching child component found under the grouped component in the component tree acts as the controller component. Specific types in cross-process embedded components are not supported, such as widgets and EmbeddedUIExtension. Default value: no specified component Atomic service API: This API can be used in atomic services since API version 23. |
| stateControllerId23+ | string | No | Yes | Unique ID of the target child component. After a container component with accessibilityGroup enabled performs accessibility grouping, the selection state and state announcement text of the child component of the specified ID are used as the state and announcement text of the grouped component. This aggregates state announcements during screen reading and eliminates the need to focus on child components individually. NOTE If multiple child components of the same type exist in the grouped component, the first matching child component found under the grouped component in the component tree acts as the controller component. If this API is configured together with stateControllerRoleType, the component with a matching ID is prioritized. Specific types in cross-process embedded components are not supported, such as widgets and EmbeddedUIExtension. Default value: no specified component Atomic service API: This API can be used in atomic services since API version 23. |
| actionControllerRoleType23+ | AccessibilityRoleType | No | Yes | Type of the target child component. After a container component with accessibilityGroup enabled performs accessibility grouping, any triggered accessibility control operation is forwarded to the child component of the specified type. This aggregates click events during screen reading and eliminates the need to focus on child components individually. NOTE If multiple child components of the same type exist in the grouped component, the first matching child component found under the grouped component in the component tree acts as the controller component. Currently, only accessibility click actions are supported. Specific types in cross-process embedded components are not supported, such as widgets and EmbeddedUIExtension. Default value: no specified component Atomic service API: This API can be used in atomic services since API version 23. |
| actionControllerId23+ | string | No | Yes | Unique ID of the target child component. After a container component with accessibilityGroup enabled performs accessibility grouping, any triggered accessibility control operation is forwarded to the child component of the specified ID. This aggregates click events during screen reading and eliminates the need to focus on child components individually. NOTE If multiple child components of the same type exist in the grouped component, the first matching child component found under the grouped component in the component tree acts as the controller component. Currently, only accessibility click actions are supported. If this API is configured together with actionControllerRoleType, the component with a matching ID is prioritized. Specific types in cross-process embedded components are not supported, such as widgets and EmbeddedUIExtension. Default value: no specified component Atomic service API: This API can be used in atomic services since API version 23. |
Defines the margin of the scroll bar.
Atomic service API: This API can be used in atomic services since API version 20.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| start | LengthMetrics | No | Yes | Start margin of the scroll bar. Default value: 0, in vp |
| end | LengthMetrics | No | Yes | End margin of the scroll bar. Default value: 0, in vp |
type ResponsiveFillType = PresetFillType
Responsive layout fill mode, used for the WaterFlow, Grid, List, Swiper, and LazyVWaterFlowLayout components. The LazyVWaterFlowLayout component is supported since API version 26.0.0.
Atomic service API: This API can be used in atomic services since API version 22.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Type | Description |
|---|---|
| PresetFillType | Column count for different responsive breakpoints. |
Defines a responsive layout policy applicable to the WaterFlow, Grid, List, Swiper, and LazyVWaterFlowLayout components. The LazyVWaterFlowLayout component is supported since API version 26.0.0.
Atomic service API: This API can be used in atomic services since API version 22.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| fillType | ResponsiveFillType | No | Yes | Column count for different breakpoints. The default value is BREAKPOINT_DEFAULT. |
Defines component edge widths for localized logical directions. Globalization is supported.
Widget capability: This API can be used in ArkTS widgets since API version 12.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| start | T | No | No | Start edge. Corresponds to the left edge in LTR layout and the right edge in RTL layout. |
| end | T | No | No | End edge. Corresponds to the right edge in LTR layout and the left edge in RTL layout. |
| top | T | No | No | Top edge. |
| bottom | T | No | No | Bottom edge. |
Defines offset parameters for a component under anchor constraints.
Taking horizontal bias as an example, the value is the ratio of Dstart (the distance from the component to the left anchor) to Dstart + Dend (the total horizontal distance between anchors). In a mirrored language, Dstart represents the distance from the component to the right anchor. In the following figure, Dwidth indicates the width of the component.

The same rule applies to the vertical direction. The value is the ratio of Dtop (the distance from the component to the top anchor) to Dtop + Dbottom (the total vertical distance between anchors). In the following figure, Dheight indicates the height of the component.

Widget capability: This API can be used in ArkTS widgets since API version 11.
Atomic service API: This API can be used in atomic services since API version 12.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| horizontal | number | No | Yes | Bias value in the horizontal direction. This parameter takes effect only when the child component has a valid width value and two horizontal anchors. The value must be greater than or equal to 0. Default value: 0.5 |
| vertical | number | No | Yes | Bias value in the vertical direction. This parameter takes effect only when the child component has a valid height value and two vertical anchors. The value must be greater than or equal to 0. Default value: 0.5 |
Defines the number of cached items.
Atomic service API: This API can be used in atomic services since API version 22.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| minCount | number | No | No | Minimum number of cached items. When the actual number of cached items is lower than this value, cached items are loaded during idle intervals between scrolling animation frames. Value range: [0, +∞). Values less than 0 are clamped to 1. |
| maxCount | number | No | No | Maximum number of cached items. When the actual number of cached items exceeds this value, redundant items are recycled or released. The system loads items to reach the maximum count when the UI is idle (no animations or user interactions). Value range: [minCount, +∞). Values less than minCount are clamped to minCount. |
Describes a two-dimensional coordinate system.
Since: 26.0.0
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since API version 26.0.0.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| x | number | No | No | X-axis coordinate, in vp. |
| y | number | No | No | Y-axis coordinate, in vp. |
Defines optional parameters for accessibility operations of a component, which is used to restrict or modify the operations initiated by accessibility apps such as the screen reader. This API is supported only by the Slider component. If this API is used on other components, compilation succeeds but the API does not take effect.
Atomic service API: This API can be used in atomic services since API version 23.
Widget capability: This API can be used in ArkTS widgets since API version 23.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.ArkUI.ArkUI.Full
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| scrollStep | number | No | Yes | Operation step count for an accessibility scroll action triggered by an accessibility gesture. The default value is determined by the component. This setting does not take effect on unsupported components. Currently, the Slider component is supported. This API triggers sliding for the Slider component through swipe gestures after the component gains focus. Scrolling distance: scrollStep * step. Value range: [1, (max - min)/step]. The default value is 1. Out-of-range values fall back to 1. For non-integer values within the valid range, the value is rounded down to the nearest integer. |
Defines the detailed parameter object that can be used during the accessibility custom next focus processing.
Since: 26.0.0
Widget capability: This API can be used in ArkTS widgets since API version 26.0.0.
Atomic service API: This API can be used in atomic services since API version 26.0.0.
System capability: SystemCapability.ArkUI.ArkUI.Full
Model restriction: This API can be used only in the stage model.
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| isConsiderDescendants | boolean | No | Yes | Whether to search for the focus in descendant nodes during the accessibility custom next focus processing. The value true indicates that the focus in descendant nodes is searched during the accessibility custom next focus processing, and false indicates that the focus in descendant nodes is not searched. Default value: false |
Custom accessibility action API.
Since: 26.0.0
Widget capability: This API can be used in ArkTS widgets since API version 26.0.0.
Atomic service API: This API can be used in atomic services since API version 26.0.0.
System capability: SystemCapability.ArkUI.ArkUI.Full
Model restriction: This API can be used only in the stage model.
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| name | ResourceStr | No | No | Name of the custom action, used to identify and bind the action callback. NOTE The text length of the name must be within 128 bytes. The excess part will be truncated. |
| onAction | VoidCallback | No | No | Callback for processing the custom action. |