--- title: Menu Item sidebar_position: 3 sidebar_custom_props: icon: TbMenu --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import { SandpackEditor} from '@site/src/ui/SandpackEditor' import menuItemCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemCode.js' import menuItemCommandCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemCommandCode.js' import menuItemDraggableCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemDraggableCode.js' import menuItemMultiSelectAvatarCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemMultiSelectAvatarCode.js' import menuItemMultiSelectCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemMultiSelectCode.js' import menuItemNavigateCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemNavigateCode.js' import menuItemSelectAvatarCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemSelectAvatarCode.js' import menuItemSelectCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemSelectCode.js' import menuItemSelectColorCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemSelectColorCode.js' import menuItemToggleCode from '!!raw-loader!@site/src/ui/navigation/menu-item/menuItemToggleCode.js' A versatile menu item designed to be used in a menu or navigation list.
Props Type Description Default
LeftIcon IconComponent An optional left icon displayed before the text in the menu item
accent string Specifies the accent color of the menu item. Options include: `default`, `danger`, and `placeholder` default
text string The text content of the menu item
iconButtons array An array of objects representing additional icon buttons associated with the menu item
isTooltipOpen boolean Controls the visibility of the tooltip associated with the menu item
testId string The data-testid attribute for testing purposes
onClick function Callback function triggered when the menu item is clicked
className string Optional name for additional styling
## Variants The different variants of the menu item component include the following: ### Command A command-style menu item within a menu to indicate keyboard shortcuts.
Props Type Description
LeftIcon IconComponent An optional left icon displayed before the text in the menu item
text string The text content of the menu item
firstHotKey string The first keyboard shortcut associated with the command
secondHotKey string The second keyboard shortcut associated with the command
isSelected boolean Indicates whether the menu item is selected or highlighted
onClick function Callback function triggered when the menu item is clicked
className string Optional name for additional styling
### Draggable A draggable menu item component designed to be used in a menu or list where items can be dragged, and additional actions can be performed through icon buttons.
Props Type Description Default
LeftIcon IconComponent An optional left icon displayed before the text in the menu item
accent string The accent color of the menu item. It can either be `default`, `placeholder`, and `danger` default
iconButtons array An array of objects representing additional icon buttons associated with the menu item
isTooltipOpen boolean Controls the visibility of the tooltip associated with the menu item
onClick function Callback function to be triggered when the link is clicked
text string The text content of the menu item
isDragDisabled boolean Indicates whether dragging is disabled `false`
className string Optional name for additional styling
### Multi Select Provides a way to implement multi-select functionality with an associated checkbox.
Props Type Description
LeftIcon IconComponent An optional left icon displayed before the text in the menu item
text string The text content of the menu item
selected boolean Indicates whether the menu item is selected (checked)
onSelectChange function Callback function triggered when the checkbox state changes
className string Optional name for additional styling
### Multi Select Avatar A multi-select menu item with an avatar, a checkbox for selection, and textual content.
Props Type Description
avatar `ReactNode` The avatar or icon to be displayed on the left side of the menu item
text string The text content of the menu item
selected boolean Indicates whether the menu item is selected (checked)
onSelectChange function Callback function triggered when the checkbox state changes
className string Optional name for additional styling
### Navigate A menu item featuring an optional left icon, textual content, and a right-chevron icon.
Props Type Description
LeftIcon IconComponent An optional left icon displayed before the text in the menu item
text string The text content of the menu item
onClick function Callback function to be triggered when the menu item is clicked
className string Optional name for additional styling
### Select A selectable menu item, featuring optional left content (icon and text) and an indicator (check icon) for the selected state.
Props Type Description
LeftIcon IconComponent An optional left icon displayed before the text in the menu item
text string The text content of the menu item
selected boolean Indicates whether the menu item is selected (checked)
disabled boolean Indicates whether the menu item is disabled
hovered boolean Indicates whether the menu item is currently being hovered over
onClick function Callback function to be triggered when the menu item is clicked
className string Optional name for additional styling
### Select Avatar A selectable menu item with an avatar, featuring optional left content (avatar and text) and an indicator (check icon) for the selected state.
Props Type Description
avatar `ReactNode` The avatar or icon to be displayed on the left side of the menu item
text string The text content of the menu item
selected boolean Indicates whether the menu item is selected (checked)
disabled boolean Indicates whether the menu item is disabled
hovered boolean Indicates whether the menu item is currently being hovered over
testId string The data-testid attribute for testing purposes
onClick function Callback function to be triggered when the menu item is clicked
className string Optional name for additional styling
### Select Color A selectable menu item with a color sample for scenarios where you want users to choose a color from a menu.
Props Type Description Default
color string The theme color to be displayed as a sample in the menu item. Options include: `green`, `turquoise`, `sky`, `blue`, `purple`, `pink`, `red`, `orange`, `yellow`, and `gray`
selected boolean Indicates whether the menu item is selected (checked)
disabled boolean Indicates whether the menu item is disabled
hovered boolean Indicates whether the menu item is currently being hovered over
variant string The variant of the color sample. It can either be `default` or `pipeline` default
onClick function Callback function to be triggered when the menu item is clicked
className string Optional name for additional styling
### Toggle A menu item with an associated toggle switch to allow users to enable or disable a specific feature
Props Type Description
LeftIcon IconComponent An optional left icon displayed before the text in the menu item
text string The text content of the menu item
toggled boolean Indicates whether the toggle switch is in the "on" or "off" state
onToggleChange function Callback function triggered when the toggle switch state changes
toggleSize string The size of the toggle switch. It can be either 'small' or 'medium'
className string Optional name for additional styling