Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing tw-elements-react.min.css overwrites theme.extend.colors #161

Open
leebenson opened this issue Feb 18, 2024 · 1 comment
Open

Comments

@leebenson
Copy link

Describe the bug

After following the setup instructions for a NextJS project, including this line:

import "tw-elements-react/dist/css/tw-elements-react.min.css";

... seems to overwrite custom color classes in tailwind.config.css set in the theme.extend.colors section.

To Reproduce

Using this tailwind.config.ts:

import type { Config } from "tailwindcss";

const config: Config = {
  content: [
    "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
    "./node_modules/tw-elements-react/dist/js/**/*.js",
  ],
  theme: {
    extend: {
      colors: {
        honeydew: "#f1faee",
      }
    },
  },
  corePlugins: {
    preflight: false,
  },
  plugins: [require("tw-elements-react/dist/plugin.cjs")],
};

export default config;

... And then use the color in any component:

<div className="bg-honeydew">This should be Honeydew but it isn't!</div>

Expected behavior

The resulting CSS should contain the extended theme colour class names.

Actual behavior

The class names don't exist in the resulting CSS and therefore styles aren't applied.

@iprzybysz
Copy link
Contributor

Hi @leebenson, just don't import our CSS file, because you have custom Tailwind config for your project. However, if these styles are needed for you, place them before your custom Tailwind styles will be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants