# Utils

The cn() helper: merges class names and resolves conflicting Tailwind utilities.

Docs: https://corsairui.vercel.app/docs/utils

## Install

```bash
pnpm dlx shadcn@latest add @corsair-ui/utils
```

npm: `clsx`, `tailwind-merge`.

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `cn(...inputs)` | `ClassValue[]` |  | Joins classes with clsx and resolves Tailwind conflicts: the last one wins. |

## Examples

On the docs page: cn. The usage examples in the source comments below are the reference.

## Source

What `shadcn add` writes into the project:

### utils.ts

```ts
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

/**
 * Joins class names and lets the last conflicting Tailwind utility win, so a
 * `className` passed by the consumer always overrides the component default.
 */
export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}
```
