I am developing a closable widget in experience builder:

I would like to know what is the right way to hide/show a widget in experience builder,
I currently hide the render inside widget.tsx file in React but the widget container (.is-widget) still displays:

This makes it impossible to move the basemap in that section where the widget is.
Currently what I do is look for this container and change CSS pointer-events property (post from I found this idea ) to none, but its hacky.
Any idea how I can hide/show a widget correctly?