Flowbite Laravel Components is a complete Laravel package containing 60+ pre-built UI components. Following the Flowbite design system, it provides seamless integration with Tailwind CSS, Alpine.js, and Livewire.
Install the package via Composer:
composer require destech-hasar-cozumleri-a-s/larabite
The service provider will be automatically discovered (Laravel 5.5+).
php artisan vendor:publish --tag=flowbite-config
# Publish all components
php artisan vendor:publish --tag=flowbite-components
# Publish only views
php artisan vendor:publish --tag=flowbite-views
# Publish documentation
php artisan vendor:publish --tag=flowbite-docs
# Publish everything
php artisan vendor:publish --tag=flowbite-all
Add package paths to your tailwind.config.js:
module.exports = {
content: [
'./resources/**/*.blade.php',
'./resources/**/*.js',
'./vendor/destech-hasar-cozumleri-a-s/larabite/resources/**/*.blade.php',
],
theme: {
extend: {},
},
plugins: [
require('flowbite/plugin')
],
}
npm install alpinejs
In resources/js/app.js:
import Alpine from 'alpinejs'
window.Alpine = Alpine
Alpine.start()
<x-ui::button variant="primary" size="md">
Click Me
</x-ui::button>
<x-ui::card shadow="true">
<x-ui::typography.heading level="2">
Card Title
</x-ui::typography.heading>
<x-ui::typography.paragraph>
Card content goes here.
</x-ui::typography.paragraph>
</x-ui::card>
<x-ui::alert variant="success" dismissible="true">
Operation completed successfully!
</x-ui::alert>
Text-based components:
<x-ui::typography.heading level="1">Heading</x-ui::typography.heading>
<x-ui::typography.paragraph>Paragraph text</x-ui::typography.paragraph>
<x-ui::typography.text variant="lead">Lead text</x-ui::typography.text>
<x-ui::typography.blockquote>Quote</x-ui::typography.blockquote>
<x-ui::typography.list type="ordered">List</x-ui::typography.list>
<x-ui::typography.link href="#">Link</x-ui::typography.link>
<x-ui::typography.hr variant="default" />
General interface components:
{{-- Basic Components --}}
<x-ui::button variant="primary">Button</x-ui::button>
<x-ui::badge variant="success">Badge</x-ui::badge>
<x-ui::card>Card</x-ui::card>
<x-ui::alert variant="info">Alert</x-ui::alert>
<x-ui::avatar src="..." />
{{-- Navigation --}}
<x-ui::navbar />
<x-ui::breadcrumb />
<x-ui::tabs />
<x-ui::pagination />
{{-- Notifications --}}
<x-ui::toast type="success">Success!</x-ui::toast>
<x-ui::tooltip content="Help">Icon</x-ui::tooltip>
{{-- Media --}}
<x-ui::video type="youtube" src="..." />
<x-ui::gallery />
{{-- Data Display --}}
<x-ui::table />
<x-ui::timeline />
<x-ui::stepper />
<x-ui::progress value="75" />
Form elements with validation support:
<x-ui::form.input
label="Email"
type="email"
name="email"
required
/>
<x-ui::form.select
label="Category"
name="category"
:options="$categories"
/>
<x-ui::form.textarea
label="Description"
name="description"
rows="4"
/>
<x-ui::form.checkbox
label="I agree"
name="terms"
/>
<x-ui::form.toggle
label="Enable notifications"
name="notifications"
/>
<x-ui::form.datepicker
label="Select Date"
name="date"
/>
<x-ui::form.file-input
label="Upload File"
name="file"
accept="image/*"
/>
📖 Form Components Documentation
All components work seamlessly with Livewire:
<?php
namespace App\Livewire;
use Livewire\Component;
class UserProfile extends Component
{
public $name;
public $email;
public $showToast = false;
public function save()
{
$this->validate([
'name' => 'required',
'email' => 'required|email',
]);
// Save operation...
$this->showToast = true;
}
public function render()
{
return view('livewire.user-profile');
}
}
{{-- livewire/user-profile.blade.php --}}
<div>
<x-ui::card>
<form wire:submit.prevent="save">
<x-ui::form.input
label="Name"
wire:model="name"
/>
<x-ui::form.input
label="Email"
type="email"
wire:model="email"
/>
<x-ui::button type="submit" variant="primary">
Save
</x-ui::button>
</form>
</x-ui::card>
@if($showToast)
<x-ui::toast type="success">
Profile updated!
</x-ui::toast>
@endif
</div>
In config/flowbite-laravel.php:
return [
'prefix' => 'ui', // Component prefix
'defaults' => [
'button' => [
'variant' => 'primary',
'size' => 'md',
],
'card' => [
'shadow' => true,
'border' => true,
],
],
'dark_mode' => true, // Dark mode support
];
After publishing components, you can customize them in resources/views/components/ui/:
php artisan vendor:publish --tag=flowbite-components
In your .env file:
FLOWBITE_PREFIX=flowbite
Now you can use components like:
<x-flowbite.button>Button</x-flowbite.button>
<div x-data="{ open: false }">
<x-ui::button @click="open = true">
Open Modal
</x-ui::button>
<x-ui::modal
x-show="open"
@close="open = false"
title="Confirmation"
>
<p>Do you confirm this action?</p>
<x-slot:footer>
<x-ui::button
@click="open = false"
variant="outline"
>
Cancel
</x-ui::button>
<x-ui::button
variant="primary"
wire:click="confirm"
>
Confirm
</x-ui::button>
</x-slot:footer>
</x-ui::modal>
</div>
<x-ui::dropdown>
<x-slot:trigger>
<x-ui::button variant="outline">
Menu
<svg class="w-4 h-4 ml-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"/>
</svg>
</x-ui::button>
</x-slot:trigger>
<x-ui::dropdown.item href="/profile">
Profile
</x-ui::dropdown.item>
<x-ui::dropdown.item href="/settings">
Settings
</x-ui::dropdown.item>
<x-ui::dropdown.divider />
<x-ui::dropdown.item href="/logout">
Logout
</x-ui::dropdown.item>
</x-ui::dropdown>
<x-ui::table striped hover>
<x-ui::table.head>
<x-ui::table.row>
<x-ui::table.header sortable>Name</x-ui::table.header>
<x-ui::table.header>Email</x-ui::table.header>
<x-ui::table.header>Status</x-ui::table.header>
<x-ui::table.header>Actions</x-ui::table.header>
</x-ui::table.row>
</x-ui::table.head>
<x-ui::table.body>
@foreach($users as $user)
<x-ui::table.row>
<x-ui::table.cell>{{ $user->name }}</x-ui::table.cell>
<x-ui::table.cell>{{ $user->email }}</x-ui::table.cell>
<x-ui::table.cell>
<x-ui::badge :variant="$user->active ? 'success' : 'error'">
{{ $user->active ? 'Active' : 'Inactive' }}
</x-ui::badge>
</x-ui::table.cell>
<x-ui::table.cell>
<x-ui::button size="sm" variant="ghost">
Edit
</x-ui::button>
</x-ui::table.cell>
</x-ui::table.row>
@endforeach
</x-ui::table.body>
</x-ui::table>
<x-ui::tabs defaultTab="profile">
<x-ui::tabs.item id="profile" variant="underline">
Profile
</x-ui::tabs.item>
<x-ui::tabs.item id="settings" variant="underline">
Settings
</x-ui::tabs.item>
<x-ui::tabs.item id="billing" variant="underline">
Billing
</x-ui::tabs.item>
<x-ui::tabs.panel id="profile">
<p>Profile content</p>
</x-ui::tabs.panel>
<x-ui::tabs.panel id="settings">
<p>Settings content</p>
</x-ui::tabs.panel>
<x-ui::tabs.panel id="billing">
<p>Billing content</p>
</x-ui::tabs.panel>
</x-ui::tabs>
For detailed documentation:
php artisan vendor:publish --tag=flowbite-docs
After publishing, you can find it in the docs/flowbite/ directory.
For more examples, see the examples/ directory:
php artisan vendor:publish --tag=flowbite-examples
For all changes, see the CHANGELOG.md file.
We welcome your contributions! Please read CONTRIBUTING.md.
For security vulnerabilities, please read SECURITY.md.
MIT License. See LICENSE.md for details.
Developed with ❤️ by Destech Development Team.
How can I help you explore Laravel packages today?