using css and tw on react components #258
-
Hello,
I need to add more classes of tailwind once i use the InputGroup component. I tried with the css and tw props, but they did not help me to achieve my goal.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
What does the const Input = tw.input``
// or
// const Input = styled.input``
export { Input } |
Beta Was this translation helpful? Give feedback.
-
Just tested with Here's my test: import React from 'react'
import tw, { styled } from 'twin.macro'
export const Input = styled.input`
${tw`bg-green-500`};
`
const InputGroup = (props) => {
return <Input {...props} />
}
const App = () => (
<>
<InputGroup />
<InputGroup tw="bg-blue-500" />
<InputGroup css={[tw`bg-yellow-500`]} />
</>
)
export default App And the output: |
Beta Was this translation helpful? Give feedback.
Just tested with
preset="styled-components"
and all seems okay, I was wondering if you were testing with light colors which made it hard to tell if they change?Here's my test:
And the output: