Menu
출처: 문서
본문
Examples
Basic menus
A menu may contain multiple variations of `` components. The following example shows a few different states of menu items, where they may:
-
Use the
itemIdproperty to link to callbacks. In this example, theonSelectproperty logs information to the console when a menu item is selected. In practice, specific actions can be linked toonSelectcallbacks. -
Use the
toproperty to direct users to other resources or webpages after selecting a menu item, and theonClickproperty to pass in a callback for specific menu items. -
Use the
isDisabledproperty to disable a menu item. -
Use the
isPlainproperty to remove the outer box shadow and style the menu plainly instead.
Plain menu
Danger menu item
To indicate that a `` is connected to a potentially destructive action, use the isDanger property. The "Delete" item in the following example demonstrates how danger items look.
With icons
Use the icon property to add a familiar icon before a `` to accelerate text label recognition.
With actions
To connect a menu item to an action icon, add a to a, and use the icon property to load an easily recognizable icon.
To trigger an action when any menu action icon is selected, pass a callback to the onActionClick property of the . The following example logs to the console any time any action icon is selected. To trigger an action when a specific item's action icon is selected, pass in the `onClick` property to that . The following example logs "clicked on code icon" to the console when the "code" icon is selected.