takielias/tablar
Tablar is a Laravel dashboard preset built on Tabler, featuring dark mode, dynamic menu generation, and ready-made layouts to speed up admin panel development. Supports Laravel 10/11/12 with versioned branches and quick setup.
Installation:
composer require takielias/tablar
Run the publisher to set up configurations and views:
php artisan vendor:publish --provider="Takielias\Tablar\TablarServiceProvider" --tag="tablar-config"
php artisan vendor:publish --provider="Takielias\Tablar\TablarServiceProvider" --tag="tablar-views"
Run Migrations:
php artisan migrate
First Use Case:
/dashboard to see the default dashboard.config/tablar.php under the menu key:
'menu' => [
[
'icon' => 'home',
'label' => 'Dashboard',
'route' => 'dashboard',
],
[
'icon' => 'users',
'label' => 'Users',
'route' => 'users.index',
'children' => [
[
'icon' => 'user-plus',
'label' => 'Create User',
'route' => 'users.create',
],
],
],
],
config/tablar.php – Customize menu, layout, and dark mode settings.resources/views/vendor/tablar/ – Override default layouts or components.routes/web.php – Define routes for your dashboard sections.Dynamic Menu Generation:
config/tablar.php to auto-generate the sidebar navigation.'menu' => [
[
'icon' => 'layout',
'label' => 'Layouts',
'route' => 'layouts.index',
'children' => [
['icon' => 'layout-canonical', 'label' => 'Canonical', 'route' => 'layouts.canonical'],
],
],
],
Tablar::menu()->add([
'icon' => 'settings',
'label' => 'Settings',
'route' => 'settings.index',
]);
Layout Customization:
resources/views/vendor/tablar/layouts/app.blade.php) to add custom headers, footers, or scripts.@stack('scripts') to push JavaScript assets:
@push('scripts')
<script src="{{ asset('js/custom.js') }}"></script>
@endpush
Dark Mode:
config/tablar.php:
'dark_mode' => true,
document.documentElement.classList.toggle('dark');
Livewire Integration:
tablar-card, tablar-table) in your Livewire views:
<x-tablar-card>
<x-slot name="title">Users</x-slot>
<livewire:users-table />
</x-tablar-card>
Authentication:
resources/views/auth/.App\Models\User model or AuthServiceProvider for role-based access.Adding a New Dashboard Section:
routes/web.php:
Route::get('/reports', [ReportController::class, 'index'])->name('reports.index');
config/tablar.php:
'menu' => [
[
'icon' => 'file-text',
'label' => 'Reports',
'route' => 'reports.index',
],
],
resources/views/reports/index.blade.php and extend the Tablar layout:
@extends('vendor.tablar.layouts.app')
@section('content')
<h1>Reports Dashboard</h1>
@endsection
Theming:
resources/css/app.css:
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
.dark .tablar-primary {
--tw-border-opacity: 1;
border-color: rgb(139 92 246 / var(--tw-border-opacity));
}
}
npm run dev
API-Driven Menus:
$dynamicMenu = Menu::where('user_id', auth()->id())->get()->toArray();
$mergedMenu = array_merge(config('tablar.menu'), $dynamicMenu);
Tablar::menu()->set($mergedMenu);
vite.config.js or webpack.mix.js includes Tablar’s CSS/JS:
mix.postCss('resources/css/app.css', 'public/css', [
require('tailwindcss'),
]);
Route::middleware(['auth', 'tablar'])->group(function () {
Route::get('/dashboard', [DashboardController::class, 'index']);
});
resources/lang/en/tablar.php:
return [
'dashboard' => 'My Dashboard',
];
View Path Conflicts:
resources/views/tablar/), ensure your Blade templates extend the correct layout:
@extends('tablar::layouts.app') // Note the namespace
'views_path' => 'resources/views/tablar' in config/tablar.php.Dark Mode Toggle Issues:
// In a middleware or controller
if (request()->has('dark_mode')) {
session()->put('dark_mode', request('dark_mode') === 'true');
}
@if (session('dark_mode'))
<script>
document.documentElement.classList.add('dark');
</script>
@endif
Menu Item Highlighting:
active flag:
'menu' => [
[
'icon' => 'users',
'label' => 'Users',
'route' => 'users.index',
'active' => request()->is('users/*'),
'children' => [...],
],
],
Asset Compilation:
.dark, .tablar-*).@layer in your CSS to target specific Tailwind variants:
@layer components {
.dark .sidebar {
background-color: #1e293b;
}
}
Livewire Conflicts:
@livewireScripts
@stack('scripts')
Menu Not Updating:
php artisan config:clear
Dark Mode Not Applying:
<html> element to confirm the dark class is present.Blade Components Not Found:
<x-tablar::card> vs. <x-tablar-card>).resources/views/vendor/tablar/components directory.'sticky_header' => true,
How can I help you explore Laravel packages today?