I getting hex color code from database, I am trying to apply that color in div.
className={bg-[${color}]}
but the color is not applying, How can we change the color in tailwind dynamically from the color code getting from API
>Solution :
You can’t dynamically apply the color using tailwind. Because tailwind utility classes are generated at build time. But maybe you can achieve this quite easily with inline style like below.
<div style={{ backgroundColor: color }}>Content here</div>
I hope it helps.