Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stevedya/0cc8a97b9d516fe3ca8dbbc518914288 to your computer and use it in GitHub Desktop.
Save stevedya/0cc8a97b9d516fe3ca8dbbc518914288 to your computer and use it in GitHub Desktop.
tailwind-aria-hidden-variant-plugin.js
// Aria expanded attribute variant for styling when aria-expanded:className or aria-not-expanded:className
plugin(({ addVariant, e }) => {
addVariant('aria-hidden', ({ modifySelectors, separator }) => {
modifySelectors(
({ className }) =>
`.${e(`aria-hidden${separator}${className}`)}[aria-hidden='true']`,
);
});
addVariant('aria-not-hidden', ({ modifySelectors, separator }) => {
modifySelectors(
({ className }) =>
`.${e(
`aria-not-hidden${separator}${className}`,
)}[aria-hidden='false']`,
);
});
}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment