Skip to contentSkip to navigationSkip to topbar
Paste assistant Assistant
Figma
Star

Menu

Version 14.1.3GithubStorybookPeer review pending

A Menu is a button that presents a list of items that users can choose to trigger an action.

Installation

Installation page anchor
yarn add @twilio-paste/menu - or - yarn add @twilio-paste/core
import {Menu, MenuButton, MenuItem, MenuSeparator, useMenuState} from '@twilio-paste/core/menu';
import {ChevronDownIcon} from '@twilio-paste/icons/esm/ChevronDownIcon';

const PreferencesMenu = () => {
  const menu = useMenuState();
  return (
    <>
      <MenuButton {...menu} variant="primary">
        Preferences <ChevronDownIcon decorative />
      </MenuButton>
      <Menu {...menu} aria-label="Preferences">
        <MenuItem {...menu}>Settings</MenuItem>
        <MenuItem {...menu} disabled>
          Extensions
        </MenuItem>
        <MenuSeparator {...menu} />
        <MenuItem {...menu}>Keyboard shortcuts</MenuItem>
      </Menu>
    </>
  );
};
MenuInitialState page anchor

as

Type
any

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
'MENU_ITEM'

href

Pass href prop to render an anchor element.

Type
string

variant

Type
any

as

Type
any

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
MENU_ITEM_CHECKBOX

href

Pass href prop to render an anchor element.

Type
string

variant

Type
any

as

Type
any

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
MENU_ITEM_CHECKBOX

href

Pass href prop to render an anchor element.

Type
string

variant

Type
any

label RequiredRequired

Accessible name of the MenuGroup.

Type
string

element

Overrides the default element name to apply unique styles with the Customization Provider

Type
any
Default
MENU_GROUP

icon

Pass a decorative Paste icon to display with the group label.

Type
| string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal