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 allHide Tab Bar On Scroll Down
Minimize the tab bar when downwards scrolling starts. Minimizing is supported for tab bars on only iPhone
AccessoryCircularGaugeStyle
A gauge style that displays an open ring with a marker that appears at a point along the ring to indicate the gauge’s current value
PalettePickerStyle
A picker style that presents the options as a row of compact elements. When used outside of menus, this style is rendered as a segmented picker. If that is the intended usage, consider segmented instead.
SliderTickContentForEach
A type of slider content that creates content by iterating over a collection.