Join our Discord Community
Installation

Install shadcn/ui Laravel

How to install shadcn/ui with Laravel and Inertia.js. Setup React components in your PHP application.

How to install shadcn/ui with Laravel

Laravel + Inertia + React + shadcn/ui gives you the best of both worlds—Laravel's powerful backend with React's interactive UI, without building a separate API.

Quick setup with Inertia

Create Laravel project with React

laravel new my-app --react
cd my-app

This sets up Laravel with Inertia.js and React preconfigured. If you have an existing Laravel app, you can add Inertia and React manually.


Initialize shadcn/ui

npx shadcn@latest init

The CLI detects Laravel's structure and configures paths correctly. Components will be added to resources/js/components/ui/.


Add your first component

npx shadcn@latest add button card form

Components are placed in the Laravel resources directory where they belong.


Use in Inertia pages

// resources/js/Pages/Dashboard.tsx
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"

export default function Dashboard({ users }) {
  return (
    <Card>
      <CardHeader>
        <CardTitle>User Dashboard</CardTitle>
      </CardHeader>
      <CardContent>
        <p>Total users: {users.length}</p>
        <Button>Add User</Button>
      </CardContent>
    </Card>
  )
}

File structure

components.json

Deployment

Deploy Laravel + shadcn/ui apps anywhere Laravel runs:

PlatformSetupBest For
Laravel ForgeOne-click deploymentOfficial Laravel hosting
Laravel VaporServerless LaravelScalable serverless apps
Digital OceanApp Platform or DropletsCost-effective cloud hosting
Traditional hostingAny PHP host with Node.jsShared hosting and VPS

Next steps

With Laravel + shadcn/ui configured:

  1. Browse official components for forms, tables, and UI elements
  2. Add charts for data visualization
  3. Explore community components for extended functionality
  4. Add useful hooks to enhance your components
  5. Use pre-built blocks to quickly build common layouts

Laravel's backend power combined with shadcn/ui's flexible components creates a powerful full-stack development experience.

Questions you're probably thinking