Skip to content

CupertinoContextMenu

An iOS-style full-screen modal menu that opens on long press.

It provides a blur backdrop and a list of actions, similar to the context menus found in iOS applications.

Usage

Long Press Me
vue
<template>
  <div
    class="demo-container"
    style="height: 300px; display: flex; align-items: center; justify-content: center"
  >
    <CupertinoContextMenu :actions="actions">
      <Container
        :width="100"
        :height="100"
        color="#007AFF"
        :border-radius="BorderRadius.circular(12)"
        alignment="center"
      >
        <Text :style="TextStyle({ color: 'white', fontWeight: FontWeight.w600 })"
          >Long Press Me</Text
        >
      </Container>
    </CupertinoContextMenu>
  </div>
</template>

<script setup lang="ts">
import {
  CupertinoContextMenu,
  Container,
  Text,
  BorderRadius,
  TextStyle,
  FontWeight,
} from "fluekit";

const actions = [
  {
    child: "Action One",
    onPressed: () => alert("Action One Pressed"),
    icon: { template: "<span>★</span>" },
  },
  {
    child: "Action Two",
    onPressed: () => alert("Action Two Pressed"),
  },
  {
    child: "Delete",
    isDestructiveAction: true,
    onPressed: () => alert("Delete Pressed"),
    icon: { template: "<span>🗑️</span>" },
  },
];
</script>

API

Props

NameTypeDefaultDescription
actionsContextMenuAction[][]The list of actions to display in the menu.

ContextMenuAction

PropertyTypeDescription
childstringThe text label for the action.
isDefaultActionbooleanWhether this action is the default action (bold text).
isDestructiveActionbooleanWhether this action is destructive (red text).
onPressed() => voidCallback function when the action is selected.
iconComponentOptional icon to display next to the text.

Slots

NameDescription
defaultThe content that triggers the context menu on long press.