Variant for disabled-within #10590
Abyrd9
started this conversation in
Show and tell
Replies: 2 comments 2 replies
-
This applied to all my inputs, not just disabled ones. I think you want this CSS selector instead: :has(input:is(:disabled),button:is(:disabled)) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hey @Abyrd9 While this works, I would recommend to use the simpler declarative plugin(function ({ addVariant }) {
addVariant('disabled-within', `&:has(input,button:is(:disabled))`)
}) Applying the fix from @jhillacre that would look like: plugin(function ({ addVariant }) {
addVariant('disabled-within', `&:has(input:is(:disabled),button:is(:disabled))`)
}) |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
I typically add the styles for my input elements on whatever container it is within, that way I can include inline icons and things like that. But that also means that the styles for the input's state needs to sit on the container as well. This works great for
focus-within:
but obviously there's other "states within" that I also need access to.One of them is
:disabled
, so I put together this plugin for:disabled-within
that uses the:has()
and:is()
selectors.It works pretty well, Not sure why I haven't seen this solution anywhere. Maybe I'm missing something or I didn't look hard enough 🤷🏻♂️
Beta Was this translation helpful? Give feedback.
All reactions