Menu

A menu component that displays a list of actions or options in a dropdown popup, triggered by a button.

Overview

The Menu component displays a list of actions or options in a popup, triggered by a button. Built on Base UI Menu primitives, it supports checkboxes, radio groups, submenus, keyboard navigation, and fully customizable styling.

Usage

import {
  Menu,
  MenuContent,
  MenuItem,
  MenuTrigger,
} from "@tilt-legal/cubitt-components/primitives";
<Menu>
  <MenuTrigger render={<Button />}>Open Menu</MenuTrigger>
  <MenuContent>
    <MenuItem>Profile</MenuItem>
    <MenuItem>Settings</MenuItem>
  </MenuContent>
</Menu>

Examples

With Labels

Light Content Variant

Use variant="light" when the menu should sit on a lighter bg-bg-2 surface with softer highlighted states.

With Checkboxes

With Radio Group

With Submenu

With Groups

With Destructive Action

URL State

Trigger URL state changes by providing paramName/paramSetValue to individual MenuItem elements. Useful for opening dialogs, sheets, or other components when a menu item is selected.

API Reference

The root component that manages the menu state.

PropTypeDescription
openbooleanWhether the menu is currently open (controlled).
defaultOpenbooleanWhether the menu is initially open (uncontrolled). Defaults to false.
onOpenChange(open: boolean, eventDetails) => voidCallback fired when the open state changes.
modalbooleanWhether the menu is modal (locks document scroll). Defaults to true.
disabledbooleanWhether the menu is disabled. Defaults to false.
openOnHoverbooleanWhether to open the menu on hover. Defaults to false.
delaynumberDelay in milliseconds before opening on hover. Defaults to 100.
closeDelaynumberDelay in milliseconds before closing on hover. Defaults to 0.
loopbooleanWhether to loop keyboard focus. Defaults to true.
orientation"horizontal" | "vertical"The visual orientation of the menu. Defaults to "vertical".

The button that toggles the dropdown menu.

PropTypeDescription
classNamestringAdditional CSS classes for the trigger.
renderReactElement | (props) => ReactElementAllows composing the trigger with another component. Receives props to spread.
disabledbooleanWhether the trigger is disabled. Defaults to false.

The container for the menu items, positioned relative to the trigger.

PropTypeDefaultDescription
variant"default" | "light""default"Controls menu surface and highlighted styling.
classNamestringAdditional CSS classes for the content.
align"start" | "center" | "end""center"Alignment relative to the trigger.
side"top" | "right" | "bottom" | "left""bottom"Which side of the trigger to position.
sideOffsetnumber4Distance in pixels from the trigger.
alignOffsetnumber0Offset in pixels along the alignment axis.

An individual selectable item in the menu.

PropTypeDescription
classNamestringAdditional CSS classes for the item.
disabledbooleanWhether the item is disabled. Defaults to false.
variant"destructive"Visual variant for the item. Use "destructive" for delete actions.
insetbooleanWhether to add left padding for alignment with labeled items.
closeOnClickbooleanWhether to close the menu when clicked. Defaults to true.
onClickMouseEventHandlerClick handler for the item.

URL State Props

When provided with a paramName, the menu item will set URL parameters when clicked.

PropTypeDescription
paramName?stringOptional URL parameter name to set when the item is selected.
paramSetValue?stringValue written to the URL when the item is selected.
paramThrottle?numberThrottle URL updates in milliseconds.
paramDebounce?numberDebounce URL updates in milliseconds.

A menu item with a checkbox.

PropTypeDescription
classNamestringAdditional CSS classes for the checkbox item.
checkedbooleanWhether the checkbox is checked.
onCheckedChange(checked: boolean) => voidCallback fired when the checked state changes.
disabledbooleanWhether the checkbox item is disabled.

A group of radio items where only one can be selected.

PropTypeDescription
valuestringThe value of the selected radio item.
onValueChange(value: string) => voidCallback fired when the selected value changes.

An individual radio item within a radio group.

PropTypeDescription
classNamestringAdditional CSS classes for the radio item.
valuestringThe value of this radio item. Required.
disabledbooleanWhether the radio item is disabled.

A label for a section of menu items.

Important: MenuGroupLabel must be used within a MenuGroup component due to Base UI's context requirements.

PropTypeDescription
classNamestringAdditional CSS classes for the label.
insetbooleanWhether to add left padding for alignment.

A visual separator between menu items.

PropTypeDescription
classNamestringAdditional CSS classes for the separator.

Groups related menu items together.

PropTypeDescription
classNamestringAdditional CSS classes for the group.

The root component for a submenu.

PropTypeDescription
openbooleanWhether the submenu is open (controlled).
defaultOpenbooleanWhether the submenu is initially open (uncontrolled).
onOpenChange(open: boolean) => voidCallback fired when the open state changes.
disabledbooleanWhether the submenu is disabled.

The trigger button for a submenu.

PropTypeDescription
classNamestringAdditional CSS classes for the submenu trigger.
insetbooleanWhether to add left padding for alignment.
disabledbooleanWhether the submenu trigger is disabled.

The content container for a submenu.

PropTypeDefaultDescription
variant"default" | "light"inheritedControls submenu surface and highlighted state.
classNamestringAdditional CSS classes for the submenu content.
align"start" | "center" | "end"Alignment relative to the trigger.
side"top" | "right" | "bottom" | "left"Which side to position the submenu.
sideOffsetnumber4Distance in pixels from the trigger.
alignOffsetnumber0Offset in pixels along the alignment axis.

A utility component for displaying keyboard shortcuts.

PropTypeDescription
classNamestringAdditional CSS classes for the shortcut display.

On this page