I am looking for creating a custom component using Lightning Web Components. I want to be able to detect when the user is taking mouse outside of the element so that I can close the dialog and/or clear the text.

1 Answer 1


Depending on the base component you are using, you can use the focus/blur or mouse in/out events of the component.

You can also use global html events since LWCs support them. onmouseleave event

Not the answer you're looking for? Browse other questions tagged or ask your own question.