ForgeUIPREMIUM ECOSYSTEM
Docs/API Reference/API Reference

API Reference

Complete API documentation for ForgeUI utilities and hooks.

API Reference

Utility Functions

#### cn(...inputs: ClassValue[])

Merges Tailwind CSS classes with conflict resolution:

typescript
import { cn } from "@/lib/utils";

// Basic usage
cn("text-red-500", "text-blue-500"); // → "text-blue-500"

// Conditional classes
cn("px-4 py-2", isActive && "bg-purple-600", className);

// Array input
cn(["rounded-xl", "border", condition && "border-purple-500"]);

Component Registry

The component registry (src/lib/registry.ts) is the single source of truth:

typescript
interface ComponentRegistryEntry {
  name: string;        // Display name
  slug: string;        // URL-safe identifier
  category: string;    // Category grouping
  description: string; // Short description
  variants: string[];  // Available visual variants
  props: PropDoc[];    // Prop documentation
  code: string;        // Raw source code
  installCmd: string;  // CLI install command
  accessibility: string; // A11y notes
}

Theme API

Themes are defined in src/lib/themes.ts:

typescript
interface ThemePreset {
  id: string;          // Theme identifier
  name: string;        // Display name
  primary: string;     // Primary color hex
  secondary: string;   // Secondary color hex
  accent: string;      // Accent color hex
  background: string;  // Background color
  cssVariables: string; // Exportable CSS
}

Animation API

Animations are cataloged in src/lib/animations.ts:

typescript
interface AnimationItem {
  slug: string;        // Animation identifier
  name: string;        // Display name
  category: string;    // Animation category
  framerCode: string;  // Copy-paste Framer Motion code
}