I had lit in a project at work and not having to deal with it anymore is just great. We already have another heavier component framework to do the actual application stuff anyway, so having two just because somebody wanted to optimize their resume was such a drag. It all looked nice in theory, but one thing shadow DOM makes worse is A11y, because element ids are now scoped and all the missing describe-by, label-for f…
Lit: a library for building fast, lightweight web components
141–150 of 180 posts
Re: Lit: a library for building fast, lightweight web components
#142Typescript can even add Intellisense to "customElements.get" by augmenting CustomElementRegistry: https://gist.github.com/cecilemuller/72fbb3bc3a77d82c8a969cd...
Re: Lit: a library for building fast, lightweight web components
#143Lit maintainer here. I should be going to bed, but I'll answer any questions if people have any! Not sure why Lit showed up on the front page tonight :)
Lots of comments in here are about shadow DOM, so let me give my take in one place: Yes, Lit uses shadow DOM by default (for good reasons, I think!) and yes you can turn it off component-by-component, but that does bring some challenges. Shadow DOM is most fundamentally just a private branch of the DOM tree for a component's internal DOM details. Frameworks have this implicitly with DOM defined in a component's templ…
Re: Lit: a library for building fast, lightweight web components
#144I had lit in a project at work and not having to deal with it anymore is just great. We already have another heavier component framework to do the actual application stuff anyway, so having two just because somebody wanted to optimize their resume was such a drag. It all looked nice in theory, but one thing shadow DOM makes worse is A11y, because element ids are now scoped and all the missing describe-by, label-for f…
Integrating these web components into our React codebase has been pretty awful--more of a web components thing than a Lit thing, IMO. We have "scoped styles", except for certain important things like font sizes, so tons of little regressions everywhere when we swap in the web component in place of the old React one. DX-wise, we lost a lot, too. I assume the tooling will get better, or that we'll figure it out more, b…
Re: Lit: a library for building fast, lightweight web components
#145Re: Lit: a library for building fast, lightweight web components
#146Working with a large Vue 3 project and wanting to share some of our components as re-usable web components for other sites to embed... What would be the benefit of rebuilding these components in Lit over using Vue to build them? https://vuejs.org/guide/extras/web-components#building-custo...
Make a fat bundle with a web component or even a mount() function exported and run whatever fits your devx inside, with the API surface as narrow as possible. As long as it's self contained and the size is reasonable, nobody on a consumer side cares how you cook, so optimize your own pipelines to build, test and publish it.
People will build adapters to fit it into their stuff anyway and will let you know.
Re: Lit: a library for building fast, lightweight web components
#147Earlier quoted context omitted.
Web components are 14 years old, and still have the most basic issues and problems that even a 6-month-year-old framework would ashamed to have.
I await your in depth critique on the front page.
https://dev.to/ryansolid/web-components-are-not-the-future-4...
https://dev.to/richharris/why-i-don-t-use-web-components-2ci...
https://daverupert.com/2023/07/why-not-webcomponents/
https://paularmstrong.dev/blog/2023/03/11/why-we-do-not-writ...
https://nolanlawson.com/2024/09/28/web-components-are-okay/
https://www.zachleat.com/web/good-bad-web-components/
https://mayank.co/blog/web-components-considered-harmful/
https://adamsilver.io/blog/the-problem-with-web-components/
https://web-highlights.com/blog/are-web-components-dead/
along with some criticisms from very knowledgeable people:
https://x.com/youyuxi/status/1839833110164504691 (author of Vue) https://x.com/Rich_Harris/status/1839785839036887361 (author of Svelte)
Web Components solve a few problems and introduce a few others, use them when they make sense for your needs.
Re: Lit: a library for building fast, lightweight web components
#148Re: Lit: a library for building fast, lightweight web components
#149Lit maintainer here. I should be going to bed, but I'll answer any questions if people have any! Not sure why Lit showed up on the front page tonight :)
Lots of comments in here are about shadow DOM, so let me give my take in one place: Yes, Lit uses shadow DOM by default (for good reasons, I think!) and yes you can turn it off component-by-component, but that does bring some challenges. Shadow DOM is most fundamentally just a private branch of the DOM tree for a component's internal DOM details. Frameworks have this implicitly with DOM defined in a component's templ…
Re: Lit: a library for building fast, lightweight web components
#150Earlier quoted context omitted.
Good luck with your better framework, but if this is the biggest flaw… then there’s really not much to complain about.
Thanks! That's hardly the biggest difference to Lit. I think Lit is a fantastic framework, and I'm not trying to replace it or anything. However, it's really unopinionated which is fantastic for flexibility, but it leads to every deployment looking and feeling very different. Basically, I'm just curious what a full-stack web component framework with strong defaults could look like. This is primarily a learning exerci…