1e41f4b71Sopenharmony_ci# MenuItem
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **MenuItem** component represents an item in a menu.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> This component is supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Child Components
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciNot supported
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci## APIs
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciMenuItem(value?: MenuItemOptions| CustomBuilder)
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci**Parameters** 
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci| Name | Type                                                                                                                         | Mandatory | Description                    |
22e41f4b71Sopenharmony_ci| ----- | ----------------------------------------------------------------------------------------------------------------------------- | ---- | ---------------------------- |
23e41f4b71Sopenharmony_ci| value | [MenuItemOptions](#menuitemoptions) \| [CustomBuilder](ts-types.md#custombuilder8) | No  | Information about the menu item. |
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci## MenuItemOptions
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci| Name     | Type                                       | Mandatory | Description                                  |
30e41f4b71Sopenharmony_ci| --------- | ------------------------------------------- | ---- | -------------------------------------- |
31e41f4b71Sopenharmony_ci| startIcon | [ResourceStr](ts-types.md#resourcestr)      | No  | Path to the icon displayed on the left of the menu item.      |
32e41f4b71Sopenharmony_ci| content   | [ResourceStr](ts-types.md#resourcestr)      | No  | Content of the menu item.                      |
33e41f4b71Sopenharmony_ci| endIcon   | [ResourceStr](ts-types.md#resourcestr)      | No  | Path to the icon displayed on the right of the menu item.      |
34e41f4b71Sopenharmony_ci| labelInfo | [ResourceStr](ts-types.md#resourcestr)      | No  | Information about the ending label, for example, shortcut **Ctrl+C**. |
35e41f4b71Sopenharmony_ci| builder   | [CustomBuilder](ts-types.md#custombuilder8) | No  | Builder for a level-2 menu.                    |
36e41f4b71Sopenharmony_ci| symbolStartIcon<sup>12+</sup>   | [SymbolGlyphModifier](ts-universal-attributes-attribute-modifier.md) | No  | Path to the symbol icon displayed on the left of the menu item. When this parameter is set, the icon set through **startIcon** is not displayed.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
37e41f4b71Sopenharmony_ci| symbolEndIcon<sup>12+</sup>   | [SymbolGlyphModifier](ts-universal-attributes-attribute-modifier.md) | No  | Path to the symbol icon displayed on the right of the menu item. When this parameter is set, the icon set through **endIcon** is not displayed.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci## Attributes
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ciIn addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci### selected
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ciselected(value: boolean)
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ciSets whether the menu item is selected.
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ciSince API version 10, this parameter supports two-way binding through [$$](../../../quick-start/arkts-two-way-sync.md).
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci**Parameters** 
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci| Name | Type   | Mandatory | Description                               |
59e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ----------------------------------- |
60e41f4b71Sopenharmony_ci| value  | boolean | Yes  | Whether the menu item is selected.<br>Default value: **false** |
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci### selectIcon
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ciselectIcon(value: boolean | ResourceStr | SymbolGlyphModifier)
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ciSets whether to display the selected icon when the menu item is selected.
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ci**Parameters** 
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory | Description                                                        |
75e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
76e41f4b71Sopenharmony_ci| value  | boolean \| [ResourceStr](ts-types.md#resourcestr)<sup>10+</sup>\| [SymbolGlyphModifier](ts-universal-attributes-attribute-modifier.md)<sup>12+</sup> | Yes  | Whether to display the selected icon when the menu item is selected.<br>Default value: **false**<br>**true**: When the menu item is selected, the default tick icon is displayed.<br>**false**: When the menu item is selected, no icon is displayed.<br>**ResourceStr**: When the menu item is selected, the specified icon is displayed.<br>**SymbolGlyphModifier**: When the menu item is selected, the specified symbol icon is displayed. |
77e41f4b71Sopenharmony_ci### contentFont<sup>10+</sup>
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_cicontentFont(value: Font)
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ciSets the font style of the menu item content.
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci**Parameters** 
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci| Name | Type                    | Mandatory | Description                        |
90e41f4b71Sopenharmony_ci| ------ | ------------------------ | ---- | ---------------------------- |
91e41f4b71Sopenharmony_ci| value  | [Font](ts-types.md#font) | Yes  | Font style of the menu item content. |
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci### contentFontColor<sup>10+</sup>
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_cicontentFontColor(value: ResourceColor)
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ciSets the font color of the menu item content.
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci**Parameters** 
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci| Name | Type                                      | Mandatory | Description                        |
106e41f4b71Sopenharmony_ci| ------ | ------------------------------------------ | ---- | ---------------------------- |
107e41f4b71Sopenharmony_ci| value  | [ResourceColor](ts-types.md#resourcecolor) | Yes  | Font color of the menu item content. |
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ci### labelFont<sup>10+</sup>
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_cilabelFont(value: Font)
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ciSets the font style of the menu item label.
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci**Parameters** 
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci| Name | Type                    | Mandatory | Description                        |
122e41f4b71Sopenharmony_ci| ------ | ------------------------ | ---- | ---------------------------- |
123e41f4b71Sopenharmony_ci| value  | [Font](ts-types.md#font) | Yes  | Font style of the menu item label. |
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ci### labelFontColor<sup>10+</sup>
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_cilabelFontColor(value: ResourceColor)
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ciSets the font color of the menu item label.
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci**Parameters** 
136e41f4b71Sopenharmony_ci
137e41f4b71Sopenharmony_ci| Name | Type                                      | Mandatory | Description                        |
138e41f4b71Sopenharmony_ci| ------ | ------------------------------------------ | ---- | ---------------------------- |
139e41f4b71Sopenharmony_ci| value  | [ResourceColor](ts-types.md#resourcecolor) | Yes  | Font color of the menu item label. |
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ci## Events
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_ci### onChange
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_cionChange(callback: (selected: boolean) => void)
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ciTriggered when the selection status of the menu item is changed manually.
148e41f4b71Sopenharmony_ci
149e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
152e41f4b71Sopenharmony_ci
153e41f4b71Sopenharmony_ci**Parameters** 
154e41f4b71Sopenharmony_ci
155e41f4b71Sopenharmony_ci| Name  | Type   | Mandatory | Description                                                        |
156e41f4b71Sopenharmony_ci| -------- | ------- | ---- | ------------------------------------------------------------ |
157e41f4b71Sopenharmony_ci| selected | boolean | Yes  | Invoked when the selected status changes.<br>If the return value is **true**, the menu item is selected. The value **true** means that the menu item is selected, and **false** means the opposite.|
158e41f4b71Sopenharmony_ci
159e41f4b71Sopenharmony_ci## Example
160e41f4b71Sopenharmony_ci
161e41f4b71Sopenharmony_ciSee the example of [Menu](ts-basic-components-menu.md#example).
162