Command Palette

Search for a command to run...

Components · Complex component

Menu

A floating element that displays a list of actions or options that a user can choose.

Usage

TSX
import { Menu } from '@console/nimbus-ui/core';

Examples

Section

Menu supports sections in order to group options. Sections can be used by wrapping groups of Items in a Section component. Each Section takes a title and key prop. Sections can be used by wrapping groups of <Menu.Item/> in a <Menu.Section> component. A <Menu.Header> element may also be included to label the section.

Single

Use the selectionMode prop to enable selection within a Menu, using either single or multiple selection. Use single to allow users to select only one item at a time.

Multiple

The Menu component also supports multiple selection using the selectionMode prop. Use multiple to allow users to select more than one item at a time.

Is Danger

Use the isDanger prop to designate a menu item as dangerous. This will use our danger theme colours to color the background, icon and text of the menu item.

Is Disabled

Use the isDisabled prop to disable specific menu items.

Separator

Separators may be added between menu items or sections using <Menu.Seperator> in order to create non-labeled groupings.

Custom Trigger

To use a custom trigger element, import the <Pressable> component and wrap whatever item you'd like to make pressable. Some elements such as SVGs don't spread props, simple use a span or extra div for problematic components.

API

Menu

PropTypeDefaultDescription
data-rac-idstring—Data attribute for GTM purposes. Pass this property to add a custom id to the root element for GTM tracking.
data-testidstring—Data attribute for E2E testing purposes

Menu.Item

PropTypeDefaultDescription
isDangerboolean—

Menu.Section

PropTypeDefaultDescription
titlestring—

Menu.Header

PropTypeDefaultDescription
classNamestring—