'ReactJS: Tailwind override global CSS inline

I have this rails reactjs app that if I put this line in the form

<input type='submit'/>

It will create for me a blue button. I have just installed Tailwind and if I input this line with tailwind class, it does not have any effect on the button design.

<input type='submit'
              className='bg-red-500  text-white font-bold py-2 px-4 rounded-full'/>

Is there a way that I can override this global settings like putting !important inline in the className?

Any help would be greatly appreciated.



Solution 1:[1]

You can add a ! character before the class name and that should do the job

Example:

<input type='submit'
             className='!bg-red-500  text-white font-bold py-2 px-4 rounded-full'/>

Docs: https://v2.tailwindcss.com/docs/just-in-time-mode#built-in-important-modifier

Solution 2:[2]

Yes, You can config tailwind.config.js if you add this

module.exports = {
  important: true,
}

this will generate all tailwind classes as !important

read more here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tarun Kolla
Solution 2 Dhaifallah