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

Control Backdrop Opacity variants #888

Closed
alvaaz opened this issue Jul 3, 2021 · 1 comment · Fixed by tailwindlabs/tailwindcss#4892
Closed

Control Backdrop Opacity variants #888

alvaaz opened this issue Jul 3, 2021 · 1 comment · Fixed by tailwindlabs/tailwindcss#4892

Comments

@alvaaz
Copy link

alvaaz commented Jul 3, 2021

According to the documentation, you can control Variants with Backdrop Opacity utilities.

When I follow the example, the browser show this error:

I tried same conf in tailwind play and show this error:

this is the code I've attempted:

module.exports = {
  purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
  darkMode: false, // or 'media' or 'class'
  theme: {
    fontFamily: {
      sans: ['DM Sans', 'sans-serif'],
      serif: ['DM Serif Display', 'serif'],
    },
    extend: {
      colors: {
        primary: { DEFAULT: '#FE5245', dark: '#FE4638' },
        gray: { DEFAULT: '#1C2C2D' },
        oil: { DEFAULT: '#435448' },
        pink: { DEFAULT: '#FACFB0' },
      },
    },
  },
  variants: {
    extend: {
      cursor: ['disabled'],
      opacity: ['disabled'],
      textOpacity: ['disabled'],
      backdropOpacity: ['hover'],
    },
  },
  plugins: [],
};

If TailwindCSS doesn't support this control, we should remove this section en the doc.

@adamwathan
Copy link
Member

This is a bug in the framework, whoops! Will be fixed in the next release, probably tomorrow or Tuesday.

In the mean time, you can fix it in your project by just not using extend for backdrop opacity:

module.exports = {
  purge: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'],
  darkMode: false, // or 'media' or 'class'
  theme: {
    fontFamily: {
      sans: ['DM Sans', 'sans-serif'],
      serif: ['DM Serif Display', 'serif'],
    },
    extend: {
      colors: {
        primary: { DEFAULT: '#FE5245', dark: '#FE4638' },
        gray: { DEFAULT: '#1C2C2D' },
        oil: { DEFAULT: '#435448' },
        pink: { DEFAULT: '#FACFB0' },
      },
    },
  },
  variants: {
    backdropOpacity: ['responsive', 'hover'],
    extend: {
      cursor: ['disabled'],
      opacity: ['disabled'],
      textOpacity: ['disabled'],
    },
  },
  plugins: [],
};

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

Successfully merging a pull request may close this issue.

2 participants