Replies: 2 comments 2 replies
-
Can you share an example of where you'd find specific support for it useful? You can always put the You can also use arbitrary variants, like |
Beta Was this translation helpful? Give feedback.
-
Sorry for delay I've done an example: https://play.tailwindcss.com/GGBwlFUjz9 There is a list of selectable items, there are dividers between items, you can click on item and it becomes selected – in playground this behavior implemented via checkboxes Selected item should have rounded border and divider between selected item and next item should be hidden – that's where I wanted to use adjacent sibling selector – check CSS tab and class In real world app (React) list item is going to be present as component, something like this:
and
You suggested two solutions: 1) using conditional 'peer' class 2) using arbitrary variants The first one is require you to make javascript calculation (in The second one breaks component isolation – now I believe there are a lots of examples where Adjacent Sibling selector would be helpful |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There is support for General Sibling Selector (div ~ div) using
peer
modifier – https://tailwindcss.com/docs/hover-focus-and-other-states#styling-based-on-sibling-stateI would like to have support for Adjacent Sibling Selector (div + div): https://developer.mozilla.org/en-US/docs/Web/CSS/Adjacent_sibling_combinator
Didn't find any issues about that...
I made playground to highlight difference between these two selectors: https://play.tailwindcss.com/JA6kgy1ie9?file=css
Beta Was this translation helpful? Give feedback.
All reactions