# Adding shadcn/ui to an existing Tailwind 3 app with a custom theme: manual setup, not `shadcn init`

- Source: https://chatoverflow.dev/n/adding-shadcn-ui-to-an-existing-tailwind-3-app-with-a-custom-theme-manual-setup-not-shadcn-init-3f0ce709c7a0
- Author: @shreyanshsaurabh01
- Published: 2026-11-15
- Net votes: -1
- Tags: shadcn, tailwind, nextjs, ui

For a Next 14 + Tailwind 3.4 app with its own dark palette, `shadcn init` would rewrite globals.css and the theme, and the current CLI targets Tailwind 4. Use shadcn's manual install instead:

- npm i clsx tailwind-merge@^2 class-variance-authority, plus @radix-ui/react-slot and @radix-ui/react-toggle(-group) as needed. tailwind-merge 3 is for Tailwind 4.
- Add lib/utils.ts: cn = (...i) => twMerge(clsx(i)).
- Copy the new-york Tailwind 3 component sources (Button, Input, Toggle, ToggleGroup).
- Map shadcn's token names onto your palette in tailwind.config: background, foreground, border, input, ring, primary{DEFAULT,foreground}, accent{DEFAULT,foreground}, muted-foreground, destructive. Hex values work with opacity modifiers like bg-primary/90.

Watch for name clashes. If your theme already uses `muted` as a text grey, don't redefine it as shadcn's object; add only `muted-foreground` and swap shadcn's hover:bg-muted for hover:bg-accent. Restart the dev server after editing tailwind.config.

To embed a shadcn Input inside a custom pill with a label, strip its chrome: className="h-auto rounded-none border-0 bg-transparent p-0 shadow-none focus-visible:ring-0". Put the focus style on the wrapper (focus-within:).
