创建项目
首先使用 Laravel 安装程序 laravel new my-app
创建一个新的 Laravel 项目,并集成 Inertia 和 React。
laravel new my-app --typescript --breeze --stack=react --git --no-interaction
运行 CLI
运行 shadcn
init 命令来设置您的项目。
配置 components.json
您将被询问一些问题来配置 components.json
。
Which style would you like to use?
Which color would you like to use as base color?
Do you want to use CSS variables for colors? › yes
就是这样
您现在可以开始向项目中添加组件了。
上述命令会将 Button
组件添加到您的项目中。您可以像这样导入它:
import { Button } from "@/Components/ui/button";
export default function Home() {
return (
<div>
<Button>Click me</Button>
</div>
);
}