Web Component authors already know how powerful slots are, but what if you could do even more with them? Here's an interesting technique to use (or abuse) slots in your custom elements. I've been calling the pattern dynamic slots.
I needed to convert a
URL object to a plain object yesterday. You might have used it before. It's pretty handy for working with URLs!
Similar to how every custom element must contain a dash, I like to pretend that every custom event must also contain a dash. This removes all ambiguity between native events and custom events.
The topic of custom element event names comes up every now and then, especially from Shoelace users who get confused when events of the same name are emitted from different components.
It's been more than two years since the beta release of Shoelace 2.0, which was the first version of the project to ship Web Components. What started off as a fun side project has quickly grown to become one of the most recognized Web Component libraries in the world. As of today, Shoelace receives more than 100 million monthly CDN hits on jsDelivr, and that number continues to grow.
Gather 'round, it's story time.
Feeds available in Atom & JSON
Explore the archive for additional posts or press / to search.