Skip to content
Mizen UI
Docs

IntroductionInstallationCLIStylingFoundationsThemingCompositionIntegrationsAccessibilityFor agents

useCopyToClipboard

AccordionAspect RatioCardCollapsibleFrameGridGroupInlineScroll AreaSectionSeparatorSpacerStack

BlockquoteCitationCodeHeadingKbdLabelLinkTextVisually Hidden

ButtonButton GroupToggleToggle groupToolbar

CalendarCheckboxCheckbox groupComboboxDate pickerDate range pickerDate-Time InputFieldFieldsetFile UploadFormInputInput groupNumber fieldOTP FieldRadio groupSelectSliderSwitchTextareaTime Input

BreadcrumbMenubarNavigation MenuPaginationSegmented ControlStepperTabs

Alert dialogCommandContext MenuDialogDrawerMenuPopoverPreview CardSheetTooltip

AlertBadgeEmptyError StateMeterProgressSkeletonSpinnerStatus dotToast

Activity FeedAvatarAvatar GroupData TableListMetricOverflow ListProperty ListTableTokenTree

Area ChartBar ListCalendar HeatmapCategory ComparisonChart FrameChart LegendChart TooltipDistributionFunnelHeatmapMetric TrendPart-to-WholeProgress RingsRadar ChartRadial BarsSankey ChartScatter ChartScore GaugeTime Series

Diagram

AttachmentCarouselCode BlockLightboxMarkdownThumbnailTimestamp

Agent ThinkingApproval CardComposerConversationInline CitationMessageMessage ScrollerQuestion CardSourcesStreaming TextSuggestionTask ListTerminalTool Call

On this page

  • Preview
  • Usage
  • Anatomy
  • Examples
  • File workspace actions
  • With link
  • Nested menu
  • With checkbox
  • With group label
  • With radio group
  • Close on click
  • Open a dialog
  • With switch
  • Scrollable content
  • Recommendations
  • Usage boundaries
  • API reference

Overlays

Context Menu

Presents contextual actions and choices anchored to pointer coordinates or long press.

idle

Usage

import {
	ContextMenu,
	ContextMenuItem,
	ContextMenuPopup,
	ContextMenuSeparator,
	ContextMenuShortcut,
	ContextMenuTrigger,
} from "@mizen-labs/ui";

Anatomy

The parts and how they nest, taken from the preview above.

<ContextMenu>
	<ContextMenuTrigger />
	<ContextMenuPopup>
		<ContextMenuItem>
			<ContextMenuShortcut />
		</ContextMenuItem>
		<ContextMenuItem />
		<ContextMenuSeparator />
		<ContextMenuItem />
		<ContextMenuSeparator />
		<ContextMenuItem />
	</ContextMenuPopup>
</ContextMenu>

Examples

File workspace actions

With link

Native anchors and router composition.

Nested menu

Two submenu levels with centered and start alignment.

With checkbox

Controlled and uncontrolled selection with a disabled option.

With group label

Group related contextual actions.

With radio group

Choose one file sort order.

Close on click

Choose whether an action dismisses the menu.

Open a dialog

Transfer focus to a dialog and return to the file target.

With switch

Checkbox behavior with decorative switch indicators.

Scrollable content

Render composition in a long, scrollable menu.

Recommendations

GuidancePractice
Do

Offer actions specific to the resource under the pointer. Match labels to the same actions elsewhere.

Usage boundaries

GuidanceBoundary
Scope

Provide a visible alternative for essential actions. Context menus must not be the only way to complete a task.

API reference

Public props from @mizen-labs/ui. Use exported prop types for the complete TypeScript contract.

PropTypeDefaultDescription
ContextMenuContextMenuProps—Native Base UI root for open state and callbacks.
ContextMenuPortalContextMenuPortalProps—Native Base UI portal.
ContextMenuTriggerContextMenuTriggerProps—Right-click, keyboard, and long-press target; supports render.
ContextMenuPopupContextMenuPopupProps—Popup with render, anchor, and portalProps; align=center and sideOffset=4.
ContextMenuGroupContextMenuGroupProps—Groups related contextual actions.
ContextMenuItemContextMenuItemProps—Action row with inset, destructive variant, disabled, and closeOnClick.
ContextMenuLinkItemContextMenuLinkItemProps—Native anchor or router render target; closeOnClick defaults to true.
ContextMenuCheckboxItemContextMenuCheckboxItemProps—Native checkbox item with controlled state and switch variant.
ContextMenuRadioGroupContextMenuRadioGroupProps—Native radio selection group.
ContextMenuRadioItemContextMenuRadioItemProps—Native radio option with a required value.
ContextMenuGroupLabelContextMenuGroupLabelProps—Muted group heading with optional inset.
ContextMenuSeparatorContextMenuSeparatorProps—Divider between groups.
ContextMenuShortcutContextMenuShortcutProps—Native kbd element for shortcut text or Mizen keycaps.
ContextMenuSubContextMenuSubProps—Native submenu root.
ContextMenuSubTriggerContextMenuSubTriggerProps—Opens a submenu; preserves highlighting and cap-aligned labels.
ContextMenuSubPopupContextMenuSubPopupProps—Submenu popup; align=start, sideOffset=0, alignOffset=-5 unless centered.
ContextMenuPrimitivetypeof ContextMenuPrimitive—Base UI Context Menu namespace.
PreviousCommandNextDialog
Launch brief.pdfRight-click or press and hold