←back to thread

304 points ulrischa | 2 comments | | HN request time: 0.52s | source
Show context
combyn8tor ◴[] No.44689736[source]
This is great. Last time I looked into this UI component world I was surprised the popular UI libraries weren't all 'headless' at their base. Web components have been around a long time now. What was stopping this approach?

There are so many framework specific libraries like shadcn, and the community set about building half finished conversions for different frameworks like Vue, which are always several iterations behind and don't really work properly. They have their own version of the docs and it all relies on a specific version of Vue and a specific version of Tailwind and whatever else. It's an abomination.

Start with headless UI as a base and then build wrappers for specific frameworks if you really feel the need. But the wrappers should be syntax sugar only and linked directly to the base library.

I'm sure it's all more complicated than that but a man can dream.

replies(1): >>44691130 #
chrismorgan ◴[] No.44691130[source]
Put simply: if you’re using something like React, Vue, Svelte, whatever, then Web Components are strict overhead in terms of bundle size and runtime overhead. And when there’s impedance mismatch between the two worlds, which I hear is particularly common in React (can’t attest it personally, I don’t use React), you have to compromise on functionality or ergonomics, or else do fancier bindings, at which point why even bother with Web Components?

It will also commonly not play nicely with some more advanced aspects of the frameworks, like server-side rendering will probably suffer (depending on how exactly things are done).

In a world where React is dominant and you’re wanting to use React yourself, targeting Web Components just doesn’t make sense.

Then “headless” makes it worse. The more comprehensive implementations have a lot of overhead.

replies(2): >>44691794 #>>44693242 #
1. combyn8tor ◴[] No.44691794[source]
Here's my put simply:

We've got some UI components built with html, CSS and JavaScript. They use web standards.

We want to add them into web frameworks that are built in JavaScript. They are built for html, CSS and JavaScript.

No need to overcomplicate things.

And for a universal component library I'll happily accept 7kb extra overhead in my 4mb React slop website

replies(1): >>44699860 #
2. sensanaty ◴[] No.44699860[source]
But the data binding part isn't the same across frameworks. In Vue you have v-model, in React it's props and so on. The way you build a custom Select Dropdown, for example, will be very different between the two.

Sure, the actual HTML/CSS parts will be identical, but the JS portion is the issue here, because frameworks simply handle things differently there. In Vue you have reactive proxies getting passed around and a custom event system, whereas in React it's all objects and methods passed around as props.