
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
tailwindcss-children
Advanced tools
npm install tailwindcss-children
// tailwind.config.js
{
variants: {
display: ['children', 'default', 'first-child', 'last-child', 'children-hover', 'hover', 'children-focus', 'focus', 'children-focus-within', 'focus-within', 'children-active', 'active', 'responsive'],
},
plugins: [
require('tailwindcss-children')(),
],
}
The above configuration would generate the following CSS:
.children\:block > * {
display: block;
}
.block {
display: block;
}
.first-child\:block > :first-child {
display: block;
}
.last-child\:block > :last-child {
display: block;
}
.children\:hover\:block > :hover {
display: block;
}
.hover\:block:hover {
display: block;
}
.children\:focus\:block > :focus {
display: block;
}
.focus\:block:focus {
display: block;
}
.children\:focus-within\:block > :focus-within {
display: block;
}
.focus-within\:block:focus-within {
display: block;
}
.children\:active\:block > :active {
display: block;
}
.active\:block:active {
display: block;
}
/* etc. */
Which you can then use in your HTML like this:
<ul class="children:block children:border-b children:border-gray last-child:border-b-0 children:hover:bg-gray">
<li>
First item
</li>
<li>
Second item
</li>
<li>
Last item, this one doesn't have a bottom border
</li>
</ul>
You can also override children:
classes on specific children if needed:
<ul class="children:block children:bg-gray">
<li>
First item
</li>
<li class="bg-red">
Second item, this one has a red background
</li>
<li class="bg-blue">
Third item, this one has a blue background
</li>
<li>
Last item
</li>
</ul>
The above depends on the order of the generated CSS, so make sure to add the default
variant after the children
one in the array of variants (as well as the hover
variant after the children-hover
variant if you want to override a children-hover:
utility, etc.).
[1.1.0] - 2019-07-08
children-hover
, children-focus
, children-focus-within
, and children-active
FAQs
Tailwind CSS plugin to add variants that target child elements
The npm package tailwindcss-children receives a total of 759 weekly downloads. As such, tailwindcss-children popularity was classified as not popular.
We found that tailwindcss-children demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.