Skip to Content
Archi-ui 1.0.25 is released 🎉

Menu

A menu displays a list of choices on a temporary surface. It appears when the user interacts with a button, or other control.

Introduction

Menus are implemented using a collection of related components:

  • Menu: The container/surface of the menu.
  • Menu Item: An option for users to select from the menu.
  • Menu List (optional): Alternative composable container for Menu Items for details.

Basic Menu

A basic menu opens over the anchor element by default. When close to a screen edge, a basic menu vertically realigns to make sure that all menu items are completely visible.

You should configure the component so that selecting an option immediately confirms it and closes the menu, as shown in the demo below.

Usage

import { Menu, MenuItem } from 'archi-ui'
<Menu open={true}> <MenuItem divider>Item 1</MenuItem> <MenuItem divider>Item 2</MenuItem> <MenuItem divider>Item 3</MenuItem> <MenuItem divider>Item 4</MenuItem> </Menu>

Icon menu

Dense menu

For the menu taht has long list and long text, you can use the dense prop in MenuItem component to reduce the padding and text size.

Selected menu

If used for item selection, when opened, simple menus places the initial focus on the selected menu item. The currently selected menu item is set using the selected prop from MenuItem.

My account

positioned menu

You can display the menu on top of the anchor.

Account menu

Menu content can be mixed with other components like Avatar.

Home

About

Task

Max height menu

If the height of a menu prevents all menu items from being displayed, the menu can scroll internally.

API reference docs for the React Menu component.

Props

NameTypeDefaultDescription
childrennode-Menu contents, normally MenuItem.
classNamestring-Override or extend the styles applied to the component
openbool-If true, the component is shown.
anchorElHTML element | func-An HTML element, or a function that returns one. It’s used to set the position of the menu.
onClosefunc-Callback fired when the component is requests to be closed.
Signature: function() => void.
disableEscapeKeyDownboolfalseIf true, hitting escape will not fire the onClose callback.
onBackdropClickfunc-A function is triggred if provided when backdrop is been clicked.
BackdropPropsobject-Props applied to the Backdrop element.
hideBackdropboolfalseIf true, the backdrop is not rendered.
scrollLockbooltrueDisable the scroll lock behavior.
anchorOrigin{ horizontal: 'center'|'left'|'right', vertical: 'center'|'bottom'|'top' }{ vertical:'bottom', horizontal:'left' }This is the point on the anchor where the Menu’s anchorEl wil attach to.
Options: vertical: [top, center, bottom], horizontal: [left, center, right].
transformOrigin{ horizontal: 'center'|'left'|'right', vertical: 'center'|'bottom'|'top' }{ vertical:'top', horizontal:'left' }This is the point on the Menu which will attach to the anchor’s origin.
Options: vertical: [top, center, bottom], horizontal: [left, center, right].
Last updated on