Live data from Hacker News

Lit: a library for building fast, lightweight web components

lit.dev

91–100 of 180 posts

Re: Lit: a library for building fast, lightweight web components

#92
post #83

Does Lit have a good component library? Like, a complete web template (eg. Bootstrap/Ant), datepicker, color picker, virtual scroll, data tables, typeahead, tab, etc. I shipped a project with Lit and I liked it, but I didn't like that I'd need to know the complete project scope up front that I could write everything from the ground up. I know I could use React component for some of the harder stuff but at that point…

DaisyUI and HyperUI, which are both full component libraries based on tailwind, play well with lit. You either opt out of using the shadow dom or import the global styles into the component. Both methods have official lit support.

Re: Lit: a library for building fast, lightweight web components

#93
Lit is amazing, one of the most concise framework out there. For deepening my understanding of concepts around Lit, I once built LittleLit, a 37 lines of code framework around Lit-html that helps understand how simple and elegant the moving pieces of this tech can be.

https://benoitessiambre.com/vanilla.html

Re: Lit: a library for building fast, lightweight web components

#94

Lit 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 :)

Nice to see you here and THANK YOU for the amazing tool that is Lit. It's everything you want from a framework without a framework getting in your way.

I'm sold and build all my work and personal apps with it and have for many years. I wrote this article about why in 2022:

Getting Started with Web Components & Lit

https://medium.com/gitconnected/getting-started-with-web-com...

Re: Lit: a library for building fast, lightweight web components

#95

Earlier quoted context omitted.

I think web components already compete extremely well for application development, and you see very complex apps built with Lit out there: Photoshop, Firefox, Chrome OS, Chrome DevTools. Apps are well served because they have more control about how components are used: they can import the same shared styles into every component, take are to not double-register elements, etc. But I think there are some important stand…

> - Open styleable shadow roots What people using web components want is to get rid of shadowDOM and not feel like they are deviating from the correct path. shadowDOM sucks, stop trying to convince the world that we are using it wrong. shadowDOM is the whole reason web components did not become mainstream (yet?).

I disagree completely. Shadow DOM is a huge help and when combined with per-component CSS using the :host() and nesting pattern, makes for very small CSS files and very short CSS class names. In other words, as far away from Tailwind as you can get.

It's also possible to import shared CSS in a base class and add it with super.styles() so you don't lose anything.

Re: Lit: a library for building fast, lightweight web components

#96

Earlier quoted context omitted.

Curious which web platform features are missing that are preventing Web components to complete with React(for application development not widgets)?

I think web components already compete extremely well for application development, and you see very complex apps built with Lit out there: Photoshop, Firefox, Chrome OS, Chrome DevTools. Apps are well served because they have more control about how components are used: they can import the same shared styles into every component, take are to not double-register elements, etc. But I think there are some important stand…

Please do not refer to CSS type imports in JS as CSS Modules.

CSS Modules has an established meaning for over a decade, one that is still relevant today. The CSS type imports are very different, and arguably worse.

Call them CSSStyleSheet imports of you need a name suggestion.

Re: Lit: a library for building fast, lightweight web components

#97
post #85
post #63

Earlier quoted context omitted.

I guess for most people the standard is to install things from NPM which explains the format of the documentation. If you want to do something completely raw, you can replace 'lit' with something like this: https://unpkg.com/lit@3.3.1/index.js?module You can even dynamically import that in the a running browser console and use it directly on any webpage.

I guess for most people the standard is to install things from NPM "things" that run in the browser? replace 'lit' with something like this: https://unpkg.com/lit@3.3.1/index.js?module Thanks, that works: https://plnkr.co/edit/2y9JEOgSZLpO4bE7

I estimate the vast majority of "web projects" begin with npm installing something of some sort, yes. React is dominating the web development space (judging from the average "popular web stack 2025" search result), and it and a significant portion of the competing platforms start with installing some dependencies with npm (or yarn, or what have you). Especially projects that compete in the same space as Lit.

That isn't a criticism of projects that don't use npm, and it doesn't make them less valid, but it makes sense for the documentation to match the average developer's experience.

Re: Lit: a library for building fast, lightweight web components

#98

Lit 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 :)

Nice to see you here and THANK YOU for the amazing tool that is Lit. It's everything you want from a framework without a framework getting in your way. I'm sold and build all my work and personal apps with it and have for many years. I wrote this article about why in 2022: Getting Started with Web Components & Lit https://medium.com/gitconnected/getting-started-with-web-com...

Thanks, great article. It’s always good to understand the context of where libraries fit into the web ecosystem and why they exist. Much appreciated!

Re: Lit: a library for building fast, lightweight web components

#99
The developers of data-star.dev are working on something interesting they call "Rocket", but it's currently a WiP and hidden behind a paywall so I can't really compare it to Lit. Lit is great though, used it myself a few times (e.g. github.com/romshark/demo-islands). But I still think there's a learning curve to Lit. Better than raw vanilla JS custom elements API, but still not as simple as it could be.

Re: Lit: a library for building fast, lightweight web components

#100
post #9

The evolution of lit is fascinating to watch because it's built and promoted by people with rather visible and public dislike of everything React. And yet, it's already turned into React-lite. - Custom HTML-like syntax - Custom Javascript rules // valid JS, invalid lit const tagName= "a"; ` Some link ` - Custom rules for special functions. // classMap looks like a regular JS function, but it's not. // Both of these w…

You have a very large axe to grind against web components and Lit, and you show up just about everywhere to make the same comments, but I'll play along anyway: Yes, Lit templates give some special meaning to attribute names with a few prefixes. No, it's not "HTML-like". It's valid HTML. Not that it matters much. You bring this up all the time but I'm not sure what the actual criticism is. Developers seem to understan…

Time to put the nail in that coffin! I use a static template to select and return components dynamically. It's a key aspect of my own internal "framework," made with Lit.

I love that I get to choose how everything works. I have custom systems for routing, styling, signals, API interactions. I control who gets passed what and when. It makes the app feel light, responsive, and -- most importantly, it fits in my head and I understand how it's put together because I chose it, not because I learned it from someone.

Post reply on HN