Docs
Install Vite
Start a React app with Vite, Tailwind CSS and shadcn/ui, then add your first block.
Create the app
Terminal
npm create vite@latest my-app -- --template react-tsAdd Tailwind CSS
Terminal
cd my-apppnpm add tailwindcss @tailwindcss/viteReplace everything in src/index.css with:
src/index.css
@import "tailwindcss";Point @/ at src
shadcn/ui and every block import from @/. Add the alias to both tsconfig files:
tsconfig.json and tsconfig.app.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": { "@/*": ["./src/*"] }
}
}Then teach Vite the same alias and add the Tailwind plugin:
pnpm add -D @types/nodevite.config.ts
import path from "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(__dirname, "./src") },
},
});Set up shadcn/ui
pnpm dlx shadcn@latest initAdd the @twe registry
components.json
{
"registries": {
"@twe": "https://techwithemma.com/r/{name}.json"
}
}Install a block and show it
pnpm dlx shadcn@latest add @twe/cta-minimal-bannersrc/App.tsx
import CtaBanner from "@/components/twe-element/cta-minimal-banner";
export default function App() {
return <CtaBanner />;
}Run npm run dev. Using TanStack Start or React Router instead? Follow shadcn/ui's setup for your framework, then continue from step 5.