Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Multiple psuedo selectors #467

Open
jaredmeakin opened this issue Feb 24, 2020 · 1 comment
Open

Multiple psuedo selectors #467

jaredmeakin opened this issue Feb 24, 2020 · 1 comment

Comments

@jaredmeakin
Copy link

Trivial example, but how would one enable variant support for multiple pseudo selectors?

.button:hover:enabled {
   cursor: pointer;
}

.button:hover:disabled {
   cursor: not-allowed;
}

Thanks!

@cytRasch
Copy link

cytRasch commented Mar 2, 2020

You can achieve this by writting yout own little plugin:

const plugin = require('tailwindcss/plugin')

module.exports = {
    theme: {
        extend: {},
    },
    variants: {},
    plugins: [

        plugin(function({ addComponents }) {
            
            const extendedButtons = {
                '.button': {
                    '&:hover': {

                        '&:disabled': {
                            cursor: 'not-allowed'
                        },

                        '&:enabled': {
                            cursor: 'pointer'
                        }
                    }

                },
            }
            addComponents(extendedButtons)
        })
    ],
}

This will auto-create your css with this variant-concatination.

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

No branches or pull requests

2 participants