diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md index d37d1d1f1421a570c749484e59fd3f9ef9883952..d322c63560b3fc012d6dd089b6bf7227e7ee8fea 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md @@ -1,7 +1,10 @@ # Menu Control -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** -> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +This module provides APIs for binding a menu – a vertical list of items – to a component. This menu is displayed by long-pressing, clicking, or right-clicking the component. + +> **NOTE** +> +> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## Required Permissions @@ -12,29 +15,30 @@ None ## Attributes -| Name | Type | Default Value | Description | -| ---------------------------- | ---------------------------------------- | ------------- | ---------------------------------------- | -| bindMenu | Array8+ | - | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported. | -| bindContextMenu8+ | content: [CustomBuilder](../../ui/ts-types.md)
responseType: ResponseType | - | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported. | +| Name | Type | Default Value | Description | +| ---------------------------- | ---------------------------------------- | ---- | ---------------------------------- | +| bindMenu | Array8+ | - | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported.| +| bindContextMenu8+ | content: [CustomBuilder](../../ui/ts-types.md),
responseType: ResponseType | - | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported. | - MenuItem - | Name | Type | Description | - | ------ | ------------- | ---------------------------------------- | - | value | string | Menu item text. | - | action | () => void | Action triggered when a menu item is clicked. | + | Name | Type | Description | + | ------ | ----------------------- | ----------- | + | value | string | Menu item text. | + | action | () => void | Action triggered when a menu item is clicked.| - ResponseType8+ - | Value | Description | - | ---------- | ---------------------------------------- | - | LongPress | The menu is displayed when the component is long-pressed. | - | RightClick | The menu is displayed when the component is right-clicked. | + | Value | Description | + | ---------- | ------------- | + | LongPress | The menu is displayed when the component is long-pressed. | + | RightClick | The menu is displayed when the component is right-clicked.| ## Example #### Menu with Textual Menu Items -``` +```ts +// xxx.ets @Entry @Component struct MenuExample { @@ -66,7 +70,8 @@ struct MenuExample { #### Menu with Custom Menu Items -``` +```ts +// xxx.ets import router from '@system.router'; @Entry @@ -116,7 +121,8 @@ struct MenuExample { #### Context Menu (Displayed Upon Right-Clicking) -``` +```ts +// xxx.ets @Entry @Component struct ContextMenuExample {