Skip to content

Tailwind CSS plugin to add some missing interaction state variants: hocus (hover & focus), group-hocus, group-focus, group-active, and visited

Notifications You must be signed in to change notification settings

hacknug/tailwindcss-interaction-variants

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interaction Variants Plugin for Tailwind CSS

Installation

npm install tailwindcss-interaction-variants

Usage

// In your Tailwind CSS config
{
  backgroundColors: {
    'black': 'black',
  },
  
  // ...

  modules: {
    backgroundColors: ['hocus', 'group-hocus', 'group-focus', 'group-active', 'visited'],
  },

  // ...

  plugins: [
    require('tailwindcss-interaction-variants')(), // nothing to configure!
  ],
}

The above configuration would generate the following classes:

.bg-black {
  background-color: black;
}

.hocus\:bg-black:hover, .hocus\:bg-black:focus {
  background-color: black;
}

.group:hover .group-hocus\:bg-black, .group:focus .group-hocus\:bg-black {
  background-color: black;
}

.group:focus .group-focus\:bg-black {
  background-color: black;
}

.group:active .group-active\:bg-black {
  background-color: black;
}

.visited\:bg-black:visited {
  background-color: black;
}

About

Tailwind CSS plugin to add some missing interaction state variants: hocus (hover & focus), group-hocus, group-focus, group-active, and visited

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%