Next.js Discord

Discord Forum

How to apply styles from props in component (Tailwind css)

Answered
Mandarin fish posted this in #help-forum
Open in Discord
Mandarin fishOP
and how to correctly apply the styles from the comoponent props if I apply them, they are applied but not displayed
Answered by B33fb0n3
If you every used them somewhere else in your project (statically), they should work as aspected. If not you have two ways:
1. use inline styles (not tailwind, just basic inline styling)
2. use the safelist feature from tailwind and define every class, that you want to automatically add to your generated css file
@Mandarin fish
View full answer

9 Replies

Mandarin fishOP
this problem only with colors like text-primary etc.
If you every used them somewhere else in your project (statically), they should work as aspected. If not you have two ways:
1. use inline styles (not tailwind, just basic inline styling)
2. use the safelist feature from tailwind and define every class, that you want to automatically add to your generated css file
@Mandarin fish
Answer
Northern Wheatear
@Mandarin fish I think you have encountered an issue similar to this one
https://nextjs-forum.com/post/1180906737218363464
@Mandarin fish worked?
@B33fb0n3 <@1055859935000416367> worked?
Mandarin fishOP
i gonna try it
@Mandarin fish i gonna try it
please share your feedback with me, if everything works or not
@B33fb0n3 please share your feedback with me, if everything works or not
Mandarin fishOP
yeah working
thanks