Problem `as` and `css` when used together.
s-kobets opened this issue · comments
Sergey commented
Bug report
Describe the bug
Hi, I have problem when used as
and css
together.
To Reproduce
- I created component with stitches
const StyledTag = styled('span', {
...tw`
border
border-current`,
variants: {
theme: {
warning: tw`text-[#c5770f] bg-yellow-500`,
},
},
})
function Tag(props) {
return <StyledTag {...props} />
}
- Render components
<>
<Tag
theme="warning"
css={tw`text-red-500`}
>
Tag 1
</Tag>
<Tag
as="div"
theme="warning"
>
Tag 2
</Tag>
<Tag
as="div"
theme="warning"
css={tw`text-red-500`}
>
Tag 3
</Tag>
</>
- See that
Tag 3
don't get styles for themewarning
Expected behavior
I want to see that Tag 3
will be to the same Tag 1
. Got styles for border
and background
Screenshots
System information
- OS: [macOS]
- Browser (if applies) [chrome]
- Version of Stitches: [1.2.8]
- Version of Node.js: [16.16.0]
Sergey commented
All work, I use twin.macro
, tailwind
, stitches
. For stitches work all right.
Robert Sun commented
I'm also seeing issues when using as
and css
together. It seems that if I use as
, the css
prop overwrites all of the styles instead of just the relevant style that it declares