Top Related Projects
A utility-first CSS framework for rapid UI development.
Minimal Laravel authentication scaffolding with Blade, Vue, or React + Tailwind.
Laravel UI utilities and presets.
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
A rugged, minimal framework for composing JavaScript behavior in your markup.
Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
Quick Overview
Laravel Frontend Presets: Tailwind CSS is a package that provides a quick way to scaffold your Laravel application's frontend using Tailwind CSS. It replaces the default Bootstrap styling with Tailwind CSS, offering a utility-first CSS framework for rapid UI development in Laravel projects.
Pros
- Seamless integration with Laravel's frontend scaffolding
- Provides a modern, utility-first CSS approach for Laravel projects
- Includes pre-configured Tailwind CSS setup, saving development time
- Offers a clean slate for custom designs without opinionated styles
Cons
- May require a learning curve for developers unfamiliar with Tailwind CSS
- Could be overkill for very small projects or prototypes
- Removes Bootstrap, which some developers might prefer
- Limited customization options out of the box compared to manual setup
Code Examples
- Installing the preset:
composer require laravel-frontend-presets/tailwindcss --dev
- Applying the preset:
php artisan ui tailwindcss
- Compiling assets:
npm install && npm run dev
Getting Started
To get started with Laravel Frontend Presets: Tailwind CSS, follow these steps:
-
Install Laravel and create a new project:
composer create-project --prefer-dist laravel/laravel my-project cd my-project
-
Install the Tailwind CSS preset:
composer require laravel-frontend-presets/tailwindcss --dev
-
Apply the preset:
php artisan ui tailwindcss
-
Install NPM dependencies and compile assets:
npm install && npm run dev
-
Start your Laravel development server:
php artisan serve
Your Laravel application is now set up with Tailwind CSS. You can begin building your UI using Tailwind's utility classes in your Blade templates.
Competitor Comparisons
A utility-first CSS framework for rapid UI development.
Pros of tailwindcss
- More comprehensive and actively maintained
- Offers a wider range of utility classes and customization options
- Better documentation and community support
Cons of tailwindcss
- Steeper learning curve for beginners
- Requires more configuration for integration with Laravel projects
- Larger file size if not properly optimized
Code Comparison
tailwindcss:
@tailwind base;
@tailwind components;
@tailwind utilities;
.btn-primary {
@apply py-2 px-4 bg-blue-500 text-white font-semibold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-opacity-75;
}
laravel-frontend-presets/tailwindcss:
php artisan ui tailwindcss
npm install
npm run dev
The tailwindcss repository provides a more flexible and customizable approach, allowing developers to create complex designs using utility classes. The laravel-frontend-presets/tailwindcss offers a simpler integration with Laravel projects but with fewer customization options.
While tailwindcss requires more setup and configuration, it provides greater control over the design system. The laravel-frontend-presets/tailwindcss is easier to set up but may be limited in its utility for more complex projects.
Minimal Laravel authentication scaffolding with Blade, Vue, or React + Tailwind.
Pros of Breeze
- More comprehensive authentication scaffolding, including login, registration, password reset, and email verification
- Includes Inertia.js support for building single-page applications
- Offers a choice between Blade templates and Vue.js components
Cons of Breeze
- Less focused on frontend styling, requiring more customization for a polished look
- Potentially more complex setup for developers who only need basic authentication
Code Comparison
Breeze (Vue.js component):
<template>
<jet-authentication-card>
<jet-validation-errors class="mb-4" />
<form @submit.prevent="submit">
<!-- Form fields -->
</form>
</jet-authentication-card>
</template>
TailwindCSS Preset:
<?php
namespace Laravel\Ui\Presets\TailwindCSS;
use Illuminate\Filesystem\Filesystem;
use Laravel\Ui\Presets\Preset;
class TailwindCSSPreset extends Preset
{
public static function install()
{
static::updatePackages();
static::updateWebpackConfiguration();
static::updateBootstrapping();
static::updateComponent();
static::removeNodeModules();
}
}
The code snippets showcase the different approaches: Breeze focuses on Vue.js components for authentication, while the TailwindCSS Preset is more concerned with setting up the Tailwind CSS framework in a Laravel project.
Laravel UI utilities and presets.
Pros of laravel/ui
- Provides a more comprehensive set of authentication scaffolding, including login, registration, and password reset views
- Offers Bootstrap and Vue.js integration out of the box
- Maintained directly by the Laravel team, ensuring compatibility with the latest Laravel versions
Cons of laravel/ui
- Less flexible and customizable compared to Tailwind CSS
- Heavier in terms of file size and CSS specificity
- May require more effort to override default styles
Code Comparison
laravel/ui (Bootstrap):
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
</div>
</div>
tailwindcss:
<div class="mb-4">
<label for="email" class="block text-gray-700 text-sm font-bold mb-2">{{ __('E-Mail Address') }}</label>
<input id="email" type="email" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline @error('email') border-red-500 @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
</div>
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
Pros of Livewire
- Full-stack framework for dynamic interfaces without writing JavaScript
- Seamless integration with Laravel, allowing for rapid development
- Real-time updates and server-side rendering for improved performance
Cons of Livewire
- Steeper learning curve for developers new to the Livewire paradigm
- Potential performance overhead for complex applications with many components
- Limited flexibility compared to client-side JavaScript frameworks
Code Comparison
Livewire component:
class SearchUsers extends Component
{
public $search = '';
public function render()
{
return view('livewire.search-users', [
'users' => User::where('name', 'like', "%{$this->search}%")->get(),
]);
}
}
TailwindCSS preset (Laravel Blade view):
<div class="mt-8">
<input type="text" class="form-input w-full" placeholder="Search users...">
<ul class="mt-4">
@foreach ($users as $user)
<li class="py-2">{{ $user->name }}</li>
@endforeach
</ul>
</div>
The Livewire example demonstrates its reactive nature, while the TailwindCSS preset focuses on styling and structure. Livewire offers more dynamic functionality out of the box, whereas TailwindCSS provides a utility-first CSS framework for rapid UI development.
A rugged, minimal framework for composing JavaScript behavior in your markup.
Pros of Alpine
- Lightweight and minimal, with a smaller footprint than Tailwind CSS
- Can be used without a build step, making it easier to integrate into existing projects
- Provides reactive and declarative features for dynamic UI interactions
Cons of Alpine
- Less comprehensive styling capabilities compared to Tailwind CSS
- Steeper learning curve for developers unfamiliar with reactive programming concepts
- Limited ecosystem and community resources compared to Tailwind CSS
Code Comparison
Alpine:
<div x-data="{ open: false }">
<button @click="open = !open">Toggle</button>
<div x-show="open">Content</div>
</div>
Tailwind CSS:
<div class="relative">
<button class="bg-blue-500 text-white px-4 py-2 rounded">Toggle</button>
<div class="mt-2 bg-white shadow-lg rounded p-4">Content</div>
</div>
Alpine focuses on adding interactivity with minimal markup, while Tailwind CSS provides utility classes for styling. The Alpine example demonstrates toggling content visibility, whereas the Tailwind CSS example shows how to style elements using utility classes.
Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
Pros of Inertia
- Seamless integration of server-side and client-side rendering
- Allows using existing Laravel routing and controllers
- Supports multiple frontend frameworks (Vue, React, Svelte)
Cons of Inertia
- Steeper learning curve for developers new to SPA concepts
- Requires additional setup compared to traditional Laravel views
- May have performance overhead for simple applications
Code Comparison
Inertia (Vue.js component):
<template>
<layout>
<h1>{{ title }}</h1>
<p>{{ content }}</p>
</layout>
</template>
<script>
export default {
props: ['title', 'content']
}
</script>
TailwindCSS Preset (Blade template):
@extends('layouts.app')
@section('content')
<h1 class="text-2xl font-bold">{{ $title }}</h1>
<p class="mt-4">{{ $content }}</p>
@endsection
The Inertia approach allows for a more component-based structure and easier state management, while the TailwindCSS preset focuses on providing utility classes for styling within traditional Blade templates. Inertia offers a more modern SPA-like experience, whereas the TailwindCSS preset is simpler to implement for developers familiar with Laravel's standard view system.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Laravel 7.0+ Frontend preset for Tailwind CSS
A Laravel front-end scaffolding preset for Tailwind CSS - a Utility-First CSS Framework for Rapid UI Development.
Usage
- Fresh install Laravel >= 7.0 and
cd
to your app. - Install this preset via
composer require laravel-frontend-presets/tailwindcss --dev
. Laravel will automatically discover this package. No need to register the service provider.
a. For Presets without Authentication
- Use
php artisan ui tailwindcss
for the basic Tailwind CSS preset npm install && npm run dev
php artisan serve
(or equivalent) to run server and test preset.
b. For Presets with Authentication
- Use
php artisan ui tailwindcss --auth
for the basic preset, auth route entry, and Tailwind CSS auth views in one go. (NOTE: If you run this command several times, be sure to clean up the duplicate Auth entries inroutes/web.php
) npm install && npm run dev
- Configure your favorite database (mysql, sqlite etc.)
php artisan migrate
to create basic user tables.php artisan serve
(or equivalent) to run server and test preset.
Config
The default tailwind.config.js
configuration file included by this package simply uses the config from the Tailwind vendor files. Should you wish to make changes, you should remove the file and run node_modules/.bin/tailwind init
, which will generate a fresh configuration file for you, which you are free to change to suit your needs.
Add a new i18n string in the resources/lang/XX/pagination.php
file for each language that your app uses:
'previous' => '« Previous',
'next' => 'Next »',
'goto_page' => 'Goto page #:page', // Add this line
This should help with accessibility
<li>
<a href="URL?page=2" class="..."
aria-label="Goto page #2"
>
2
</a>
</li>
Pagination
Laravel now supports Tailwind CSS pagination directly. If you would like to use these views in your app, you can refer to docs.
Screenshots
Top Related Projects
A utility-first CSS framework for rapid UI development.
Minimal Laravel authentication scaffolding with Blade, Vue, or React + Tailwind.
Laravel UI utilities and presets.
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
A rugged, minimal framework for composing JavaScript behavior in your markup.
Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot