본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

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 itemId property to link to callbacks. In this example, the onSelect property logs information to the console when a menu item is selected. In practice, specific actions can be linked to onSelect callbacks.

  • Use the to property to direct users to other resources or webpages after selecting a menu item, and the onClick property to pass in a callback for specific menu items.

  • Use the isDisabled property to disable a menu item.

  • Use the isPlain property to remove the outer box shadow and style the menu plainly instead.

  • Link

  • Disabled link

  • Aria-disabled link

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.

Actions

더 알아보기 (Learn more)