Interactive previews iPhone
Context Menu
Adds a context menu to a view.
Platform Compatibility
iOS 13.0+ iPadOS 13.0+ macOS 10.15+ tvOS 14.0+ visionOS 1.0+
Tags
SwiftUI Code
Text("Buttons")
.contextMenu {
Button("Button 1", action: action)
Button("Button 2", systemImage: "button.vertical.left.press", action: action)
Button(action: action) {
Text("Button 3")
Text("Description 3")
}
}Found an issue or have a suggestion?
Created: May 30, 2025Updated: December 27, 2025
More Menu Components
View allExplore Other Components
Browse allItem Alert
Presents an alert using the given data to produce the alert’s content and a text view as a title.
ToolbarItem Shared Background Visibility
Controls the visibility of the glass background effect on items in the toolbar. In certain contexts, such as the navigation bar on iOS and the window toolbar on macOS, toolbar items will be given a glass background effect that is shared with other items in the same logical grouping
Future DatePicker
Creates an instance that selects multiple dates on or after some start date
SegmentedPickerStyle
A picker style that presents the options in a segmented control. Use this style when there are two to five options. Consider using menu when there are more than five options.