Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

Setup with Next.js

Configure the App Router for Gaudi's React source, stylesheet and themes.

Gaudi ships React source (JSX) for a JSX-aware bundler and Tailwind CSS v4 processing, so Next.js must transpile it.

1. Transpile the package

next.config.mjs
javascript
export default {  transpilePackages: ['@gaudi/design-system']};

2. Load the stylesheet once

app/layout.jsx
jsx
import '@gaudi/design-system/global.css';

global.css loads Tailwind v4, Gaudi's tokens, foundations and component CSS, and scans the package source. If your app owns its Tailwind entry, use styles.css instead.

3. Add themes (optional)

Render the no-flash script in <head> and wrap the app in ThemeProvider from a client component:

app/layout.jsx
jsx
import { getThemeScript } from '@gaudi/design-system/themes';import { Providers } from './providers';
export default function RootLayout({ children }) { return ( <html lang='en' suppressHydrationWarning> <head><script dangerouslySetInnerHTML={{ __html: getThemeScript() }} /></head> <body><Providers>{children}</Providers></body> </html> );}
app/providers.jsx
jsx
'use client';import { ThemeProvider } from '@gaudi/design-system/themes';
export const Providers = ({ children }) => <ThemeProvider defaultMode='system'>{children}</ThemeProvider>;

Apps that keep next-themes for light/dark pass enableMode={false} to ThemeProvider and getThemeScript. See the theming guide.

Site configuration

Site-aware components (navigation, footer, command launcher) read metadata from SiteConfigProvider; LayoutContainer wires it up. Gaudi never imports data from the consuming app.

import { SiteConfigProvider } from '@gaudi/design-system/context';
<SiteConfigProvider metadata={siteMetadata} navigation={navigationMetadata}> <App /></SiteConfigProvider>
This documentation site is itself a Next.js App Router app built this way: Gaudi's ThemeProvider, AppShell, Tabs, CodeBlock, Command and Button render its chrome.