Installation

Get started with MoonUI in your React or Next.js project. Choose between our CLI tool for automatic setup or manual installation.

Prerequisites

Make sure you have these installed before proceeding

React 18+

or Next.js 13+

Tailwind CSS v3

For styling system

Node.js 16+

LTS recommended

1

Install MoonUI CLI globally

terminal
$ npm install -g @moontra/moonui-cli
2

Initialize MoonUI in your project

terminal
$ moonui init

This will create a moonui.config.js file and set up your project with Tailwind CSS.

3

Add components to your project

terminal
$ moonui add button card dialog

You're ready!

Start using MoonUI components in your project

Post Installation

Configure your project after installation

1. Configure Tailwind CSS

Add the MoonUI preset to your tailwind.config.js. The preset maps Tailwind's color, radius, and font scales onto MoonUI's CSS variables — without it, utilities like bg-primary are never generated and components render with no colors.

tailwind.config.js
module.exports = {
  presets: [require("@moontra/moonui/tailwind-preset")],
  content: [
    "./src/**/*.{ts,tsx}",
    "./node_modules/@moontra/moonui/dist/**/*.{js,mjs}"
  ],
  plugins: [require("tailwindcss-animate")]
}

Everything the preset sets is still yours to override — add your own theme.extend block and it wins.

2. Add Global Styles

Import MoonUI's design tokens into your global CSS. This single import defines every CSS variable the components read — --primary, --border, --ring and the rest — for both light and dark mode.

globals.css
/* MoonUI design tokens (light + dark) */
@import "@moontra/moonui";

@tailwind base;
@tailwind components;
@tailwind utilities;

Prefer importing from your root layout instead? That works too:

app/layout.tsx
import "@moontra/moonui/tokens.css";

3. Setup Utils

Create a lib/utils.ts file:

lib/utils.ts
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

Browse Components

Explore our collection of 200+ components

Customize Theme

Learn how to customize MoonUI to match your brand