Open And Close a ui menu

is there a way that i can click on a button and it opens a menu and then click on that button again to close it?

Here’s an example

Here’s the code

Check out line 191. It toggles the menu entity “enabled” property when the menu button is clicked

        this.sceneSwitcherMenuEntity.enabled = !this.sceneSwitcherMenuEntity.enabled;

Thank you