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"

Readme

Keywords

none

Package Sidebar

Install

npm i tailwindx

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

14.6 kB

Total Files

13

Last publish

Collaborators

  • pieterbergwerff