
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
react-tw is a toolkit for working with react and, but not limited to, tailwind.
0.4kb)We all can acknowledge what a mess your react components quickly turns into when starting to add all these tailwind classes to your divs 🥲
import { createStyles } from 'react-tw'
interface StyleParams {
highlighted: boolean
}
interface Props {
className?: string
}
const useStyles = createStyles(({ highlighted }: StyleParams) => ({
card: [
`bg-white rounded-md shadow-lg`,
[`px-4`, `py-3`], // grouping (works the same as above)
['border', 'border-solid'],
[highlighted, `border-green-500`, `border-black`] // [condition, value if true, (optional) if false]
]
}))
function Card({ highlighted, className }: Props & StyleParams){
const { classes } = useStyles({ highlighted });
return <div className={cx(classes.card, className)}>{/* rest of your component */}</div>
}
Classes can be defined in many ways, see examples below:
createStyles(({ variant, primary = true }) => {
card: [
[
variant === "outlined",
[primary, "border-green-500"],
"bg-green-500"
]
]
})
createStyles(({ variant, primary = true }) => {
card: {
"bg-green-500": primary && variant !== "outlined",
"border-green-500": variant === "outlined",
}
});
createStyles(({ variant, primary = true }) => {
card: `bg-green-500 rounded shadow-sm`,
cardHeader: [
"text-black text-xl",
"font-mono"
]
});
Feel free to contribute by reporting bugs, refine docs, fix bugs or add features.
FAQs
`react-tw` is a toolkit for working with react and, but not limited to, tailwind.
We found that react-tw 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.