Docs
Utility helpers keep className composition predictable when variants, state, and Tailwind strings collide. Nexus-UI uses clsx plus tailwind-merge behind a single cn() export.
npm install clsx tailwind-mergeMotion is already a first-class dependency in Nexus-UI for previews; add framer-motion (or motion) when you build animated surfaces.
Place a small util next to your UI layer (this repo uses src/lib/utils.ts):
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}Use cn() anywhere you merge Tailwind classes with conditional or prop-driven fragments — buttons, cards, and layout shells.
Tailwind classes are order-sensitive in the final string. twMerge resolves conflicting utilities so later arguments win, which keeps design-system wrappers and overrides safe.