Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

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.

  1. Create the app with Vite:

    npx create-vite@9.3.3 app --template react-ts
  2. Install the headless package of your framework (not on npm yet: it goes out under the chosen name):

    npm install @hamur/react
  3. Add Tailwind CSS and its Vite plugin:

    npm install tailwindcss@4.3.4 @tailwindcss/vite@4.3.4
  4. Replace the template's src/index.css with Tailwind CSS:

    src/index.css
    @import "tailwindcss";
    
  5. Add the @/ alias to both TypeScript configs:

    tsconfig.json, tsconfig.app.json
    {
      "compilerOptions": {
        "paths": {
          "@/*": [
            "./src/*"
          ]
        }
      }
    }
  6. Load both plugins and resolve the alias in vite.config.ts:

    vite.config.ts
    import 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'),
        },
      },
    })
    
  7. 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": {}
    }
    
  8. Add the theme (Theming), then any component (CLI):

    npx shadcn@4.23.0 add https://hamur.dev/r/react/theme-neutral.json
    npx shadcn@4.23.0 add https://hamur.dev/r/react/dialog.json

    Dialog 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:

lib/utils.ts
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))
}