When you are using TailwindCSS in some cases you might want to add a prefix to your tailwind utility classes so that it doesn't mess up with your other library.
I often do this when I am using both bootstrap and TailwindCSS in a single project.

You can do this by adding the prefix option in your tailwind.config.js file

The prefix option allows you to add a custom prefix to all of Tailwind’s generated utility classes.

For example, you could add a tw- prefix by setting the prefix option like so:


/** @type {import('tailwindcss').Config} */
module.exports = {
  prefix: 'tw-',
  content: ['./*.{html,js}', './components/*.{html,js}'],
  theme: {
    extend: {},
  },
  plugins: [],
}

Since often you would want to copy paste code from the component library in your project. You can make use of tailwind prefix Application to help adjust the code according to the prefix set by you.

Comments