Skip to content
UI Brok

Loading…

No results

Browse catalog

Installation

Require the runtime package with Composer, then run ui:install. The installer detects your Laravel version, Tailwind, Vite, Alpine, and Livewire setup, writes the asset entrypoints and configuration files into your project, and prints manual steps only when an automatic edit would be unsafe.

Warning

Pre-launch status. jml/brok is not on Packagist yet, and the hosted registry endpoint is not live yet. The composer require jml/brok flow below becomes valid once the package is published.

Until then, install via a local Composer path (or VCS) repository pointed at packages/ui, and set BROK_REGISTRY_URL to a reachable endpoint (for example a locally built apps/docs-registry serving /r/open) before running ui:list / ui:add. See Pre-launch install below.

Requirements

  • Laravel — any supported version; the installer reads app()->version() and reports it at setup time.
  • Tailwind CSS v4 — detected via package.json dependencies, tailwind.config.js / tailwind.config.ts, or the string tailwindcss anywhere in your CSS entrypoint (e.g. @import 'tailwindcss').
  • Vite — detected via vite.config.js / vite.config.ts or a vite entry in package.json. The installer wires imports automatically when a standard entrypoint is found.
  • Alpine.js (optional) — detected via package.json; reported at install time and recorded in ui.json.
  • Livewire (optional) — detected via composer.lock or composer.json; recorded in ui.json.

Quick start

Require the package (once published)

Once jml/brok is on Packagist, pull the runtime package into your Laravel application with Composer. Until then, use the pre-launch install below.

terminal
composer require jml/brok

Run the installer

The installer detects your stack, writes configuration and asset files, and wires @import './ui.css' and import './ui/index.js' into your CSS and JS entrypoints. If no standard entrypoint is found, it prints the two import lines and asks you to add them manually.

terminal
php artisan ui:install

Add your first component

Install a component from the registry. Files are copied into your project and are immediately editable — there is no runtime dependency on this system once the code is in your app.

terminal
php artisan ui:add button

See the CLI reference for browsing registry items with ui:list, installing Pro items, and reviewing updates safely.

Verify your setup

Run ui:doctor any time to check that the package is registered, all generated paths exist, and your Laravel project files look healthy.

terminal
php artisan ui:doctor

Pre-launch install

Because jml/brok is not on Packagist yet, point your app's composer.json at the package directory in this repo with a local path repository (this is exactly how apps/sandbox consumes it), then require it by name:

composer.json JSON
{
    "require": {
        "jml/brok": "^0.1"
    },
    "repositories": {
        "brok": {
            "type": "path",
            "url": "../../packages/ui",
            "options": { "versions": { "jml/brok": "0.1.0" } }
        }
    }
}

Adjust url to the relative or absolute path to packages/ui from your app, then install and run the CLI:

terminal
composer require jml/brok:^0.1
php artisan ui:install

The hosted registry is not live yet, so set BROK_REGISTRY_URL to a reachable endpoint (for example a locally built apps/docs-registry serving /r/open) before browsing or adding items:

.env
BROK_REGISTRY_URL=http://localhost:8080/r/open

Once the package is published and the default registry URL resolves, the path repository and BROK_REGISTRY_URL override are no longer needed — the install collapses to the composer require jml/brok quick-start above.

Prerequisite details

  • Tailwind CSS v4+ is required. Brok ships v4-only design-token CSS. Tailwind v3 (or an unconfirmable version) renders copied components unstyled. ui:install and ui:doctor warn loudly when v4 cannot be confirmed — see the Tailwind upgrade guide. ui:doctor is advisory on a fresh project and fails once components are actually installed against a non-v4 Tailwind.
  • Alpine.js is required for interactive components. Anything with an x-data="uiX(...)" (e.g. dialog, dropdown, tabs) needs Alpine; Blade-only components work without it. If Alpine isn't installed or your JS entrypoint never calls Alpine.start(), ui:install warns and can wire the bootstrap for you:
    terminal
    npm install alpinejs
    php artisan ui:install --alpine
    Or add the three bootstrap lines yourself if you prefer to control your entrypoint:
    resources/js/app.js JS
    import Alpine from 'alpinejs';
    window.Alpine = Alpine;
    Alpine.start();

What ui:install generates

Every file is written only if it does not already exist, so rerunning the command is always safe. Files that differ from the package template are flagged with a warning rather than overwritten.

File Purpose
ui.json Registry URLs, Blade prefix, CSS/JS paths, and feature flags (darkMode, alpine, livewire, rtl) derived from the detected stack.
ui-lock.json Commit this file. It tracks item/foundation versions, hashes, and compressed pristine bases so ui:update, ui:foundation, and ui:diff work on fresh clones and second machines.
resources/css/ui.css Design-token CSS — semantic color tokens, radius, typography, shadow, motion, and z-index scales for light/dark and admin/customer surfaces. Edit freely to re-theme the whole system. See Theming.
resources/js/ui/index.js JS entrypoint that imports component behaviour files as they are added. Automatically appended to by ui:add.
resources/views/components/ui/_styles.php Variant and size class maps shared by Blade components. Centralises all Tailwind class strings so the JIT scanner sees them.
.jml/cache Fast, disposable local copies of pristine upstream files. Portable merge bases live in ui-lock.json, so this directory does not need to be committed.
resources/views/components/ui/.gitkeep
resources/views/blocks/.gitkeep
Empty sentinels so the target directories exist in version control before any components are installed.

Stack detection

After writing files, the installer prints a two-column summary of everything it found:

  • Laravel — the running framework version.
  • Tailwind — presence in package.json, a config file, or the CSS entrypoint.
  • Vite — presence of vite.config.js / vite.config.ts or a vite package dependency.
  • Dark modedark: utilities, a .dark selector, prefers-color-scheme, or a darkMode key in a Tailwind config.
  • Alpinealpinejs in package.json dependencies.
  • Livewirelivewire/livewire in composer.lock or composer.json.

Detection results are recorded in ui.json under the features key so that future CLI commands (ui:add, ui:doctor) know what your project supports without re-scanning.

Warning

Rerunning ui:install is safe — existing files are never overwritten. If a file on disk differs from the package template (for example after a package upgrade), the installer will warn you but leave your version intact.

If your CSS or JS imports are missing, check that resources/css/app.css and resources/js/app.js exist at those exact paths — the installer looks for the standard Vite starter filenames. If your project uses different filenames, add the two import lines manually and rerun ui:install to confirm no other step was skipped.

Run php artisan ui:doctor after any environment change to get a full health report on paths, package registration, and expected project files.