News for hackers. Stuff that matters.
Re:Facebook just updated its relationship status with Web Co... by fidotron on Tuesday May 07, 2024 @05:08PM (#40291496)
Isn’t the problem that this is recursive? i.e. if you use a component which itself contains a component that contains a button and that button should be styled should the intermediate components be worrying about it? And does the end consuming application need to care when new widgets are added to components nested two deep?

It is almost like the need for styling necessitates all the old dependency injection and factory gunk that older frameworks became notorious for.

Re:Facebook just updated its relationship status with Web Co... by dylanjha on Tuesday May 07, 2024 @05:28PM (#40291709)
Styling components nested inside other components can still work with either slots or scoping CSS custom properties with parent selectors.

.login-form { --button-outline-width: 2px; }

.credit-card-form { --button-outline-width: 2px; }

Of course, the component needs to be authored & documented in a way that supports this.

For example, shoelace has a "Drawer" component: https://shoelace.style/components/drawer

By default the drawer component has an "X" button in the header to close it. If you want to override that, instead of trying to style the nested "X" button you can pass in your own header actions with slot="header-actions"