Support specific variant for checking for the existence of peer #11103
joshdavenport
started this conversation in
Ideas
Replies: 2 comments
-
Wow thank you so much for this I really would love to have a peer-exists as his way more clear what it really does 🥇 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Totally forgot I even posted this in April last year and went through the same process of trying to work out the best way to use peer to just check for existence for the peer, only to stumble on my own post 😆 |
Beta Was this translation helpful? Give feedback.
0 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.
-
Something like
peer-exists
which can apply styles when the element givenpeer
exists in the DOM as the previous sibling, i.e. the styles don't apply if it doesn't. Right now you can do this by passing an empty arbitrary selector, .e.gpeer-[]:text-red-600
(https://play.tailwindcss.com/3ksDfRPQL5) but it looks a bit weird and definitely doesn't intuitively communicate what is happening unless you have a good understanding of both the peer feature and the arbitrary selector feature.peer-[]:text-red-600
generates this, and this does work for checking for the existence of peer:peer-exists
would simply generate:I think this would be particularly useful for styling something that renders conditionally as a peer. This kind of conditional rending of DOM elements happens a lot in React at least.
Beta Was this translation helpful? Give feedback.
All reactions