Skip to content

using with emotion/css #600

Discussion options

You must be logged in to vote

I haven't used this technique, but don't see why it wouldn’t work with twin - give this a try:

import tw from "twin.macro";
import { css } from '@emotion/css'

;<div
    className={css([
     tw`bg-black`
    ])}
  >
    This has a black background.
  </div>

You can also get twin to provide the css import with a config like this:

"twin": {
      "preset": "emotion",
      "css": {
        "import": "css",
        "from": "@emotion/css"
      }
    }

then:

import tw, { css } from "twin.macro";

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mh-alahdadian
Comment options

@ben-rogerson
Comment options

Answer selected by mh-alahdadian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants