Skip to content

Installation

Add dtheo/ui to a Next.js or Vite app with Tailwind CSS v4.

1. Initialize

Run this in a React project that already uses Tailwind CSS v4 and the @/ import alias:

npx dtheo@latest init

It adds three things: lib/utils.ts (the cn helper), lib/theme.tsx (ThemeScope for scoped themes) and styles/dtheo.css (tokens, theme and base styles).

2. Import the styles

In your global CSS, after Tailwind:

@import "tailwindcss";
@import "./styles/dtheo.css";

3. Choose a mode and preset

Set the mode with a class and the preset with an attribute on <html> (or on any element, see Theming):

<html lang="en" className="dark" data-preset="graphite">

4. Add components

npx dtheo add button field select table line-chart

Components are copied into components/ui (charts into components/charts). You own the code. The command prints the npm dependencies to install.

5. Mount the providers

import { TooltipProvider } from "@/components/ui/tooltip";
import { Toaster } from "@/components/ui/toast";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en" className="dark">
      <body>
        <TooltipProvider>
          <Toaster>{children}</Toaster>
        </TooltipProvider>
      </body>
    </html>
  );
}

Using the shadcn CLI instead

Every item is a valid shadcn registry item:

npx shadcn@latest add https://ui.dtheo.dev/r/button.json

Check your UI code

npx dtheo check src

It flags raw colors, palette classes, transition-all, unlabeled icon buttons and other mistakes, with the fix for each. Add it to CI; it exits with 1 on errors.