Use Menu...
- To show set of actions available to a user when there is a limited space constraint.
Don't use Menu...
- To hide critical actions for a user to complete a task. Use Button instead.
Menu is only available in the React API for SWAN.
- Menu consists of a
MenuTrigger
that wraps another element (often a Button, but it can be anything). - When that trigger is clicked, it launches a
MenuPopover
. MenuPopover
holds aMenuList
, which contains one or moreMenuItem
children.- Each
MenuItem
acts as a button by default, but you can have it act as a link instead (see below). Menu
shares code withListbox
, and behaves similarly: to detect a user interaction with the Menu, use anonChange
handler on theMenu
itself.
The preview has been updated.
Icons
A MenuItem
may contain an icon, which can help users discern the difference between options faster.
The preview has been updated.
Sections
Use MenuSection
to display a section title to wrap a group of MenuItem
s. Each MenuSection
requires a title
and a key
prop.
The preview has been updated.
Links
Use an href
prop on a MenuItem
to make it act as a link instead of a button.
The preview has been updated.