Framework usage
Minimal setup patterns for using Rad UI in Vite, Next.js App Router, and Remix.
For SSR pitfalls, see Troubleshooting.
Shared setup
Install the package:
Import components from per-component entrypoints:
Optional default theme styles:
Wrap interactive UI with Theme when you use Rad UI's tokenized styles or generated classNamespace classes.
Vite + React
Vite works with Rad UI out of the box. No special SSR configuration is required for a client-rendered SPA.
Notes
- Prefer per-component imports for tree-shaking.
- Add your own global styles or Tailwind preset alongside the optional Rad UI theme CSS.
Next.js App Router
Rad UI components are client-side interaction primitives. Place them in a Client Component file.
Notes
- Import Rad UI only from files marked with
'use client'when they use state, effects, or event handlers. - Keep server components free of interactive Rad UI imports unless they only re-export static markup wrappers you control.
- The docs app in this repository is a Next.js App Router consumer and is built in CI for compatibility smoke coverage.
Remix
Remix can SSR Rad UI markup, but interactive behavior still hydrates on the client.
Notes
- Load theme CSS through Remix
linksso styles are present on the first server render. - Avoid reading browser-only APIs during the initial render path.
Choosing a pattern
| Framework | Rad UI entry | Theme CSS | Client boundary |
|---|---|---|---|
| Vite SPA | main.tsx | import in entry | not required for SPA |
| Next.js App Router | providers.tsx + route components | layout.tsx | 'use client' for interactive components |
| Remix | root.tsx + routes | links export | route components hydrate automatically |