FAQ
Whether tailess replaces clsx and tailwind-merge, ss or cn, optional nesting, working without the plugin, Tailwind v3, @theme and runtime cost.
Helpers
- Does this replace
clsxandtailwind-merge? - No — it uses both ideas. cn is the same
twMerge(clsx(...))pairing your codebase probably already has, so tailess drops into one — though onlytailwind-mergeis a real dependency. ssorcn?ssdoes everythingcndoes, so either works. The habit worth having iscnwhile aclassNameis only plain strings, andssthe moment a breakpoint or a state shows up — at which point everything, conditions included, moves inside the one call.- Do I have to migrate to nested groups?
- No. Nesting is there for compound variants like
dark:hover:and for grouping a breakpoint's own states; a flat object stays perfectly idiomatic. The ss page has the rules for both shapes.
// the same thing — nesting is optionalss({ md: "p-6" });ss({ md: { base: "p-6" } });The plugin and runtime cost
- Does it work without the plugin?
- The unprefixed
baseclasses andmatch()do, because those are literals Tailwind finds by itself. Anything with a variant prefix needs the plugin — see how it works. - Is there a runtime cost in production?
- Only the string building. The integration check and every warning are dev-only and drop out of a production bundle. Performance and size has the measured per-call numbers.
Tailwind support
- Tailwind v3?
- No. The
@source inline(...)directive in v4 is what makes the bridge possible. - Does it work with a custom
@theme? - Yes. Candidates go through Tailwind's own pipeline, so your theme values resolve exactly as they do for classes written by hand.