110k

TanStack Start

安装并配置 shadcn/ui 以用于 TanStack Start。

创建项目

运行以下命令以创建一个包含 shadcn/ui 的 TanStack Start 新项目:

pnpm dlx shadcn@latest init -t tanstack

对于 monorepo 项目,使用 --monorepo 标志:

pnpm dlx shadcn@latest init -t tanstack --monorepo

添加组件

现在你可以开始向项目添加组件了。

pnpm dlx shadcn@latest add button

上面的命令会将 Button 组件添加到你的项目中。然后可以这样导入它:

app/routes/index.tsx
import { Button } from "@/components/ui/button"
 
function App() {
  return (
    <div>
      <Button>点击我</Button>
    </div>
  )
}