To use Flowbite in a current Laravel project, install the package with npm install flowbite, add three lines to resources/css/app.css, and add import 'flowbite'; to resources/js/app.js. New Laravel projects already ship with Tailwind CSS v4 and Vite, so there is no tailwind.config.js to edit. This guide walks through each step and a test component.
An earlier version of this tutorial used Laravel 8, Laravel Breeze and a tailwind.config.js file. That setup is for Tailwind v3 and no longer applies. Current Flowbite releases depend on Tailwind v4.
What you need
A Laravel project that uses Tailwind CSS v4 and Vite, and Node.js with npm. Laravel 12 and later include Tailwind v4 in new projects. You do not need a starter kit. Flowbite works with any Laravel, Tailwind and Vite setup.
To start a new project, use the Laravel installer:
laravel new my-projectIf your project does not have Tailwind v4 yet, install it with the Vite plugin:
npm install tailwindcss @tailwindcss/viteThen add the plugin to vite.config.js. Your Laravel plugin entry stays as it is:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
tailwindcss(),
],
});And make sure resources/css/app.css starts with:
@import "tailwindcss";Step 1: Install Flowbite
npm install flowbite --saveStep 2: Add Flowbite to your CSS
Add these lines to resources/css/app.css, below the Tailwind import:
@import "tailwindcss";
@import "flowbite/src/themes/default";
@plugin "flowbite/plugin";
@source "../../node_modules/flowbite";What each line does:
@import "flowbite/src/themes/default";loads Flowbite's default theme variables.@plugin "flowbite/plugin";registers the Flowbite plugin with Tailwind v4. This replaces therequire('flowbite/plugin')entry from the oldtailwind.config.js.@source "../../node_modules/flowbite";tells Tailwind to scan Flowbite's JavaScript for class names. The path is relative toresources/css/app.css, so it goes up two folders to reachnode_modules.
Keep any @source lines Laravel already put in the file for your Blade views.
Step 3: Import the Flowbite JavaScript
Flowbite's interactive components (accordions, dropdowns, modals) need its JavaScript. Add this to resources/js/app.js:
import 'flowbite';Then check that your layout loads both files through Vite, in the <head>:
@vite(['resources/css/app.css', 'resources/js/app.js'])Step 4: Test it with a component
Put this in any Blade view. The button tests the Tailwind and Flowbite styles, and the accordion tests the JavaScript:
<button type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5">
Flowbite button
</button>
<div id="accordion-collapse" data-accordion="collapse" class="mt-6">
<h2 id="accordion-heading-1">
<button type="button"
class="flex items-center justify-between w-full p-5 font-medium text-left border border-gray-200 rounded-lg"
data-accordion-target="#accordion-body-1"
aria-expanded="false"
aria-controls="accordion-body-1">
<span>What is Flowbite?</span>
</button>
</h2>
<div id="accordion-body-1" class="hidden" aria-labelledby="accordion-heading-1">
<div class="p-5 border border-gray-200">
<p>Flowbite is an open-source library of components built on top of Tailwind CSS.</p>
</div>
</div>
</div>Start the Vite dev server and the Laravel server in two terminals:
npm run dev
php artisan serveOpen the page. The button should be blue, and clicking the accordion heading should open and close the panel. For a production build, run npm run build.
Fixing common problems
The styles are missing
Check that npm run dev is running, that your layout includes the @vite line, and that the @source path in app.css matches where the file is. If you moved the CSS file, the number of ../ segments changes.
The components look right but do not open or close
The JavaScript is not loading. Confirm import 'flowbite'; is in resources/js/app.js and that resources/js/app.js is listed in the @vite directive. If your pages swap content without a full reload, for example with Livewire navigation or Turbo, import { initFlowbite } from 'flowbite' and call it after each navigation so new elements are initialised.
I get an error about tailwind.config.js or require("flowbite/plugin")
That is the Tailwind v3 setup. Remove the plugin from the config file and use the @plugin line in your CSS instead. If your project is still on Tailwind v3, upgrade to v4 first. Flowbite's quickstart has a section on moving from v3 to v4.
Frequently asked questions
Do I need Laravel Breeze or another starter kit?
No. Flowbite only needs Tailwind CSS and a way to bundle the CSS and JavaScript, which Laravel provides with Vite. A starter kit is optional.
Can I use the Flowbite CDN instead of npm?
Yes, Flowbite also provides a CDN build of its JavaScript. With npm and Vite, you get one bundled file and Tailwind only generates the CSS you use, so the npm route is the one to prefer in a Vite project.





