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

1.0.2 • Public • Published

tailwindx

A little tailwind className helper.

Install

$ npm i tailwindx --save


// or

$ yarn add tailwindx

Create some classNames

import { twx } from "tailwindx";

const classNames = twx("flex", "items-center", "bg-red-500", "text-white");

console.log(classNames);
// "flex items-center bg-red-500 text-white"

Remove duplicated classNames, but leave last one

import { twx } from "tailwindx";

const classNames = twx(
  "flex",
  "items-center",
  "bg-red-500",
  "text-white",
  "bg-red-500"
);

console.log(classNames);
// "flex items-center text-white bg-red-500"

Use a object for toggling classNames

import { twx } from "tailwindx";

const classNames = twx("text-white", {
  "bg-red-500": true, // boolean
});

console.log(classNames);
// "flex items-center bg-red-500 text-white"

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    2
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i tailwindx

Weekly Downloads

4

Version

1.0.2

License

ISC

Unpacked Size

14.6 kB

Total Files

13

Last publish

Collaborators

  • pieterbergwerff