TW-Classed is a lightweight performance Tailwind CSS utility library for React. It's aimed at taking full advantage of Tailwind CSS's powerful utility classes, and provide excellent DX at the same time. The re-usability & DX of CSS in JS combined with the power of Tailwind's static extraction.
TW-Classed was designed to be reusable. Create classed components, extend them, or even extend custom react components with className. No more wrapping "reusable" components in a forwardRef or writing complicated logic to handle props & dynamic class names, TW-Classed handles this out of the box.
TW-Classed uses a Stitches.js (opens in a new tab) inspired variants API, so you can design composable component APIs with ease.
You can define a single variant, multiple variants and default variants.
One of the main goals of TW-Classed is to provide a developer experience that is as close to the excellent Stitches.js (opens in a new tab) library as possible. TW-Classed provides a fully typed API, so when using TypeScript, variants and jsx element props will be inferred and auto-completed for you.
Also when using the
as prop, the suggestions will update.
Special thanks to WorkOS (opens in a new tab) for their hard work on Stitches.js (opens in a new tab) which inspired the API of this library.