SwiftUI.js
Components

ContextMenu

ContextMenu presents a menu of actions from a context interaction. On the web this maps to the native right-click gesture while preserving SwiftUI's contextual action model.

ContextMenu presents a menu of actions from a context interaction. On the web this maps to the native right-click gesture while preserving SwiftUI's contextual action model.

Examples

Default

Preview unavailable for this example in the static docs build.

Show code
<ContextMenu
      items={[
        { label: 'Rename' },
        { label: 'Duplicate' },
        { label: 'Delete', style: 'destructive' },
      ]}
    >
      <Card>
        <Text>Right click this card</Text>
      </Card>
    </ContextMenu>

API

PropTypeRequiredDescription
itemsIContextMenuItem[]YesMenu items.
childrenReactElementYesTrigger content that receives the context-menu interaction.

Inherits additional props from IBaseComponent.

Overview

ContextMenu presents a menu of actions from a context interaction. On the web this maps to the native right-click gesture while preserving SwiftUI's contextual action model.

Notes

  • Right click the wrapped content to open the menu.
  • The first enabled action receives focus when the menu opens.
  • Use / and Home/End to move between actions.
  • Items dismiss the menu after selection.
  • The menu closes on outside click or Escape, then restores focus to the trigger.

On this page