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
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.
Set up shadcn
This creates
components.json, which the CLI needs before it can add anything else.npx shadcn@latest initAdd the tokens
This copies
theme.cssinto your app.npx shadcn@latest add https://ds.pangpond.design/r/tokens.jsonReplace globals.css
shadcn initwrites its own colors, radius and fonts intoglobals.css. Delete all of it.theme.cssalready provides every one of those, and anything left over would override the tokens. Never edittheme.cssitself.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.
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/fontand put the variables on<html>, not<body>, so the theme can read them.npx shadcn@latest add https://ds.pangpond.design/r/theme-pangpond.jsonsrc/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}`}>Add dark mode (optional)
Dark mode is the
.darkclass.next-themessets it and remembers the choice.npm install next-themessrc/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>Add motion (optional)
Shared easing, durations and Framer Motion presets. See the Motion page for the
MotionConfigwrapper 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 diffRules that keep updates safe
- Never edit
theme.cssoranimations.tsinside 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.