TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Members for Tailwind CSS

minified size license version twitter

Members for Tailwind CSS offers an inverse functionality to the built-in groups feature of Tailwind CSS, providing a more declarative way to customize a parent element based on the state of its descendants, helping you to simplify complex scenarios and build user interfaces more intuitively.

Currently, the common solution for this is to use the has-[...] variant with an arbitrary value, targeting a descendant selector explicitly. Arbitrary values in Tailwind CSS are powerful, but in many cases, it's better to reserve them as a last resort or escape hatch when a native-like solution is available.

Members for Tailwind CSS fills this gap by providing a declarative API which handles that :has(...) check under the hood.


You can install the plugin via npm:

npm install tailwindcss-members

Include it in your tailwind.config.js:

module.exports = {
  plugins: [


The plugin introduces the member variant, which can be used to apply styles based on a descendant's state.

Here's an example comparing the traditional approach with the new members approach:

Example: Without Members

<div class="bg-red-400 has-[>form:valid]:bg-green-400">
    <input type="checkbox" required /> ← Check this checkbox

Open this example in Tailwind Play: https://play.tailwindcss.com/wVPSR6UF7W

Example: With Members

<div class="bg-red-400 member-valid:bg-green-400">
  <form class="member">
    <input type="checkbox" required /> ← Check this checkbox

Open this example in Tailwind Play: https://play.tailwindcss.com/0YMyI2NpIf

I hope you find tailwindcss-members a valuable addition to your projects. If you have any issues or suggestions, don't hesitate to open an issue or pull request.

If you liked this, you might also like my other Tailwind CSS plugins:

Package Sidebar


npm i tailwindcss-members

Weekly Downloads






Unpacked Size

38.5 kB

Total Files


Last publish


  • brandonmcconnell