This guide follows Installation step by step for Next.js with the App Router. React projects use
the shadcn CLI and the /r/react/ registry. Blocks are server components where they can be; their interactive parts
are client components.
1. Start from a project with Tailwind CSS v4
create-next-app can set up Tailwind for you. For an existing project, follow
Tailwind’s Next.js guide.
The paths below assume the app is in app/. If you chose a src/ folder, read src/app/… and src/components/…
everywhere, in the CSS import and the #context mapping too.
2. Allow imports with their extension
Trame’s files import ./x.ts and ./x.tsx. Without this option, the build fails with TS5097. Add it to
tsconfig.json (it needs noEmit, which Next.js already sets):
{
"compilerOptions": {
"allowImportingTsExtensions": true
}
}
3. 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": true,
"tsx": true,
"tailwind": { "config": "", "css": "app/globals.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}" }
}
}
}
With a src/ folder, tailwind.css is src/app/globals.css.
4. 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.
5. Add an item
Run the CLI from the project root:
npx shadcn@latest add @trame/steps-cards
The files land in components/trame/.
6. Import the styles
In app/globals.css, replace @import "tailwindcss"; with Trame’s index.css. It imports Tailwind itself:
/* app/globals.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.
7. Map #context
Blocks read links, words and actions from their host through #context. Add this to package.json, so server
components and client components each get the right file:
{
"imports": {
"#context": {
"react-server": "./components/trame/context/server.ts",
"default": "./components/trame/context/client.tsx"
}
}
}
With a src/ folder, the paths start with ./src/components/trame/context/. Without this mapping, blocks fall back to
a demo context without warning.
8. Use the block
// app/page.tsx
import { StepsCards } from '@/components/trame/blocks/steps/steps-cards'
export default function Page() {
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, on the server and in the browser.