How to close a menu outside it #54810
-
Using the template as an example, everytime click the button would open/close the menu I want to ask how to close the menu when click otherwhere of the page, a general solution is to add a global event listener document.addEventListener('click', collapseTheMenu) But in blazor this global event listener doesn't know the inner state of the menu component, so what's the recommended way to solve it in blazor? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
To share state across components you have some options:
|
Beta Was this translation helpful? Give feedback.
-
There is no direct solution in Blazor. You have only two options:
|
Beta Was this translation helpful? Give feedback.
There is no direct solution in Blazor. You have only two options: