overlays/DSContextMenu
DSContextMenu
overlaysLong-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
| Prop | Type | Default | Description |
|---|---|---|---|
| actionsreq | [DSMenuAction] | — | Menu items with label, icon, role, and action. |
| contentreq | ViewBuilder | — | The 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)
}