Skip to main content
  1. Docs
  2. Get started
  3. Frameworks
  4. Next.js

Next.js

Qeetrix in an App Router app, with the colour scheme right on the first paint.

Time
5 minutesFour files
Requires
Next.js 16React 19.2, App Router
Package manager
Package manager

01 — Install

The packages.

bun add @qeetrix/react @qeetrix/tokens

02 — Styles

The tokens, then the components.

No PostCSS plugin and no Tailwind: plain CSS imports, in their layers.

app/globals.css
@import "@qeetrix/tokens/tokens.css";
@import "@qeetrix/react/styles.css" layer(components);

03 — Providers

One client component for the providers.

QeetrixProvider holds the locale and the colour scheme; storageKey saves the choice where the script reads it.

app/providers.tsx
"use client";

import { QeetrixProvider, ToastProvider } from "@qeetrix/react";
import type { ReactNode } from "react";

export function Providers({ children }: { children: ReactNode }) {
  return (
    <QeetrixProvider locale="en-IN" defaultColorScheme="system" storageKey="qx-color-scheme">
      <ToastProvider>{children}</ToastProvider>
    </QeetrixProvider>
  );
}

04 — The root layout

The scheme before the first paint.

colorSchemeScript sets the saved scheme on <html> before the first paint, a fixed string a strict CSP can allow by its hash. It changes <html> before React runs, so suppressHydrationWarning says that's expected.

app/layout.tsx
import { colorSchemeScript } from "@qeetrix/react";
import type { ReactNode } from "react";
import { Providers } from "./providers";
import "./globals.css";

export default function RootLayout({ children }: { children: ReactNode }) {
  return (
    <html lang="en-IN" suppressHydrationWarning>
      <head>
        <script dangerouslySetInnerHTML={{ __html: colorSchemeScript() }} />
      </head>
      <body>
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}

05 — Server components

Most render on the server.

Interactive components carry their own "use client", so a Server Component renders them as they are. These ship no JavaScript at all:

AvatarItem, Badge, Box, Breadcrumb, Card, CodeBlock, EmptyState, Grid, Heading, Inline, InstructionList, Link, LinkButton, PageHeader, ProviderButtonGroup, QRCode, Separator, Skeleton, SkipLink, Spinner, Stack, Stat, StateRuler, Text, Timeline, VisuallyHidden.

app/users/page.tsx
import { Badge, Card, Text } from "@qeetrix/react";
import { InviteButton } from "./invite-button";

// A Server Component: Card, Badge and Text render here, with no JavaScript.
export default function Page() {
  return (
    <Card title="Users" level={2} actions={<InviteButton />}>
      <Text>1,284 users</Text> <Badge tone="success">Synced</Badge>
    </Card>
  );
}
app/users/invite-button.tsx
"use client";

import { PlusIcon } from "@qeetrix/icons";
import { Button, useToast } from "@qeetrix/react";

// Your own handler needs a client component; Button itself is one already.
export function InviteButton() {
  const toast = useToast();
  return <Button icon={PlusIcon} onClick={() => toast.add({ title: "Invitation sent", tone: "success" })}>Invite users</Button>;
}
Next — FrameworksTanStack Start