This guide follows Installation step by step for a React project on Vite. React projects use the
shadcn CLI and the /r/react/ registry. A Vite project keeps its code in src/, so every Trame path below starts
with src/.
1. Add Tailwind CSS v4
Trame UI needs Tailwind CSS v4. If your project does not have it yet, follow Tailwind’s Vite guide:
npm install tailwindcss @tailwindcss/vite
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [react(), tailwindcss()],
})
2. Set up the @ alias
The shadcn CLI places files through the aliases of components.json (@/components…), so @ must point to src/.
Follow shadcn/ui’s Vite guide for the paths in your tsconfig and the
resolve.alias in vite.config.ts. Trame’s own files import each other by relative paths and do not depend on the
alias.
3. Allow imports with their extension
Trame’s files import ./x.ts and ./x.tsx. Without this option, the build fails with TS5097. Vite’s templates keep
the app’s options in tsconfig.app.json; set it there (it needs noEmit, which Vite’s templates already set):
{
"compilerOptions": {
"allowImportingTsExtensions": true
}
}
4. Write components.json
npx shadcn@latest init asks questions. You can write components.json at the root yourself instead:
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": { "config": "", "css": "src/index.css", "baseColor": "neutral", "cssVariables": true },
"aliases": {
"components": "@/components",
"ui": "@/components/ui",
"lib": "@/lib",
"utils": "@/lib/utils",
"hooks": "@/hooks"
},
"iconLibrary": "lucide",
"registries": {
"@trame": {
"url": "https://trame-ui.com/r/react/{name}.json",
"headers": { "Authorization": "Bearer ${TRAME_KEY}" }
}
}
}
Set tailwind.css to your main CSS file. A Vite app has no server components, so rsc is false.
5. Put your key in .env
Components and themes install without a key. Blocks need one. Create it in your dashboard, then:
TRAME_KEY=trame_your_key_here
Keep .env out of git. See Your key.
6. Add an item
Run the CLI from the project root:
npx shadcn@latest add @trame/steps-cards
The files land in src/components/trame/.
7. Import the styles
In src/index.css, replace @import "tailwindcss"; with Trame’s index.css. It imports Tailwind itself:
/* src/index.css */
@import './components/trame/styles/index.css';
Some React blocks carry their own CSS. The CLI then prints a note that lists the files: import them in the same file,
after components/trame/styles.base.css, as the note says.
8. Map #context
Blocks read links, words and actions from their host through #context. Add this to package.json:
{
"imports": {
"#context": {
"react-server": "./src/components/trame/context/server.ts",
"default": "./src/components/trame/context/client.tsx"
}
}
}
A Vite app uses the default file; keep both lines so the mapping stays the same everywhere. Without this mapping,
blocks fall back to a demo context without warning.
9. Use the block
// src/App.tsx
import { StepsCards } from '@/components/trame/blocks/steps/steps-cards'
export default function App() {
return (
<StepsCards
title="How it works"
steps={[{ title: 'Choose a plan' }, { title: 'Set up your account' }, { title: 'Invite your team' }]}
/>
)
}
Until you give them your host, blocks use a demo one: links point to #action. See
Using blocks to give them yours.