<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/CommandMenu",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11CommandMenuV"
  },
  "title" : "CommandMenu"
}
-->

# CommandMenu

Command menus are stand-alone, top-level containers for controls that
perform related, app-specific commands.

```
nonisolated struct CommandMenu<Content> where Content : View
```

## Overview

Command menus are realized as menu bar menus on macOS, inserted between the
built-in View and Window menus in order of declaration. On iOS, iPadOS, and
tvOS, SwiftUI creates key commands for each of a menu’s commands that has a
keyboard shortcut.

## Topics

### Creating a command menu

[`init(_:content:)`](/documentation/SwiftUI/CommandMenu/init(_:content:))

Creates a new menu with a localized name for a collection of app-
specific commands, inserted in the standard location for app menus
(after the View menu, in order with other menus declared without an
explicit location).



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)