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.

Interactive Reference

Live showroom

Need the full visual surface?

Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().

Best for exploring:

variants, states, categories, and real app examples in one place.

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