# Button opens a menu like contextMenu (in SwiftUI)

**URL:** <https://forums.kodeco.com/t/button-opens-a-menu-like-contextmenu-in-swiftui/108214>\
**Category:** Swift\
**Created:** [May 6, 2020, 9:01pm UTC](https://forums.kodeco.com/t/button-opens-a-menu-like-contextmenu-in-swiftui/108214 "2020-05-06T21:01:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rico](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rico/32/81494_2.png) [@rico](https://forums.kodeco.com/u/rico)\
**Post date:** [May 6, 2020, 9:01pm UTC](https://forums.kodeco.com/t/button-opens-a-menu-like-contextmenu-in-swiftui/108214/1 "2020-05-06T21:01:14Z")

</div>

Hallo,

im searching a good way to open a menu with serval entries after tapping a button. I tried .popover, .sheet and many more. But all i get is a sheets, I don’t want the whole screen.  
.contextMenu gives me what i want, but i need it at tap on a button, not a longPress. I need just 4 or 5 menu entries to appear after the tap.  
Has anyone an idea how to get this? I want to use SwiftUI, if possible.

Thank you and Ciao

Enrico

---

<div class="post-metadata">

**Author:** ![gdelarosa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gdelarosa/32/109063_2.png) [@gdelarosa](https://forums.kodeco.com/u/gdelarosa)\
**Post date:** [May 7, 2020, 4:52pm UTC](https://forums.kodeco.com/t/button-opens-a-menu-like-contextmenu-in-swiftui/108214/2 "2020-05-07T16:52:16Z")

</div>

Hi @rico, I am not sure if there is a work around for using .contextMenu with a single tap. In Apple’s documentation for [UIContextMenuInteraction](https://developer.apple.com/documentation/uikit/uicontextmenuinteraction) they state that

> a context menu interaction object tracks Force Touch gestures on devices that support 3D Touch, and long-press gestures on devices that don’t support it.

---

<div class="post-metadata">

**Author:** ![rico](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rico/32/81494_2.png) [@rico](https://forums.kodeco.com/u/rico)\
**Post date:** [May 19, 2020, 9:09am UTC](https://forums.kodeco.com/t/button-opens-a-menu-like-contextmenu-in-swiftui/108214/3 "2020-05-19T09:09:39Z")

</div>

Hi, thank you for your answer. Yes, you are right. I realised it as contextMenu and add for the user a small text as hint how to handle it.

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [October 20, 2020, 1:01pm UTC](https://forums.kodeco.com/t/button-opens-a-menu-like-contextmenu-in-swiftui/108214/5 "2020-10-20T13:01:17Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
