Search code examples
javascriptweb-componentshadow-dom

How do I return a value from shadow dom to light dom?


I am in the process of creating a custom confirmation box with web components. It seems like the logical thing to do, since confirmation boxes are used quite often and it would be nice to be able to insert one when it is needed.

I need to be able to return the value of the confirmation box (yes or no) to the light dom from the shadow dom (where the confirmation box resides) so I can complete processing.

Is there anyway I can do this? Thank you very much!


Solution

  • After much searching and researching on the Net, I found out that there are a lot of pre-built FOSS components widely available.

    So, why reinvent the wheel when there are quite a number of them around already? Here is a list of resources to get you started: https://open-wc.org/guides/community/component-libraries/