Skip to content

Add Interpolation classes that come from props #425

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

You must be logged in to vote

Hey there

In babel, twin is unable to grab the value of the tailwind classes passed in.
Unfortunately, this means you'll need to construct a color map to get the css values:

const possibleTagColors = {
  'bg-indigo-100': tw`bg-indigo-100`
}

possibleTagColors[tags.bgcolor] || 'black'

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@ben-rogerson
Comment options

@vinamelody
Comment options

@ben-rogerson
Comment options

@vinamelody
Comment options

@ben-rogerson
Comment options

Answer selected by vinamelody
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants