Menu

  • MenuBase component is a Paper with MenuItems. The menu items can be set up with a multidimensional menu array with object type of elements. The object can contain label and other MenuItem properties. If the object contain an items array, that mean a nested menu.
  • The Menu component based on the Popover and the MenuBase component. The MenuBase will show up in a ModalBase, and the Popover set its position to AnchorComponent

Props

MenuBase
NameTypeDefaultDescription
menuarrayA multidimensional array with menu objects
PaperComponentelement typePaperThe component used for the Paper node. Either a string to use a HTML element or a component.
PaperPropsobject{color:'paper1', size:'menu', ContentComponent: 'Modal'}Passing props to the PaperComponent
MenuItemComponentelement typeMenuItemThe component used for menu items node. Either a string to use a HTML element or a component.
MenuItemPropsobjectPassing props to the MenuItemComponent
classesobject {listPaper:'', popoverPaper:'', basePaper:''}Adds these classNames to the corresponding element
selectableboolfalseIf true, the menu items become selectable. The selectable items in the menu array must have a value property
multipleboolfalseIf true, multiple selection will be enabled
valuearrayInitial selected values
onChangefunctionFires when a change occurs. Its inputs (event, value)
The ref is forwarded to the root Paper element.
Menu
NameTypeDefaultDescription
PopoverPropsobjectPassing props to the Popover
classesobject {modal:'', listPaper:'', popoverPaper:'', basePaper:''}Adds these classNames to the corresponding element
The ref is forwarded to the MenuBase Paper element.
Props of the MenuBase component are also available.

Examples

MenuBase Component usage for sidebars or other embed menus, the first example use list the second use the Popover Component for nested items
It is possible to mix the list and default popover menuType
Menu Component usage for Button Menu or Icon Menu or other drop and down type menus
Nested menus work in the same way as drop-down menus. The first example shows the menu menuType of the inner menu, the other shows the popover type (as in the first example on this page).
Disable inset, passing custom style to nested menu items
An extreme example for styling
Set up min-width with Container
/*noinspection ALL*/ .menuBasePaperDependsOnParentContainer { min-width: var(--digby-container-parent-side-min-width); } /*noinspection ALL*/ .menuPopoverPaperDependsOnRootContainer { min-width: var(--digby-container-root-side-min-width); } /*noinspection ALL*/ .menuModalDependsOnRootContainer > [data-popper-placement] { min-width: var(--digby-container-root-side-min-width); }
Selectable menu, in the first example you can select one, in the second you can select multiple