Components

MenuGroup

MenuGroups assemble MenuItems and can display a title. Grouping Menu options provides context clues to users about related actions. An optional title can be added to reinforce the intent of the grouping.

Examples #

Import Syntax #

import Menu, { MenuGroup } from 'mineral-ui/Menu';

To group MenuItems together, wrap them in a MenuGroup. Optionally, provide a title to provide context if the grouping is large or not immediately obvious.

Your Menu may not need a MenuGroup title. If your Menu is simple, instead consider using a MenuDivider, which is quicker to scan for your users.

Menu Group Title

Menu item
Menu item

Menu Group Title

Menu item
Menu item
<DemoLayout>
  <Menu>
    <MenuGroup title="Menu Group Title">
      <MenuItem>
        Menu item
      </MenuItem>
      <MenuItem>
        Menu item
      </MenuItem>
    </MenuGroup>
    <MenuGroup title="Menu Group Title">
      <MenuItem>
        Menu item
      </MenuItem>
      <MenuItem>
        Menu item
      </MenuItem>
    </MenuGroup>
  </Menu>
</DemoLayout>

API & Theme #

MenuGroup Props #

The MenuGroup component takes the following React props.

NameTypeDefaultDescription
childrenReact$Node
titleReact$Node

Title for the group

Undocumented properties, including as and css, will be applied to the root element.

MenuGroup Theme Variables #

These variables can be used as hooks to override this component's style at either a local or global level. The theme referenced below is whatever theme is available from props to the instance of this component.

VariableValue
MenuGroupTitle_fontSizetheme.fontSize_mouse
MenuGroupTitle_fontWeighttheme.h5_fontWeight
MenuGroupTitle_marginToptheme.space_stack_sm
MenuGroupTitle_paddingToptheme.space_stack_md
MenuGroupTitle_paddingBottomtheme.space_stack_sm

Usage #

When/How to Use #

MenuGroups are used to group conceptually related elements, and to hint at other available, related options. If the intention of the grouping is not immediately obvious, add a section title via the title prop to aid in your users' decision-making process.

If there are only a few elements in a couple of groups, and the grouping logic is obvious, consider using a MenuDivider instead.

Best Practices #

Create groups if there are more than one set of actions in a Menu. Users will be able to quickly scan their available options if there aren't too many actions at the same level of hierarchy.

Undo
Redo
Cut
Copy
Paste

Don't repeat the obvious in the group title. If there are only a couple of groups with a handful of elements, trust that the user will figure out the grouping from context.

History Navigation

Undo
Redo

Text Actions

Cut
Copy
Paste

Don't place too many items in a group, which will be overwhelming to users and your feature will get buried.

Decrease font size
Increase font size
Toggle command palette
Toggle console
Toggle context view
Toggle debugger
Toggle diagnostics
Toggle distraction free mode
Toggle file tree
Toggle git tab
Toggle GitHub tab
Toggle health
Toggle outline view
Toggle quick open
Toggle React inspector
Toggle soft wrap
Toggle task runner
Toggle test runner