How to open custom context menu on button click?

I’m working on a custom inspector and I’d like to create a button that opens a custom context menu when clicked.

There is a 3-dot button with the exact behavior I’m looking for in the default inspector at the top right. I basically want it to function and look exactly the same, except I’d like the menu to be populated with custom functions.

Here’s a mock-up screenshot of what I’d like to accomplish:

Anyone know how I can accomplish this? Thank you (:

Ahh I found the solution:

1 Like

Since you posted this in the UI Toolkit forum, I wanted to warn you that the solution you found is not UI Toolkit and if what you’re doing is using UI Toolkit, you may want to check these instead: