1. Docs
  2. installation
  3. Manual Installation

Manual Installation

Add dependencies to your project manually.

Add Tailwind CSS

Components are styled using Tailwind CSS. You need to install Tailwind CSS in your project.

Follow the Tailwind CSS installation instructions to get started.

Add dependencies

Add the following dependencies to your project:

npm install cva@beta tailwind-merge tailwindcss-motion tailwindcss-react-aria-components@nightly -D

Configure path aliases

I use the ~ alias. This is how I configure it in tsconfig.json:

tsconfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "~/*": ["./src/*"]
    }
  }
}

The ~ alias is a preference. You can use other aliases if you want, like @ or #.

If you use a different alias such as @, you'll need to update import statements when adding components.

Configure styles

Add the following to your styles/globals.css file. You can learn more about using CSS variables for theming in the theming section.

globals.css
@import "tailwindcss";
 
@plugin "tailwindcss-react-aria-components";
@plugin "tailwindcss-motion";
 
@custom-variant dark (&:where(.dark, .dark *));
 
@theme {
  --font-sans: var(--font-family-sans), ui-sans-serif, system-ui, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-mono: var(--font-family-mono), ui-monospace, SFMono-Regular, Menlo,
    Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
 
  --color-bg: light-dark(oklch(1 0 0), oklch(0.16 0.01 262.25));
  --color-fg: light-dark(oklch(0.16 0.01 262.25), oklch(0.98 0 0));
 
  --color-card: light-dark(oklch(1 0 0), oklch(0.16 0.01 262.25));
  --color-card-fg: light-dark(oklch(0.16 0.01 262.25), oklch(0.98 0 0));
 
  --color-popover: light-dark(oklch(1 0 0), oklch(0.16 0.01 262.25));
  --color-popover-fg: light-dark(oklch(0.16 0.01 262.25), oklch(0.98 0 0));
 
  --color-primary: light-dark(oklch(0.85 0.2 93), oklch(0.85 0.2 93));
  --color-primary-fg: light-dark(oklch(0 0 0), oklch(0 0 0));
 
  --color-secondary: light-dark(
    oklch(0.96 0.01 262.25),
    oklch(0.23 0.01 262.25)
  );
  --color-secondary-fg: light-dark(oklch(0.25 0.01 262.25), oklch(0.98 0 0));
 
  --color-muted: light-dark(oklch(0.96 0.01 262.25), oklch(0.23 0.01 262.25));
  --color-muted-fg: light-dark(oklch(0.5 0.01 262.25), oklch(0.67 0.01 262.25));
 
  --color-accent: light-dark(oklch(0.96 0.01 262.25), oklch(0.23 0.01 262.25));
  --color-accent-fg: light-dark(oklch(0.25 0.01 262.25), oklch(0.98 0 0));
 
  --color-success: light-dark(oklch(0.62 0.18 0.53), oklch(0.62 0.18 0.53));
  --color-success-fg: light-dark(oklch(0.83 0.13 0.97), oklch(0.83 0.13 0.97));
 
  --color-info: light-dark(oklch(0.76 0.19 0.67), oklch(0.76 0.19 0.67));
  --color-info-fg: light-dark(oklch(1 0 0.75), oklch(0.76 0.19 0.67));
 
  --color-warning: light-dark(oklch(0.5 1 100), oklch(76 0.4 70));
  --color-warning-fg: light-dark(oklch(0.4 0.18 0.3), oklch(0.4 0.18 0.3));
 
  --color-danger: light-dark(oklch(0.57 0.22 27.16), oklch(0.33 0.15 27.16));
  --color-danger-fg: light-dark(oklch(0.98 0 0), oklch(0.98 0 0));
 
  --color-border: light-dark(oklch(0.89 0.01 262.25), oklch(0.23 0.01 262.25));
  --color-input: light-dark(oklch(0.89 0.01 262.25), oklch(0.23 0.01 262.25));
  --color-ring: var(--color-primary);
}
 
@utility container {
  margin-inline: auto;
  padding-inline: 2rem;
}
 
@layer base {
  *,
  ::after,
  ::before,
  ::backdrop,
  ::file-selector-button {
    border-color: var(--color-border, currentColor);
  }
 
  html {
    scroll-behavior: smooth;
  }
 
  body {
    font-feature-settings: "rlig" 1, "calt" 1;
  }
}

Configure Class Variance Authority

Class Variance Authority (a.k.a. CVA) is a utility that helps you manage class variance in your project. Here's how I define it in lib/cva.ts:

lib/cva.ts
import { defineConfig } from "cva";
import { twMerge } from "tailwind-merge";
 
export const {
  cva,
  cx: cn,
  compose,
} = defineConfig({
  hooks: {
    onComplete: (className) => twMerge(className),
  },
});
 
export { cx } from "cva";
 
export type { VariantProps } from "cva";

That's it ✨

You can now start adding components to your project.