Capítulo 13 de 108
The shadcn CLI does not scaffold a Laravel app itself; start with laravel new (React starter kit + Inertia), then run shadcn init either via a shadcn/create preset command or the CLI directly.
laravel new my-app choosing the React starter kit (React + Inertia), before touching shadcn.@/components/ui/* under src or root), Laravel components land in resources/js/components/ui/.init on a fresh Laravel+Inertia app, choose "Yes" to overwrite components.json and components (Laravel's starter kit may already scaffold conflicting files).laravel new my-app
cd my-app
npx shadcn@latest init --preset [CODE] --template laravel # or: npx shadcn@latest init
npx shadcn@latest add switch
import { Switch } from "@/components/ui/switch"
const MyPage = () => {
return (
<div>
<Switch />
</div>
)
}
export default MyPage
@/components/ui/*, mesmo com o arquivo físico morando em resources/js/components/ui/.shadcn init to create the Laravel project: it only configures shadcn/ui inside an already-scaffolded Laravel+React+Inertia app.laravel new (React starter kit) first, shadcn init second.resources/js/components/ui/) but the @/ import alias stays consistent with other frameworks.