actions/DSMenuButton
DSMenuButton
actionsButton 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.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| label | String? | nil | Button text (optional if icon is set) |
| icon | String? | nil | Optional SF Symbol name |
| itemsreq | [DSMenuItem] | โ | Menu entries with title, icon, and action |
| accessibilityLabel | String? | nil | Optional 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