隆重推出 Magic UI Pro - 50+ 个模块和模板,助您在几分钟内构建出精美的着陆页。

文档
Laravel

Laravel

使用 Inertia 安装并配置 Laravel

创建项目

首先使用 laravel 安装器创建新的 Laravel 项目,并集成 Inertia 和 React laravel new my-app

laravel new my-app --typescript --breeze --stack=react --git --no-interaction

运行 CLI

运行 shadcn 初始化命令以设置你的项目

配置 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>
  );
}