Shadcn.io is not affiliated with official shadcn/ui
TanStack Start
Install shadcn/ui in TanStack Start with the official CLI. File routes, then add a component from the shadcn.io registry. TypeScript and Tailwind CSS.
init -t start scaffolds the app. For an existing Start app: @tanstack/cli create (do not tick the shadcn add-on), then init. Routes use createFileRoute.
Use the CLI
Create the project
npx shadcn@latest init -t startMonorepo:
npx shadcn@latest init -t start --monorepoAdd a component
npx shadcn@latest add https://www.shadcn.io/r/card.jsonMonorepo: from apps/web, or -c apps/web from the root.
Import it
import { createFileRoute } from "@tanstack/react-router"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
export const Route = createFileRoute("/")({
component: App,
})
function App() {
return (
<Card className="max-w-sm">
<CardHeader>
<CardTitle>Project Overview</CardTitle>
<CardDescription>
Track progress and recent activity for your TanStack Start app.
</CardDescription>
</CardHeader>
<CardContent>
Your design system is ready. Start building your next component.
</CardContent>
</Card>
)
}Monorepo: apps/web/src/routes/index.tsx, import @workspace/ui/components/card.
Existing project
Create the app if you need one
npx @tanstack/cli@latest createTanStack Start, React, recommended defaults. Tailwind and @/* come with that.
Do not add the shadcn add-on
The prompt will offer it. Skip it. npx shadcn@latest init configures the project in the next step.
Run init
npx shadcn@latest initAdd a component
npx shadcn@latest add https://www.shadcn.io/r/button.jsonimport { createFileRoute } from "@tanstack/react-router"
import { Button } from "@/components/ui/button"
export const Route = createFileRoute("/")({
component: App,
})
function App() {
return (
<div className="flex min-h-svh items-center justify-center p-6">
<Button>Click me</Button>
</div>
)
}Questions
Related
Was this page helpful?
Sign in to leave feedback.