Live data from Hacker News

HTML with Superpowers: An Introduction to Web Components

htmlwithsuperpowers.netlify.app

51–60 of 130 posts

Re: HTML with Superpowers: An Introduction to Web Components

#52
post #46
post #39

Earlier quoted context omitted.

Thanks to React, everyone else already has Web Components support built-in.

This is wrong on so many levels :-) As of now, React is probably the only major frontend framework that doesn't interop well with web components, requiring various hacks for doing so. Proper support is hopefully coming in version 19. What you have with React is its own, React-specific way of encapsulating parts of UI into stateful functions that helps to think about them as components. And to have web components supp…

They are already built-in, and if one doesn't like the boilerplate something like lit is enough.

What WebComponents support in SPAs bring to the table is a migration path to native support.

Re: HTML with Superpowers: An Introduction to Web Components

#53

Earlier quoted context omitted.

I’ve been working on https://webcomponents.guide/ with some fellow experts in order to improve the documentation side of things. Hoping to offer guidelines and best practices to limit the amount of searching and experimentation required. Please take a look and provide feedback if you can!

That marketing copy ugh. "New! Powerful!" It's neither "Standard JS so it works where HTML works" says a lot about your experts

Thanks for the feedback! If you have the time, I'd love for you to contribute and improve the marketing copy: https://github.com/WebComponentsGuide/webcomponents.guide

Re: HTML with Superpowers: An Introduction to Web Components

#54
post #40

Earlier quoted context omitted.

I’ve been working on https://webcomponents.guide/ with some fellow experts in order to improve the documentation side of things. Hoping to offer guidelines and best practices to limit the amount of searching and experimentation required. Please take a look and provide feedback if you can!

No amount of documentation will help if React keeps acting as if Web Components don't exist. Other than that, the website looks quite nice.

React 19 is likely to ship with Web Components support. https://github.com/facebook/react/issues/11347

Re: HTML with Superpowers: An Introduction to Web Components

#56

It obviously hasn't happened, but I hope that web components eventually make serious inroads. A UI library for React, Vue, Svelte, Solid, whatever... Imagine being able to have a component library that works with any of them (or none of them). Since I really like mithril and there's one UI library, I've been playing with Shoelace and Crayons and they're pretty nice to work with, but I remain a bit puzzled why there's…

> A UI library for React, Vue, Svelte, Solid, whatever... Imagine being able to have a component library that works with any of them (or none of them).

That seems to be a worthy goal, but I don't see that being usable in prod projects, at least not in the near future.

The closest I've seen is something like PrimeFaces, which has components for Angular, React and Vue, which is the majority of projects I've seen out there: https://www.primefaces.org (I've also used the Java JSF variety, it was... sometimes problematic)

If you need something that works the same (or as close as you can get) across multiple front end frameworks/libraries, while still having most of the components you could possibly want, I don't think there are many other options out there.

For example:

- Angular calendar: https://www.primefaces.org/primeng/calendar

- React calendar: https://www.primefaces.org/primereact/calendar/

- Vue calendar: https://www.primefaces.org/primevue/calendar

Re: HTML with Superpowers: An Introduction to Web Components

#57

It obviously hasn't happened, but I hope that web components eventually make serious inroads. A UI library for React, Vue, Svelte, Solid, whatever... Imagine being able to have a component library that works with any of them (or none of them). Since I really like mithril and there's one UI library, I've been playing with Shoelace and Crayons and they're pretty nice to work with, but I remain a bit puzzled why there's…

Kor UI is an open source UI library, if you want to check: https://kor-ui.com/introduction/welcome

Re: HTML with Superpowers: An Introduction to Web Components

#58

One of the problems with native encapsulation is that UI frameworks almost never fully satisfy the product requirements for a given application, so in some cases it’s always necessary to override either behavior or styling. If you remove that capability with a shadow DOM, you damn well better be sure that your abstraction is perfect.

That’s what CSS parts and slots are for. Your component can style its own boundaries, provide parts to allow customisation, and use slots to inject components that are styled from outside (be it another ShadowDOM or the light DOM)

Yep, though what I’m getting at is that those slots/parts better give you near-infinite flexibility. Because if you encounter a scenario where the slots don’t provide what you need, then you’re screwed.

Source: I fought with Ionic code for months over this. Really soured me on native encapsulation, but I see the benefits still. I just think it has to be approved very very very carefully.

Re: HTML with Superpowers: An Introduction to Web Components

#59
post #24

Earlier quoted context omitted.

What do you mean? There are tons of these around. Are you complaining that none of them are popular enough?

None of them are standard. It should be baked into the cake. It's been a puzzler to me since I started programming over 20 years ago. Every third-party library existed basically just to provide a usable grid because most everything else was good enough. Combo boxes and date pickers too but those were less of a pain to implement.

The eventual aim of Open-UI is to establish a set of standard UI components like this.

> The purpose of Open UI to the web platform is to allow web developers to style and extend built-in web UI controls, such as dropdowns, checkboxes, radio buttons, and date/color pickers.

> Today, component frameworks and design systems reinvent common web UI controls to give designers full control over their appearance and behavior. We hope to make it unnecessary to reinvent built-in UI controls

https://open-ui.org/

Re: HTML with Superpowers: An Introduction to Web Components

#60

Earlier quoted context omitted.

VueJS actually fails some advanced tests for WebComponents: https://custom-elements-everywhere.com/ So, VueJS docs are actually incorrect when they say it scores 100%. The actual score is 91%. I had reported this 8 months ago.

For people too lazy to look into what the issues are: lack of support for CAPScase, camelCase, and PascalCase DOM events. Only lowercase and kebab-case work.

Why is this getting downvoted? Did I miss something? I only found those 6 errors (each occurs in two tests, so 3 types)
Post reply on HN