I am learning tailwind in react and want to put dynamic value into css using tailwind.
I am used to MUI and there its quite simple like
<Box sx={{ width: dynamicValue }} />
How do I do such thing in tailwind ?
And if I cannot do that with tailwind why in MUI its not a problem ?
3
Answers
To use Tailwind classes in React you declare them within the
className
prop separated by a space, className in React is equivalent to class in HTML.E.g:
<Box className='flex'>Content</Box>
sx
is a prop specific to MUI elements.Clarify what you mean by
You can use
My Answer:
Tailwind CSS provides numeric and fraction values.
For example.
Also, you can use custom width size as like below.
Please refer to this link.
https://tailwindcss.com/docs/width