Live data from Hacker News

Shoelace: A library of web components

shoelace.style

61–70 of 114 posts

Re: Shoelace: A library of web components

#61

this seems like a great library, but it is missing a date picker. it’s hard to find UI libraries willing to take on the date picker, i guess because native pickers, esp on mobile, get the job done?

Browser native date pickers are usually good enough and meet accessibility requirements these days.

Unless you have fussy designers or PMs who insist on artisanal NIH components for everything just because.

Re: Shoelace: A library of web components

#63
post #47

I'm looking for a library of web components that: 1) Uses slots for composition 2) Does not use CSS-in-JS 3) Lightweight I understand that slots imply shadow Dom, and then shadow Dom usually means adding/adopting stylesheets into components, and that means css in js. But there's also ::part that allows piercing the shadow dom. Is there any library that uses it?

The CSS doesn't need to be in the JS. You can trivially just fetch the static CSS file in JS then have the content adopted.

Re: Shoelace: A library of web components

#64
post #52

Earlier quoted context omitted.

For what it’s worth all the components expose CSS parts that let you customize each component in detail.

I don't see that these components use part/exportparts feature to do that. Am I looking at it the wrong way? Or do you mean that customization happens via CSS?

Yeah, sorry, it's using CSS parts for customization. So if a component is made up of multiple nested containers, you can target the inner containers with ::part(name).

Re: Shoelace: A library of web components

#65
post #46

Earlier quoted context omitted.

Can you please elaborate on what this means ?

Add the script tag to your page for any of the components and you can use them. No building, compiling or initializing anything.

exactly, and pair that with css variables for customizations if needed for ad-hoc projects/prototypes or full products

Re: Shoelace: A library of web components

#66
post #51

We at Microsft used this to build apps.microsoft.com. We're quite happy with the results. Shoelace is customizable, accessible, extensible, easy to use.

This is nice and all, but when I see what the big companies do, I always have this cave-at in my head - "is this one of the teams with enough resources to boil the ocean?"

I.e. it's proof that Shoelace, in this case, is not inherently useless. But it's hard to get a hunch for how good it is to a mere non-corporate.

Gotta give props though, the apps site is fast and slick.

Re: Shoelace: A library of web components

#67
post #16

I'm not happy with any of the solutions to prevent a flash of undefined components. Has anyone given up on web components for that reason? Or is there a best practice for this?

I usually hide the web components until they are defined using `:not(:defined)` CSS selector

Re: Shoelace: A library of web components

#68

this looks great. I'm puzzled by something though: why does it duplicate components that already exist in standard HTML5 (Button, Checkbox, Dropdown etc.)? The whole idea of web components is being able to augment what's already built in, not have to replace it. Maybe it's for consistency (styling/behaviour). Either way, it looks really well done.

One can extend native elements, but the support ain’t there on Safari

Just this tiny polyfill, and you should be OK on Safari. https://github.com/ungap/custom-elements

Re: Shoelace: A library of web components

#69

Earlier quoted context omitted.

Sounds like you might like the idea coined as "HTML Web Components": https://blog.jim-nielsen.com/2023/html-web-components/ You basically write all the normal HTML and CSS so it's loaded in right away. But then you also make use of the advantages that defining a custom element gives you.

How do we write this? I googled some tutorial and it seems it is still JS under the hood

It's basically just web components without the ShadowDOM implementation. I do it in some projects, but it comes with other drawbacks too.

Re: Shoelace: A library of web components

#70
https://RTCode.io is built on Shoelace 2 today.

Just hover over that middle divider between the input>|Also our menus do not follow their keyboard navigation logic at all and adds support for disabled, hidden, inert elements, as well as selection by typing the first letter of menu items.

All of these are possible because the author knows what NOT to do with HTML custom elements.

Post reply on HN