Search by

Composable Blade components for Laravel 13 and Livewire 4.

Package info

github.com/esoboy/ui

pkg:composer/esoboy/ui

Statistics

Installs: 41

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v2.0.0 2026-11-23 06:25 UTC

README

Composable, zero-class Blade UI components for Laravel 13, Livewire 4, Alpine.js, and Tailwind CSS v4.

Features

  • Blade-first & @blaze ready — 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 components with zero class selectors, zero hardcoded colors outside theme.css, and [data-slot] / data-* state attributes, so host Tailwind utilities override cleanly without tailwind-merge.
  • Tailwind CSS v4 @theme default tokens — Customize surfaces, overlays, status colors, radii, shadows, and control heights directly in your host @theme, with pure @variant dark dark mode (no .dark class assumption).
  • Zero-dependency Alpine plugin (dist/ui.js) — Native <dialog>, Popover API, Livewire 4 x-anchor / x-collapse, and lightweight step validation for <x-ui::questionnaire>.
  • Livewire 4 first-class form controls — Direct wire:model* / x-modelable binding across all controls (including Toggle, ToggleGroup, FileUpload, and Editor) with <x-ui::field> @aware context inheritance and automatic Laravel $errors invalid state.
  • First-class Laravel integrations — Direct paginate() / simplePaginate() / cursorPaginate() support in Pagination and DataTable, Livewire WithFileUploads FileUpload, Blade-rendered MediaPreview, PHP-side Toast (Livewire & Session flash), bacon/bacon-qr-code SVG QrCode, and on-demand standalone Tiptap Editor (@assets data-navigate-once).
  • Laravel Boost skills included — Ships with resources/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:

@theme {
    --color-primary: oklch(0.55 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 :columns="$columns" :rows="$users" selectable searchable column-toggle livewire>
    <x-slot:bulkActions>
        <x-ui::button size="xs" variant="outline" status="danger" x-on:click="$wire.deleteSelected(selected)">
            Delete Selected
        </x-ui::button>
    </x-slot:bulkActions>

    @foreach ($users as $user)
        <x-ui::data-table.row :key="$user->id" :search-text="$user->name">
            <x-ui::data-table.cell column="name">{{ $user->name }}</x-ui::data-table.cell>
            <x-ui::data-table.cell column="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>
    @endforeach
</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, and state: variant is semantically named per component function with consistent naming across peer components (surface controls share default/secondary/outline/ghost/link, tabs use default/line, sidebar uses sidebar/floating/inset, etc.) and never encodes status colors; status (neutral, info, success, warning, danger) controls semantic color; workflow progression (Steps.Item, Trace) uses state (data-state).
  • Unified size scale: Always uses ordered tokens (xs, sm, md, lg, etc. — default md, never default/base/normal). File sizes on <x-ui::attachment> use file-size.
  • Div-based triggers & close wrappers: All component triggers and overlay close/action wrappers 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.