I am building UI-kit with react tailwind.
I know that tailwind can’t find classes that made with template strings. I want to achieve this:
I have a few components in my ui kit and I want them to have same logic (for i.e. button):
Button has variant size:{
sm: “p-1”,
md: “p-2”
}
I want to automatically generate:
{
sm: “md:p-1”,
md: “md:p-2”
}
And etc for all screen sizes.
Finally want to do smth like this:
<Button size="sm" md={size:"md"} />
I think I can’t do this in function because tailwind couldn’t see this classes in runtime.
Maybe there is a library or a way to do this in build time. I’m kinda lost cause I already tried a lot of things. Will be glad to see your answer
Tried twind, but can’t really use it cause of deps conflicts
Андрей Нагорный is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.