1# Accessibility
2
3You can set accessibility attributes and events for components.
4
5>  **NOTE**
6>
7>  The APIs of this module are supported since API version 10. Updates will be marked with a superscript to indicate their earliest API version.
8
9## accessibilityGroup
10
11accessibilityGroup(value: boolean)
12
13Sets the accessibility group.
14
15**Widget capability**: This API can be used in ArkTS widgets since API version 12.
16
17**Atomic service API**: This API can be used in atomic services since API version 11.
18
19**System capability**: SystemCapability.ArkUI.ArkUI.Full
20
21**Parameters**
22
23| Name| Type   | Mandatory| Description                                                        |
24| ------ | ------- | ---- | ------------------------------------------------------------ |
25| value  | boolean | Yes  | Accessibility group. If this attribute is set to **true**, the component and all its child components form an entire selectable component, and the accessibility service will no longer be available for the content of its child components.<br>Default value: **false**|
26
27## accessibilityText
28
29accessibilityText(value: string)
30
31Sets the accessibility text.
32
33**Widget capability**: This API can be used in ArkTS widgets since API version 12.
34
35**Atomic service API**: This API can be used in atomic services since API version 11.
36
37**System capability**: SystemCapability.ArkUI.ArkUI.Full
38
39**Parameters**
40
41| Name| Type  | Mandatory| Description                                                        |
42| ------ | ------ | ---- | ------------------------------------------------------------ |
43| value  | string | Yes  | Accessibility text. If a component does not contain text information, it will not be read when the component is selected by the screen reader. In this case, the screen reader user cannot know which component is selected. To solve this problem, you can set this attribute for components without text information. When the component is selected by the screen reader, the specified accessibility text will be read, informing the user which component is selected.<br>Default value: **""**<br>**NOTE**<br>If a component with this attribute set contains text information, only the accessibility text will be read.<br>If a component with its **accessibilityGroup** attribute set to **true** does not have **accessibilityText** set and does not contain text information, text concatenation will be performed on its child components (depth first).|
44
45## accessibilityText<sup>12+</sup>
46
47accessibilityText(text: Resource)
48
49Sets the accessibility text, which supports referencing resource files through **Resource**.
50
51**Widget capability**: This API can be used in ArkTS widgets since API version 12.
52
53**Atomic service API**: This API can be used in atomic services since API version 12.
54
55**System capability**: SystemCapability.ArkUI.ArkUI.Full
56
57**Parameters**
58
59| Name| Type  | Mandatory| Description                                                                                                                                                                                                                                                                  |
60| ------ | ------ | ---- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
61| text  | [Resource](ts-types.md#resource) | Yes  | Reference resource of accessibility text. If a component does not contain text information, it will not be read when the component is selected by the screen reader. In this case, the screen reader user cannot know which component is selected. To solve this problem, you can set this attribute for components without text information. When the component is selected by the screen reader, the specified accessibility text will be read, informing the user which component is selected.<br>**NOTE**<br>If a component with this attribute set contains text information, only the accessibility text will be read.<br>If a component with its **accessibilityGroup** attribute set to **true** does not have **accessibilityText** set and does not contain text information, text concatenation will be performed on its child components (depth first).|
62
63
64## accessibilityDescription
65
66accessibilityDescription(value: string)
67
68Sets the accessibility description.
69
70**Widget capability**: This API can be used in ArkTS widgets since API version 12.
71
72**Atomic service API**: This API can be used in atomic services since API version 11.
73
74**System capability**: SystemCapability.ArkUI.ArkUI.Full
75
76**Parameters**
77
78| Name| Type  | Mandatory| Description                                                        |
79| ------ | ------ | ---- | ------------------------------------------------------------ |
80| value  | string | Yes  | Accessibility description. You can specify further explanation of the current component, for example, possible operation consequences, especially those that cannot be learned from component attributes and accessibility text. If a component contains both text information and the accessibility description, the text is read first and then the accessibility description, when the component is selected.<br>Default value: **""**|
81
82## accessibilityDescription<sup>12+</sup>
83
84accessibilityDescription(description: Resource)
85
86Sets the accessibility description, which supports referencing resource files through **Resource**.
87
88**Widget capability**: This API can be used in ArkTS widgets since API version 12.
89
90**Atomic service API**: This API can be used in atomic services since API version 12.
91
92**System capability**: SystemCapability.ArkUI.ArkUI.Full
93
94**Parameters**
95
96| Name| Type  | Mandatory| Description                                                                                                                                                                                   |
97| ------ | ------ | ---- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
98| description  | [Resource](ts-types.md#resource) | Yes  | Reference resource of the accessibility description. You can specify further explanation of the current component, for example, possible operation consequences, especially those that cannot be learned from component attributes and accessibility text. If a component contains both text information and the accessibility description, the text is read first and then the accessibility description, when the component is selected.|
99
100## accessibilityLevel
101
102accessibilityLevel(value: string)
103
104Sets the accessibility level.
105
106**Widget capability**: This API can be used in ArkTS widgets since API version 12.
107
108**Atomic service API**: This API can be used in atomic services since API version 11.
109
110**System capability**: SystemCapability.ArkUI.ArkUI.Full
111
112**Parameters**
113
114| Name| Type  | Mandatory| Description                                                        |
115| ------ | ------ | ---- | ------------------------------------------------------------ |
116| value  | string | Yes  | Accessibility level, which is used to decide whether a component can be identified by the accessibility service.<br>The options are as follows:<br>**"auto"**: The value is converted to **"yes"** or **"no"** based on the component.<br>**"yes"**: The current component is selectable for the accessibility service.<br>**"no"**: The current component is not selectable for the accessibility service.<br>**"no-hide-descendants"**: The current component and all its child components are not selectable for the accessibility service.<br>**Default value**: **"auto"**<br>**NOTE**<br>When the **accessibilityLevel** attribute of the following components is set to **"auto"**, they are selectable for the accessibility service: Checkbox, CheckboxGroup, Gauge, Marquee, MenuItem, MenuItemGroup, Menu, Navigation, DatePicker, Progress, Radio, Rating, ScrollBar, Select, Slider, Stepper, Text, TextClock, TextPicker, TextTimer, TimePicker, Toggle, Web.|
117
118## accessibilityVirtualNode<sup>11+</sup>
119
120accessibilityVirtualNode(builder: CustomBuilder)
121
122Sets the accessibility virtual node.
123
124**Widget capability**: This API can be used in ArkTS widgets since API version 12.
125
126**Atomic service API**: This API can be used in atomic services since API version 11.
127
128**System capability**: SystemCapability.ArkUI.ArkUI.Full
129
130**Parameters**
131
132| Name| Type  | Mandatory| Description                                                        |
133| ------ | ------ | ---- | ------------------------------------------------------------ |
134| builder  | [CustomBuilder](ts-types.md#custombuilder8) | Yes  | Accessibility virtual node, which enables you to pass in a custom builder to the self-drawing component. The components in the custom builder are only laid out but not displayed at the backend. When the accessibility application obtains the accessibility node information, the node information in the custom builder is returned.|
135
136## Example
137
138```ts
139// xxx.ets
140@Entry
141@Component
142struct Index {
143
144  @Builder customAccessibilityNode() {
145    Column() {
146      Text(`virtual node`)
147    }
148    .width(10)
149    .height(10)
150  }
151
152  build() {
153    Row() {
154      Column() {
155        Text ("Text 1")
156          .fontSize(50)
157          .fontWeight(FontWeight.Bold)
158        Text ("Text 2")
159          .fontSize(50)
160          .fontWeight(FontWeight.Bold)
161      }
162      .width('100%')
163      .accessibilityGroup(true)
164      .accessibilityLevel("yes")
165      .accessibilityText ("Group")
166      .accessibilityDescription("The <Column> component is selectable , and the text to be read out is "Group".)
167      .accessibilityVirtualNode(this.customAccessibilityNode)
168    }
169    .height('100%')
170  }
171}
172```
173