Skip to content

How to pass custom style to component ? #828

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

You must be logged in to vote

You have two options here.

The styles need to remain with their tw block - they can't be interpolated:

  • 👎 tw`${customTw}`
  • 👍 tw`block`

So either:

  1. Pass the styles via prop, including the tw wrapper: tw`block`
  2. Use a normal prop, eg: isBig to conditionally add the style to the array: [isBig && tw`block`]

Some docs for more info:

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@airman5573
Comment options

Answer selected by ben-rogerson
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