112k

Remix

为 Remix 安装和配置 shadcn/ui。

创建项目

先使用 create-remix 创建一个新的 Remix 项目:

pnpm create remix@latest my-app

运行 CLI

运行 shadcn init 命令,为你的项目设置 shadcn/ui:

pnpm dlx shadcn@latest init

就是这样

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

pnpm dlx shadcn@latest add button

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

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