Skip to content

Conversation

@msaktype
Copy link
Owner

What

export wcn(), like cn() function of shadcn/ui

Why

In short: WindCtrl merges what it generates; wcn() merges what the app/user adds on top.

WindCtrl runs twMerge(clsx(...)) inside windctrl() to resolve conflicts within the styles produced by the config (base / variants / traits / dynamic / scopes).
However, in real apps you almost always need a second merge step at the component boundary:

  • Components usually expose a className prop so callers can extend/override styles per usage.
  • A naïve concat like ${generated} ${className} can reintroduce conflicts (e.g. p-2 vs p-4), because the external className isn’t merged.

wcn() is a tiny convenience helper (twMerge(clsx(inputs))) for that boundary merge:

  • keeps the “last one wins” behavior consistent with WindCtrl’s internal merging
  • avoids asking users to copy/paste their own cn() utility (common in shadcn/cva projects)
  • makes examples and migration paths clearer (className={wcn(result.className, className)})

@msaktype msaktype merged commit 8b0ecc8 into dev Dec 24, 2025
@msaktype msaktype deleted the wcn branch December 24, 2025 05:17
@msaktype msaktype mentioned this pull request Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants