esoboy / ui
Composable Blade components for Laravel 13 and Livewire 4.
Requires
- php: ^8.4
- bacon/bacon-qr-code: ^3.1
- illuminate/support: ^13.0
- illuminate/view: ^13.0
- livewire/blaze: ^1.0
- livewire/livewire: ^4.4
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Composable, zero-class Blade UI components for Laravel 13, Livewire 4, Alpine.js, and Tailwind CSS v4.
Features
- Blade-first &
@blazeready — Structural DOM rendered in Blade with zero internal Livewire components and zero global config files. - Zero-class CSS architecture — All component styles live in
@layer componentswith zero class selectors, zero hardcoded colors outsidetheme.css, and[data-slot]/data-*state attributes, so host Tailwind utilities override cleanly withouttailwind-merge. - Tailwind CSS v4
@theme defaulttokens — Customize surfaces, overlays, status colors, radii, shadows, and control heights directly in your host@theme, with pure@variant darkdark mode (no.darkclass assumption). - Zero-dependency Alpine plugin (
dist/ui.js) — Native<dialog>, Popover API, Livewire 4x-anchor/x-collapse, and lightweight step validation for<x-ui::questionnaire>. - Livewire 4 first-class form controls — Direct
wire:model*/x-modelablebinding across all controls (includingToggle,ToggleGroup,FileUpload, andEditor) with unifiedchangeevents, scoped<x-ui::field>FieldContextinheritance, and automatic Laravel$errorsinvalid state. - First-class Laravel integrations — Direct
paginate()/simplePaginate()/cursorPaginate()support inPaginationandDataTable, LivewireWithFileUploadsFileUpload, Blade-renderedMediaPreview, PHP-sideToast(Livewire & Session flash),bacon/bacon-qr-codeSVGQrCode, and on-demand standalone TiptapEditor(@assetsdata-navigate-once). - Laravel Boost ready — Ships with
resources/boost/guidelines/core.blade.phpandresources/boost/skills/esoboy-ui-development/for AI-assisted development.
Requirements
- PHP
^8.4 - Laravel
^13.0 - Livewire
^4.4 - Tailwind CSS
^4.0
Installation
composer require esoboy/ui
1. Import Styles (resources/css/app.css)
@import 'tailwindcss'; @import '../../vendor/esoboy/ui/dist/ui.css'; @custom-variant dark (&:where(.dark, .dark *));
Customize theme tokens directly in your host @theme. All 6 palettes (primary, neutral, info, success, warning, danger) use the same 8-role base → derived model: overriding the base seed (and optionally -foreground) automatically generates -hover, -active, -subtle, -subtle-hover, -border, and -text across both light and dark modes, while any derived token can still be overridden individually:
@theme { --color-primary: oklch(0.55 0.22 262); --color-primary-foreground: #ffffff; /* Optional: override a single derived role while keeping the rest auto-derived */ /* --color-primary-text: oklch(0.45 0.22 262); */ --radius-control: 0.5rem; }
2. Register Alpine Plugin (resources/js/app.js)
import '../../vendor/esoboy/ui/dist/ui.js'
dist/ui.js automatically registers all Alpine.data modules idempotently on alpine:init (or on an existing window.Alpine).
3. Optional: Publish Standalone Editor Assets
<x-ui::editor> loads its standalone editor.css and editor.js bundles on demand via a package asset route with content-hashed immutable caching. To serve them directly from public/vendor/esoboy/ui/:
php artisan vendor:publish --tag=ui-assets
Quick Start
Forms & Validation
<x-ui::field name="role" required> <x-ui::field.label>Role</x-ui::field.label> <x-ui::select wire:model="role" clearable> <x-ui::select.option value="admin">Administrator</x-ui::select.option> <x-ui::select.option value="editor">Editor</x-ui::select.option> </x-ui::select> <x-ui::field.description>Controls dashboard permissions.</x-ui::field.description> <x-ui::field.error /> </x-ui::field>
PHP-Side Toast Notifications
Place <x-ui::toaster /> once in your layout:
<x-ui::toaster position="bottom-right" />
Trigger, update, or dismiss toasts from Livewire 4 components or HTTP controllers:
use Esoboy\Ui\Support\Toast; // Inside a Livewire 4 component $id = Toast::to($this)->loading('Exporting report...', id: 'export'); Toast::to($this)->success('Report ready', id: $id); Toast::to($this)->dismiss($id); // Inside a controller before redirect Toast::success('Settings saved'); return redirect()->route('settings');
DataTable & Laravel Pagination
<x-ui::data-table wire:model="selected" persist="users-table"> <x-ui::data-table.filters collapsible default-collapsed clearable :active-count="$this->activeFilterCount" :collapsed-active-count="$this->collapsedFilterCount" > <x-slot:primary> <x-ui::input wire:model.live.debounce.300ms="search" size="sm" placeholder="Search users..." clearable /> </x-slot:primary> <x-slot:toolbar> <x-ui::data-table.column-toggle /> </x-slot:toolbar> <x-slot:collapsed> <x-ui::select wire:model.live="status" size="sm" placeholder="Status" clearable> <x-ui::select.option value="active">Active</x-ui::select.option> <x-ui::select.option value="inactive">Inactive</x-ui::select.option> </x-ui::select> </x-slot:collapsed> </x-ui::data-table.filters> <x-ui::data-table.table> <x-ui::data-table.columns> <x-ui::data-table.column-select pin="start" /> <x-ui::data-table.column name="name" sortable :sorted="$sortBy === 'name'" :direction="$sortDirection" wire:click="sort('name')">Name</x-ui::data-table.column> <x-ui::data-table.column name="status" hideable>Status</x-ui::data-table.column> </x-ui::data-table.columns> <x-ui::data-table.rows> @forelse ($this->users as $user) <x-ui::data-table.row :key="$user->id" wire:key="user-{{ $user->id }}"> <x-ui::data-table.cell-select :value="$user->id" pin="start" /> <x-ui::data-table.cell name="name">{{ $user->name }}</x-ui::data-table.cell> <x-ui::data-table.cell name="status"> <x-ui::badge :status="$user->active ? 'success' : 'neutral'"> {{ $user->active ? 'Active' : 'Inactive' }} </x-ui::badge> </x-ui::data-table.cell> </x-ui::data-table.row> @empty <x-ui::data-table.empty>No users found.</x-ui::data-table.empty> @endforelse </x-ui::data-table.rows> </x-ui::data-table.table> <x-ui::data-table.selection-bar select-all-action="selectAllMatching" :total="$this->users->total()"> <x-ui::button size="xs" status="danger" wire:click="deleteSelected">Delete Selected</x-ui::button> </x-ui::data-table.selection-bar> <x-ui::data-table.footer :paginator="$this->users" livewire> <x-ui::data-table.count /> <x-ui::data-table.page-rows wire:model.live="perPage" :options="$this->perPageOptions()" /> <x-ui::data-table.pagination jumpable /> </x-ui::data-table.footer> </x-ui::data-table> <x-ui::pagination :paginator="$posts" livewire />
File Upload
<x-ui::field name="attachments" required> <x-ui::field.label>Attachments</x-ui::field.label> <x-ui::file-upload wire:model="attachments" multiple accept="image/*,.pdf" max-size="5MB" :max-files="5" /> <x-ui::field.error /> </x-ui::field>
Design Contract
- Orthogonal
variant,status, andstate:variantis semantically named per component function with consistent naming across peer components (surface controls sharedefault/secondary/outline/ghost/link, tabs usedefault/line, sidebar usessidebar/floating/inset, etc.) and never encodes status colors;status(neutral,info,success,warning,danger) controls semantic color (Toggle,ToggleGroup, andItemdo not acceptstatus); workflow progression (Steps.Item,Trace) usesstate(data-state). - Unified
sizescale: Always uses ordered tokens (xs,sm,md,lg, etc. — defaultmd, withAlertDialogandSheetdefaulting tosm;ButtonGroupandDrawerdo not takesize; neverdefault/base/normal). File sizes on<x-ui::attachment>usefile-size. - Div-based triggers & close wrappers: All component triggers and overlay close/action wrappers (including
popover.close) render a<div>layout container so the host application controls the inner interactive elements freely without nested<button>conflicts. - Zero content processing:
<x-ui::rich-text>provides read-only typography styling only; host applications handle Markdown conversion and HTML sanitization.
License
Released under the MIT License.