---
title: "Set up your framework"
description: "The exact setup for Vite, Next.js, and TanStack Start. Our install test runs each one in a real app."
url: https://gelatinui.com/docs/frameworks
markdown_url: https://gelatinui.com/docs/frameworks.md
docs_index: https://gelatinui.com/docs/llms.txt
prompt: "Find the framework of this project: Vite, Next.js, or TanStack Start. Read https://gelatinui.com/docs/frameworks.md and apply the steps for it, with the isolate root for popups. Done when components.json lists the @gelatin-ui registry and the page is wrapped in a div with the isolate class."
---

> Docs index: https://gelatinui.com/docs/llms.txt

# Set up your framework

> The exact setup for Vite, Next.js, and TanStack Start. Our install test runs each one in a real app.

Each framework below has the steps that our install test runs in a real app. Find your framework, and do its steps in order. Then add the theme and your first component, as [Install](https://gelatinui.com/docs/install.md#add-the-theme) shows.

## Vite

### 1. Make the app

Use the React and TypeScript template.

```bash
npm create vite@latest my-app -- --template react-ts
```

### 2. Add Tailwind CSS 4

Install the packages:

```bash
npm install tailwindcss @tailwindcss/vite
```

Replace the whole content of `src/index.css` with this one line. The template rules (a dark-mode block, `#root` and `h1` sizes) would override the theme.

```css
@import "tailwindcss";
```

Delete `src/App.css`, and remove its import from `src/App.tsx`.

### 3. Add the `@` alias and the Tailwind plugin

Set the alias in `tsconfig.json` and in `tsconfig.app.json`:

```json
{
  "compilerOptions": {
    "paths": { "@/*": ["./src/*"] }
  }
}
```

Then write `vite.config.ts` with the Tailwind plugin and the same alias:

```ts
import { fileURLToPath, URL } from "node:url";

import tailwindcss from "@tailwindcss/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [react(), tailwindcss()],
  resolve: {
    alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) },
  },
});
```

### 4. Set up Gelatin UI

This command writes `components.json` with the Gelatin UI registry.

```bash
npx shadcn@latest init https://gelatinui.com/r/base.json
```

Tested with `create-vite` 9.3.4.

## Next.js

### 1. Make the app

This App Router template sets up Tailwind CSS 4 and the `@` alias for you.

```bash
npx create-next-app@latest my-app --ts --tailwind --app --no-src-dir --import-alias "@/*"
```

### 2. Set up Gelatin UI

This command writes `components.json` with the Gelatin UI registry.

```bash
npx shadcn@latest init https://gelatinui.com/r/base.json
```

Tested with `create-next-app` 16.4.5.

## TanStack Start

### 1. Make the app

The React template sets up Tailwind CSS 4 and the `@` alias for you.

```bash
npx @tanstack/cli@latest create my-app --framework React
```

### 2. Write `components.json` by hand

Do not run `shadcn init`. The template maps `#/*` in the `imports` of `package.json`. So `init` finds no alias and asks every question. Put this file in the project root:

```json
{
  "$schema": "https://ui.shadcn.com/schema.json",
  "style": "new-york",
  "rsc": false,
  "tsx": true,
  "tailwind": {
    "config": "",
    "css": "src/styles.css",
    "baseColor": "neutral",
    "cssVariables": true
  },
  "iconLibrary": "phosphor",
  "aliases": {
    "components": "@/components",
    "ui": "@/components/ui",
    "lib": "@/lib",
    "hooks": "@/hooks",
    "utils": "@/lib/utils"
  },
  "registries": {
    "@gelatin-ui": "https://gelatinui.com/r/{name}.json"
  }
}
```

Tested with `@tanstack/cli` 0.72.16.

## What differs per framework

The components are the same in every app. Only four places differ:

|               | Vite                    | Next.js                 | TanStack Start            |
| ------------- | ----------------------- | ----------------------- | ------------------------- |
| CSS entry     | `src/index.css`         | `app/globals.css`       | `src/styles.css`          |
| `@` points at | `src`                   | The project root        | `src`                     |
| Set up        | `init` with `base.json` | `init` with `base.json` | `components.json` by hand |
| Popup root    | `src/main.tsx`          | `app/layout.tsx`        | `src/routes/__root.tsx`   |

## Add the popup root

Base UI opens a popup (a menu, a dialog, a select) at the end of `body`. The theme sets `body` to `relative`. In the popup root file of the table, wrap the page in a div with the `isolate` class.

Next.js and TanStack Start wrap the children of `body`:

```tsx
<body>
  <div className="isolate">{children}</div>
</body>
```

Vite wraps the app in `src/main.tsx`:

```tsx
createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <div className="isolate">
      <App />
    </div>
  </StrictMode>,
);
```

Now each popup opens above the page.

## Fix common errors

| What you see                             | Cause                                                                  | Fix                                                                                                  |
| ---------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| Components show with no styles.          | The app runs Tailwind CSS 3.                                           | Update to Tailwind CSS 4. Replace the three `@tailwind` lines with `@import "tailwindcss";`.         |
| `Failed to resolve import "@/lib/utils"` | The `@` alias is in TypeScript but not in the bundler, or the reverse. | Set the same path in both.                                                                           |
| Menus and dialogs open behind the page.  | The page has no root layer.                                            | Wrap the page in a div with the `isolate` class, as [Add the popup root](#add-the-popup-root) shows. |
| A Pro item gives `401`.                  | The key is missing, wrong, or revoked.                                 | Set `GELATIN_UI_PRO_TOKEN` in the shell that runs the CLI. Then run the add command again.           |

## Next steps

- [Change the theme](https://gelatinui.com/docs/theming.md): change the colors, the radius, and the fonts.
- [Connect the MCP server](https://gelatinui.com/docs/mcp-server.md): let your agent find and add components.
