组件
注意: 本指南适用于 Remix。有关 React Router,请参见 React Router 指南。
创建项目
🌐 Create project
首先使用 create-remix 创建一个新的 Remix 项目:
🌐 Start by creating a new Remix project using create-remix:
pnpm dlx create-remix@latest my-app
运行 CLI
🌐 Run the CLI
运行 shadcn init 命令来设置你的项目:
🌐 Run the shadcn init command to setup your project:
pnpm dlx shadcn@latest init
就是这样
🌐 That's it
你现在可以开始向你的项目添加组件。
🌐 You can now start adding components to your project.
pnpm dlx shadcn@latest add button
上面的命令将会把 Button 组件添加到你的项目中。然后你可以这样导入它:
🌐 The command above will add the Button component to your project. You can then import it like this:
import { Button } from "~/components/ui/button"
export default function Home() {
return (
<div>
<Button>Click me</Button>
</div>
)
}