p
GitHub

Getting started

Installation

Add the tokens to a Next.js app with Tailwind CSS v4. It takes about 5 minutes.

The registry isn't live yet

ds.pangpond.design hasn't been deployed. Until it is, run bun run registry:build and bun run dev in this repo, then replace the URLs below with http://localhost:3000/r.

Setup

Starts from a Next.js app with Tailwind CSS v4, like the one create-next-app gives you. Paths below use src/app; without a src/ folder the files land in app/ instead.

  1. Set up shadcn

    This creates components.json, which the CLI needs before it can add anything else.

    npx shadcn@latest init
  2. Add the tokens

    This copies theme.css into your app.

    npx shadcn@latest add https://ds.pangpond.design/r/tokens.json
  3. Replace globals.css

    shadcn init writes its own colors, radius and fonts into globals.css. Delete all of it. theme.css already provides every one of those, and anything left over would override the tokens. Never edit theme.css itself.

    src/app/globals.css (whole file)
    @import "tailwindcss";
    @import "tw-animate-css";
    @import "shadcn/tailwind.css";
    @import "./theme.css";

    That's the neutral theme with system fonts, and it's a complete setup. The next steps are optional.

  4. Pick a theme (optional)

    Use a ready-made theme, or skip this step and write your own on the Theming page. Each theme names the fonts it needs. Load them with next/font and put the variables on <html>, not <body>, so the theme can read them.

    npx shadcn@latest add https://ds.pangpond.design/r/theme-pangpond.json
    src/app/globals.css (whole file)
    @import "tailwindcss";
    @import "tw-animate-css";
    @import "shadcn/tailwind.css";
    @import "./theme.css";
    @import "./theme-pangpond.css";
    src/app/layout.tsx
    import { Figtree, Literata } from "next/font/google";
    
    const figtree = Figtree({ variable: "--font-figtree", subsets: ["latin"] });
    const literata = Literata({ variable: "--font-literata", subsets: ["latin"] });
    
    // in RootLayout
    <html lang="en" data-theme="pangpond" className={`${figtree.variable} ${literata.variable}`}>
  5. Add dark mode (optional)

    Dark mode is the .dark class. next-themes sets it and remembers the choice.

    npm install next-themes
    src/app/layout.tsx
    import { ThemeProvider } from "next-themes";
    
    // in RootLayout. suppressHydrationWarning because next-themes edits <html> before React loads
    <html lang="en" suppressHydrationWarning>
      <body>
        <ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
          {children}
        </ThemeProvider>
      </body>
    </html>
  6. Add motion (optional)

    Shared easing, durations and Framer Motion presets. See the Motion page for the MotionConfig wrapper that handles reduced motion.

    npx shadcn@latest add https://ds.pangpond.design/r/motion.json

The tokens use shadcn's names, so any component from npx shadcn@latest add picks up your theme with no changes.

Updating

Run the same command with --overwrite. Commit first so you can review the diff.

git commit -am "before design system update"
npx shadcn@latest add https://ds.pangpond.design/r/tokens.json --overwrite
git diff

Rules that keep updates safe

  • Never edit theme.css or animations.ts inside a product. Overwriting them is how updates arrive.
  • Put product changes in globals.css, after the import. That is the theme layer.
  • Components are yours to edit, but check the diff after an overwrite and put your tweaks back.