Select to view content in your preferred language

How hide/show a widgets by code in tsx file?

360
1
12-26-2023 12:10 PM
HansFelix
New Contributor II

I am developing a closable widget in experience builder:

HansFelix_0-1703620579367.png

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:

HansFelix_1-1703620897462.png

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?

 
1 Reply
JeffreyThompson2
MVP Regular Contributor

The best solution here would be to place your widget in a Widget Controller (or a Sidebar). You could configure the Widget Controller to launch your widget on load and to load at a fixed location. And the Widget Controller would also handle the logic to dismiss the widget.

GIS Developer
City of Arlington, Texas