overlays/DSContextMenu

DSContextMenu

overlays
since v2.0

Long-press context menu with icon-labelled actions. Wraps the native contextMenu with DS token styling.

iOS 17+macOS 14+

Purpose

Inline secondary actions on list rows, cards, and media items.

Props

PropTypeDefaultDescription
actionsreq[DSMenuAction]Menu items with label, icon, role, and action.
contentreqViewBuilderThe view that receives the long-press gesture.

Examples

Message bubble

Actions on a chat message bubble.

swift
DSContextMenu(actions: [
    DSMenuAction(label: "Reply",  icon: "arrowshape.turn.up.left", action: { reply(message) }),
    DSMenuAction(label: "Copy",   icon: "doc.on.doc",              action: { copy(message.text) }),
    DSMenuAction(label: "Delete", icon: "trash",        role: .destructive, action: { delete(message) }),
]) {
    MessageBubble(message: message)
}

Related Components