Capítulo 16 de 108
Single-command scaffold: create-tsrouter-app has a built-in shadcn add-on that configures everything in one step, unlike most other frameworks' multi-path guides.
--add-ons shadcn: create-tsrouter-app flag that wires up shadcn/ui during project creation itself, no separate shadcn init needed.@/* alias: same convention as Next.js/Vite/Astro.npx create-tsrouter-app@latest my-app --template file-router --tailwind --add-ons shadcn
npx shadcn@latest add button
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>
)
}
createFileRoute, componente shadcn importado com alias @/.shadcn init after this scaffold command: not needed, --add-ons shadcn already does it.