UIGetting startedReact
Installation
Set up an app the way the registry's proof does, then add the theme and a component.
Set up the app
Each proven tab is what packages/ui/scripts/shadcn-proof.ts runs: it creates the app with these commands and files, adds the items with the CLI, then type-checks and builds the app. The proof also answers the tools' prompts, which you answer yourself.
Create the app with Vite:
npx create-vite@9.3.3 app --template react-tsInstall the headless package of your framework (not on npm yet: it goes out under the chosen name):
npm install @hamur/reactAdd Tailwind CSS and its Vite plugin:
npm install tailwindcss@4.3.4 @tailwindcss/vite@4.3.4Replace the template's src/index.css with Tailwind CSS:
src/index.css@import "tailwindcss";Add the @/ alias to both TypeScript configs:
tsconfig.json, tsconfig.app.json{ "compilerOptions": { "paths": { "@/*": [ "./src/*" ] } } }Load both plugins and resolve the alias in vite.config.ts:
vite.config.tsimport path from 'node:path' import tailwindcss from '@tailwindcss/vite' import react from '@vitejs/plugin-react' import { defineConfig } from 'vite' export default defineConfig({ plugins: [react(), tailwindcss()], resolve: { alias: { '@': path.resolve(import.meta.dirname, './src'), }, }, })Write components.json, so the CLI adds items without asking:
components.json{ "$schema": "https://ui.shadcn.com/schema.json", "style": "base-vega", "rsc": false, "tsx": true, "tailwind": { "config": "", "css": "src/index.css", "baseColor": "neutral", "cssVariables": true, "prefix": "" }, "iconLibrary": "lucide", "aliases": { "components": "@/components", "utils": "@/lib/utils", "ui": "@/components/ui", "lib": "@/lib", "hooks": "@/hooks" }, "registries": {} }Add the theme (Theming), then any component (CLI):
npx shadcn@4.23.0 add https://hamur.dev/r/react/theme-neutral.jsonnpx shadcn@4.23.0 add https://hamur.dev/r/react/dialog.jsonDialog pulls Button and the cn helper by their URLs.
The cn helper
Every component joins its classes with cn, which merges Tailwind classes so a class you pass wins over the component's. The CLI adds it with the first component; by hand it is this file:
import { clsx, type ClassValue } from 'clsx' // hamur/ui utils@0.1.0
import { twMerge } from 'tailwind-merge'
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}