Replies: 1 comment 4 replies
-
This could also be very helpful for something like shadow dom part selectors. <my-custom-element class="part-inner:bg-green-600"></my-custom-element> should give: .part-inner\:bg-green-600 {
background-color: var(--green-600);
} Although I guess |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Slightly related to my previous idea which received no reaction (🥲), but different use case: it would be nice if
@custom-variant
was able to reproduce some of the core composable variants likegroup
,not
, andhas
, and I think I have a good syntax idea for it inspired by@utility
.Imagine a variant similar to
has
, but that only triggers when a direct child of the element the class is on matches the variant/selector that follows. For instance, if you want an element to have a red background when it has only 1 child, you might thinkhas-only:bg-red
does it, but there's a chance of a false positive if any descendant (not just direct children) is an "only child". So what we really want is something likehas-child-only:bg-red
, wherehas-child
is a custom variant defined like this:The idea is that the
*
part makes it composable and whatever variant is used there is inserted in the@variant
slot.Hopefully this idea gets a bit more traction than the last. 😄
Beta Was this translation helpful? Give feedback.
All reactions