Skip to content

Importing tw in all components #182

Answered by ben-rogerson
eleretic asked this question in Q&A
Discussion options

You must be logged in to vote

Heya William 👋

I don't have any plans to avoid the 'twin.macro' import completely (like a vanilla babel plugin).
But you can currently use the tw (and css) prop by just importing the library like this:

import 'twin.macro'

const InputWithTwProp = () => <input tw="border hover:border-black" />

If you ever use styled-components instead of emotion, you'll also need to make sure "autoCssProp": true, is in your twin config.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@eleretic
Comment options

@ben-rogerson
Comment options

Answer selected by ben-rogerson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants