Check out this guide to learn how to set up a new Laravel project together with Tailwind CSS and the UI components from Flowbite to enhance your front-end development workflow.
Make sure that you have Composer and Node.js installed locally on your computer.
Follow the next steps to install Tailwind CSS and Flowbite with Laravel Mix.
composer global require laravel/installer
Make sure to place the vendor bin directory in your PATH. Here's how you can do it based on each OS:
export PATH="$PATH:$HOME/.composer/vendor/bin"
set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
export PATH="~/.config/composer/vendor/bin:$PATH"
laravel new flowbite-app
cd flowbite-app
Start the development server using the following command:
composer run dev
You can now access the Laravel application on http://localhost:8000
.
This command will initialize a blank Laravel project that you can get started with.
Since Laravel 12, the latest version of Tailwind v4 will be installed by default, so if you have that version or later then you can skip this step and proceed with installing Flowbite.
npm install tailwindcss @tailwindcss/vite --save-dev
vite.config.ts
file by importing the Tailwind plugin:import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [
tailwindcss(),
// …
],
})
app.css
CSS file:@import "tailwindcss";
npm run dev
. Use npm run build
for production builds.Flowbite is a popular and open-source UI component library built on top of the Tailwind CSS framework that allows you to choose from a wide range of UI components such as modals, drawers, buttons, dropdowns, datepickers, and more to make your development workflow faster and more efficient.
Follow the next steps to install Flowbite using NPM.
npm install flowbite --save
input.css
CSS file:@import "flowbite/src/themes/default";
@plugin "flowbite/plugin";
@source "../../node_modules/flowbite";
app.blade.php
layout file:<body>
@yield('content')
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/flowbite.min.js"></script>
</body>
This will have the JavaScript loaded in all the files that extend this main layout.
Now that you have successfully installed the project you can start using the UI components from Flowbite and Tailwind CSS to develop modern websites and web applications.
We recommend exploring the components using the search bar navigation (cmd
or ctrl
+ k
) or by browsing the components section of the sidebar on the left side of this page.