github heroui-inc/tailwind-variants v4.0.0

2 hours ago

✨ Features

  • compiled merge tables; default entry exports twMerge, twJoin, and clsx
  • tailwind-variants/merge: merger without tv
  • tailwind-variants/config: twMergeConfig and extendTailwindMerge / createTailwindMerge / createTwMerge / fromTheme / validators / mergeConfigs / getDefaultConfig
  • multi-extend via extend: [a, b, c] (#297)
  • empty class lists return "" (#289)
  • array compound / variant classes apply to the base slot (#263)
  • experimental debug mode
  • inject twMerge from tailwind-variants/lite (#307)
  • cacheSize and prefix on the default tables

⚡ Performance

  • hot tv() about 3.5× vs 3.3.1, over 6× with compound variants
  • cn() about 2× vs 3.3.1 on join-and-merge, over 7× on interpolated arguments, about 2× on unique arbitrary values
  • pre-merged static core; class / className cached by text
  • compound variants kept out of cache keys (#317)

🐛 Fixes

  • unlabeled font-[Inter] is family, font-[700] is weight
  • contain-*, bg-gradient-to-*, bg-conic, columns-auto, max-h-none, extra size scales
  • debug reporter stripped when NODE_ENV is production
  • compoundSlots no longer widens variant inference (#316)

🚨 Breaking Changes

  • twMergeConfig: tailwind-variants/config only; default entry throws
  • experimentalParseClassName: removed
  • cn: cn("a", 0) → "a"; cn(0) → "0"
  • empty lists: "" instead of undefined
  • types: unknown variant / slot keys error
  • peers: tailwind-merge and tailwindcss removed
  • lite: function twMerge is called (3.3.1 treated it as true)
  • twMerge: false: cx join; whitespace normalized at compile

🛠 Chores

  • pnpm compile-tables
  • isolated benchmark suites
  • pkg.pr.new
  • toolchain on Vitest 5, tsup 9, Biome 2.6, pnpm 12; audit clean (#315)

See the v3 to v4 migration guide.

Thanks @danielroe for #317 and @wingkwong for #315.

View changes on GitHub

Don't miss a new tailwind-variants release

NewReleases is sending notifications on new releases.