Skip to content

Next.js

Complete step-by-step integration for Next.js 15/16 App Router, React 19, and Tailwind CSS v4.

This guide walks you through setting up Space UI in a modern Next.js application with the App Router, React 19, and Tailwind CSS v4.

Space UI components are fully compatible with Next.js Server Components. Interactive primitives automatically contain the 'use client' directive where necessary.

Create a Next.js Project

Initialize a new Next.js application with TypeScript, Tailwind CSS, and App Router:

Bash

Initialize Space UI Preset

Run the official initialization command to configure the Space UI design tokens, Base UI dependencies, and squircle utilities:

Bash

Configure components.json

Ensure your components.json includes the @spaceui registry namespace alongside your project path aliases:

components.json

Configure Tailwind CSS v4 in globals.css

Tailwind CSS v4 uses CSS-first configuration. Verify that app/globals.css imports Tailwind and defines the Space UI theme tokens:

app/globals.css

Setup Stacking Context in app/layout.tsx

Add the relative isolate utility class to your application wrapper. This ensures portaled elements (dialogs, tooltips, select menus) layer above sticky headers without z-index conflicts:

app/layout.tsx

Add Components

Install any component from the catalog:

Bash

Test in Your Page

Create a test page to verify smooth animations and styling:

app/page.tsx

Tips & Best Practices

React 19 Server Components: You can import and render Space UI primitives in Server Components without adding 'use client' to your page file, because the internal primitives encapsulate client boundaries directly.