Post

This post brought to you by a blog comment saying Pinia and Valtio aren't "proper state management" but "Zustand, Jotai, or even just careful use of useContext" are proper. 👀

Lit is a terrific framework. More people need to know about Custom Elements to really appreciate it. My favorite too.

Its not Lit that make Custom Elements terrific. native Custom Elements are terrific by themselves, Lit is just sugar that saves you work, like jQuery once was for front-end development. But I am biased, only done native Web Components for the past 10 years.

With you there. I just really think Custom Elements have gotten buried for so many developers and really thought having a framework like Lit would put a big spotlight on just how cool CEs are. Most devs I know or work with, know little-to-nothing about them.

Why do Web Components/Custom Elements need a spotlight? Its standard technology What does it matter if 1000 devs use that technology or 1 million devs? Ask a question on BlueSky/StackOverflow and you get a decent correct answer, and you can do your job There is no value in getting 1000 answers

Does lit use shadow Dom, and is it easy to set the internals of elements like form submit buttons. Someone mentioned it to me the other week but not looked. I really like using Astro for initial html (could be any html), and using web components to add the interactivity parts at the moment.

If you're looking for a reference, this is how we do it in Web Awesome to get *as close as possible* we copy all attributes, inject the button at the same level as the `<wa-button>` in the light dom, and then send a `.click()` to it. the only thing that will really mismatch is checking the tag.

I don't think it was a component that was a button, but hosted the button in shadow root, but didn't submit the light dom form outside of it. But that is really interesting.

Right. Thats what the above solves. <form> <my-button> <template shadowrootmode="open"> <button><slot></slot></button> </template> Try to Submit! </form> It won't submit with that <form> when you click the button in the shadow root, since its not associated to that <form>.

It uses shadow DOM by default, easy to opt out of if you want to. Unsure about your button question.