Skip to contentsrc/routes/index.tsx
Install and configure Fabricator UI for TanStack Router.
Create project#
Start by creating a new TanStack Router project:
bunx --bun create-tsrouter-app@latest my-app --template file-router --tailwind
The --tailwind flag sets up Tailwind CSS, and the template configures the @/* import alias. If you're adding Fabricator UI to an existing TanStack Router app, make sure both are configured before continuing.
Run the CLI#
Run the init command from the root of your app to set up Fabricator UI:
cd my-app
npx fabricator-ui@latest initThis writes components.json, adds the cn util and the CSS variables for your theme, and configures the @fabricator registry.
Add Components#
You can now start adding components to your project.
bunx --bun fabricator-ui@latest add button
The command above will add the Button component to your project. You can then import it like this:
import { createFileRoute } from "@tanstack/react-router"
import { Button } from "@/components/ui/button"
export const Route = createFileRoute("/")({
component: App,
})
function App() {
return (
<div>
<Button>Click me</Button>
</div>
)
}