Posts:
-
Some Web Component 'Render Prop' Patterns2024-11-14Eventually while creating web components you're going to want to use something like render props, where you can let the consumer of your components decide how things look and feel. In web components it requires a bit of a shift in mindset from what we're used to with frameworks. In this post I'm going to share a few strategies to invert control with rendering.
-
The Differentiating Property of Web Components2024-11-09There's been a lot of discussion on whether web components are good or not. But there is one property of web components that might make them the best or the worst solution for your needs.
-
Web components + anchor positioning + popover API = I love the platform2024-10-12Man I love the platform. It's gotten really great recently with custom elements, new CSS like anchoring, and new element apis like the popover api. Let's look at making a popover element in this post.
-
Web Components and You (part 10): Provider patterns2024-08-31Web components are by default pretty isolated. There are some nice patterns to start sharing state and actions among web components. This article explores the 'provider' pattern
-
Web Components and You (part 9): Handling empty slots2024-08-12Sometimes you want to check the contents of slots in the shadow DOM and conditionally do things based on what's in them. Can you do this with slots? Yes! It's a little strange though...
-
Web Components and You (part 8): Making a form element web component!2024-04-26We can create form elements with our new web components, but we need to do a few new things: attach internals, handle focus delegation, and register the component as a bona fide form element with a value. It's pretty simple once you get into it- let's make a special text component as an example.
-
Web Components and You (part 7): Let's talk about Shadow DOM mode2024-04-14The Shadow DOM allows us a certain level of encapsulation, and there are two options for which mode you'd like the Shadow DOM to be int: open or closed. We'll talk about the differences, the pros and cons, and ultimately whether it's worth it to close the Shadow DOM.
-
Web Components and You (part 6): Slots and how to use them2024-04-01Slots are a fantastic new feature that comes along with the Shadow DOM. You don't even need to make a custom element to use them. Let's look at how to use slots, name slots, and some of the lifecycles and features that come along with them.
-
Web Components and You (part 5): Piercing the Shadow DOM2024-03-24The Shadow DOM has scoped styles, which means that styles outside the shadow root don't affect it. But there are some exceptions! We will discuss the `:part()` psuedo-selector, css variables, declarative shadow DOM, and other ways the shadow DOM can be styled!
-
Web Components and You (part 4): Style2024-03-11Let's visit how you would do CSS styles in a web component, and how Lit includes styles.
-
Web Components and You (part 3): Simplifying with Lit2024-03-06It can be tedious to wire up reactivity in a web component ourselves. Let's see how easy it can be with Lit
-
Web Components and You (part 2): Attributes and Reactivity2024-03-01Let's take a look at web component attributes and how you can get your components to react to attribute changes!
-
Web Components and You (part 1): The Shadow Dom2024-02-23We look at why web components are a good solution now, and the very basics on how to make one.