/ts-clsx

Rewrite clsx in TypeScript

Primary LanguageTypeScriptMIT LicenseMIT

ts-clsx

npm version npm downloads bundle JSDocs License

Rewrite clsx in TypeScript, but

  • No default export
  • No lite version

Install

ni ts-clsx

Usage

import { clsx } from 'ts-clsx'

clsx('foo', [1 && 'bar', { baz: false, bat: null }, ['hello', ['world']]], 'cya')
// => 'foo bar hello world cya'

Tailwind Support

  1. VS Code + Tailwind Intellisense Extension
  2. Add the following to your settings.json
{
  "tailwindCSS.experimental.classRegex": [
    ["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
  ]
}

License

MIT License © 2024-PRESENT Mancuoj