actions/DSMenuButton

DSMenuButton

actions
since 1.2.0

Button that opens a dropdown menu of actions with optional icons.

iOSmacOS

Purpose

Use for overflow menus, action lists, or grouped options. Supports icon-only or labeled buttons.

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
labelString?nilButton text (optional if icon is set)
iconString?nilOptional SF Symbol name
itemsreq[DSMenuItem]โ€”Menu entries with title, icon, and action
accessibilityLabelString?nilOptional accessibility label

Examples

Overflow menu

Icon-only menu button with actions.

swift
DSMenuButton(
    icon: "ellipsis",
    items: [
        DSMenuItem(title: "Edit", icon: "pencil") { editItem() },
        DSMenuItem(title: "Share", icon: "square.and.arrow.up") { shareItem() },
        DSMenuItem(title: "Delete", icon: "trash") { deleteItem() },
    ]
)

Labeled menu

Menu button with label and icon.

swift
DSMenuButton(
    label: "Actions",
    icon: "gear",
    items: [
        DSMenuItem(title: "Settings") { openSettings() },
        DSMenuItem(title: "Help") { openHelp() },
        DSMenuItem(title: "Sign Out") { signOut() },
    ]
)

Usage Guidelines

  • Use icon-only for overflow/more actions (ellipsis icon)
  • Include icons in menu items for better scannability
  • Group related actions together
  • Place destructive actions at the bottom

Related Components