Any workaround for addVariant? #191
Replies: 2 comments
-
The workaround I found for now was to use var variantConfig = {
...
sibling: '~ *',
...
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
That sibling variant sounds useful, I'll add it in the next release. If you don't mind dipping into css you could style the element using the css prop like this: const whenChecked = styles => css({ "input:checked ~ &": styles })
<label htmlFor="aChoice">
<input tw="form-radio hidden cursor-pointer"
type="radio"
id="aChoice"
...
/>
<div css={[tw`cursor-pointer rounded p-2 flex flex-col bg-white border-2`, whenChecked(tw`border-primary`)]}>
...stuff here...
</div>
</label> |
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
-
I was wanting to use
addVariant
which I'm aware that twin.macro doesn't support.What I want is to access the sibling of an input radio type which is set to
display:none
to apply a border to the child when checked.Beta Was this translation helpful? Give feedback.
All reactions