Installation
Set up NachUI by hand in Next.js, Vite, TanStack Start or React Router. Install Tailwind CSS v4, add the shared helpers and theme tokens, then copy the components you need.
NachUI is plain React and Tailwind CSS, so it works in any React 19 project. The CLI is still in progress, so for now the setup is manual. It takes a few minutes and you only do it once.
Prerequisites
Before you begin, make sure your project has:
- React 19+
- Tailwind CSS v4
- TypeScript (recommended, the source is written in it)
- Node.js 20+
Not tied to Next.js
Many components start with
'use client'. That line is a React directive, not a Next.js feature. Frameworks that use React Server Components (like the Next.js App Router) read it to know which files run in the browser. Everywhere else, like Vite, TanStack Start or React Router, it is just a string that the bundler ignores. You can keep it in every setup.The components only import from
react, react-dom, motion, clsx, tailwind-merge and class-variance-authority. No router, no font loader and no framework APIs.Step-by-step installation
Set up your framework with Tailwind CSS v4
Pick your framework. If you already have a project with Tailwind CSS v4 running, skip to the next step and just note where your main stylesheet is.
Create the app with TypeScript, Tailwind CSS, the App Router and a
src/ folder:Tailwind CSS v4 comes already wired through
@tailwindcss/postcss, so there is nothing else to install.- Source folder:
src/ - Main stylesheet:
src/app/globals.css
If your existing project still runs Tailwind CSS v3, upgrade it first with
npx @tailwindcss/upgrade.Install the dependencies
npm install motion clsx tailwind-merge class-variance-authorityThese libraries are used for:
- motion: animations and transitions
- clsx: conditional class names
- tailwind-merge: merging Tailwind classes without conflicts
- class-variance-authority: component variants
Icons need no extra package. The components carry their own SVGs, and the optional NachUI icon set is one file per icon that you copy the same way as a component. Any other icon library works too, since every component takes icons through props.
Add the cn helper
Inside your source folder, create the helper every component uses to combine classes:
Add the motion tokens
Next to
cn, create the file that holds the animation vocabulary. Every component that moves reads its springs and variants from here, so the whole library shares one physical material and you tune it in one place:Three springs cover everything.
snappy is for hover, press and toggles, smooth for panels, menus and collapsibles, and gentle for the big surfaces like dialogs. Floating elements open from the side of their trigger and leave faster than they arrived.Add the state, overlay and floating helpers
Three more files live in
lib/, and you only need them once you add a component that imports them:use-controllable-state.tslets a component work both ways: you passvalueoropenand control it, or you leave them out and it keeps its own state. Most stateful components use it.overlay.tsholds what dialogs, sheets, drawers, menus and toasts share: the scroll lock, the focus trap and the stack of open layers, so Escape only closes the one on top.floating.tsplaces popovers, tooltips, menus and selects next to their trigger. It flips them to the other side when there is no room, keeps them inside the screen and renders them at the end of the page so a parent withoverflow: hiddencan't cut them off.
If a file you paste imports
../lib/use-controllable-state, ../lib/overlay or ../lib/floating, copy that helper into src/lib/ next to cn.ts. The CLI does this for you.Add the theme tokens
Replace the contents of your main stylesheet (the one you noted in the first step) with the following. If your file already has its own
@import 'tailwindcss' line, keep yours and paste everything below it.This is the default theme. Every color is a variable you own, so you can change it later without touching a component. Theming explains how the tokens work.
Organize the folders
Components import each other and the helpers through relative paths, like
../lib/cn or ../components/button. If you keep this layout inside your source folder, every file you paste works as-is:src
components
button.tsx
card.tsx
dialog.tsx
...
ai
hybrids
lib
cn.ts
motion.ts
floating.ts
overlay.ts
use-controllable-state.ts
components/: UI and layout elementsai/: AI elementshybrids/: hybrids, which combine UI and AI elementslib/: thecnhelper, the motion tokens and the shared helpers
If you prefer another layout, like
components/ui/, that works too. Just update the imports at the top of each file you paste to point at your folders, for example @/lib/cn in Next.js or ~/lib/cn in React Router.Add your first component
- Open the page of the component you want, for example Button.
- Copy the source from the Manual tab.
- Paste it into the matching folder, in this case
src/components/button.tsx. - If the page lists extra dependencies, install them.
- Import it and use it:
Some components use others. When a file imports something like
./label or ../components/dialog, copy that component too.Dark mode
The dark theme turns on when the
dark class is on the <html> element. Toggle that class however your app handles theme switching.Next steps
- Browse the component gallery to see everything available
- Read Theming to adapt the tokens to your brand
- Follow the CLI page to see where automated installs are heading
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.