Input fragments
RequiredOrdered strings or falsy conditional values.
Utilities & motion
The class-composition utility that filters conditional fragments and resolves conflicting Tailwind utilities.
cnConfigure the production component, inspect it at responsive widths, copy synchronized JSX, and share the exact state from one workspace.
rounded-md px-4 py-3 bg-surface2 text-textThis JSX stays synchronized with the controls and uses only public package APIs.
import { cn } from '@ai-created/ui';
export function Example() {
const base = "rounded-md px-4 py-3";
const conditional = "bg-surface2 text-text";
const enabled = true;
return (
<div className={cn(base, enabled && conditional)}>
Merged class output
</div>
);
}
import { cn } from '@ai-created/ui';Replace the version placeholder with the release tag your product has reviewed.
npm install --install-links "git+https://github.com/TheMarco/ai-created-ui.git#vX.Y.Z"@import '@ai-created/ui/styles/tokens.css';
@tailwind base;
@tailwind components;
@tailwind utilities;module.exports = {
presets: [require('@ai-created/ui/tailwind-preset')],
content: [
'./src/**/*.{js,ts,jsx,tsx,mdx}',
'./node_modules/@ai-created/ui/src/**/*.{js,ts,jsx,tsx}',
],
};Named regions define what belongs to the component, what remains optional, and where semantic responsibility lives.
Ordered strings or falsy conditional values.
Removes false, null, and undefined inputs.
Resolves utility conflicts by precedence.
Serializable final className.
The Figma-equivalent asset model, auto-layout, resizing, properties, slots, content bounds, localization, and governance contract.
Asset kind
utility
Design library name
Code-only asset
Maturity
stable
Last reviewed
2026-08-29
Canvas applicability
This class-merging function has no Figma or canvas representation.
| Property | Type | Default | Code mapping | Options or notes |
|---|---|---|---|---|
| Class inputsRequired | slot | None | Function arguments in precedence order | No additional constraint |
| Include conditional input | boolean | true | Boolean expression passed as an input | No additional constraint |
Resolves conflicting Tailwind utility classes.
Internal twMerge dependencyOverflow: Split complex style decisions into named variant functions.
The utility is for class composition, not component architecture.
Not applicable; emitted classes inherit Tailwind responsive behavior.
Not applicable to utility
Accountable owner
Design systems engineering foundations owner
Canonical source: src/lib/utils.ts
These measurements and semantic tokens define the supported visual contract. Local overrides should preserve the same hierarchy and interaction cues.
Output
One whitespace-delimited class string
Consumer-defined semantic tokenscn preserves token-backed Tailwind utilities while resolving conflicts.
A component is not complete until its passive, interactive, disabled, and exceptional states remain understandable in both themes.
Semantics, accessible naming, keyboard behavior, focus and announcements are implementation requirements, not optional documentation.
No component-specific keyboard behavior. Native document behavior remains unchanged.
Use the public package API and preserve the controlled-state, native-attribute, and ref contracts described below.
import { cn } from '@ai-created/ui';Server Component compatible
const classes = cn("rounded-md border", active && "border-accent", className);These props and helpers are compatibility contracts. Changes require migration guidance and release notes.
| Prop | Type | Default | Contract |
|---|---|---|---|
| ...inputs | Array<string | false | null | undefined> | required | Class fragments in precedence order. |
These rules keep the component recognizable across products without preventing deliberate composition.
The component should be verified as rendered UI, an interaction model, an accessibility surface, and a theme-aware visual artifact.