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, so
composer require jml/brok does not resolve. Until it is published, install it from a local
Composer path (or VCS) repository pointed at
packages/ui — see Pre-launch install.
The hosted registry at https://brokui.dev/r/open is live and is the package default, so
ui:list / ui:add need no BROK_REGISTRY_URL override.
Requirements
- Laravel — any supported version; the installer reads
app()->version()and reports it at setup time. - Tailwind CSS v4 — detected via
package.jsondependencies,tailwind.config.js/tailwind.config.ts, or the stringtailwindcssanywhere in your CSS entrypoint (e.g.@import 'tailwindcss'). - Vite — detected via
vite.config.js/vite.config.tsor aviteentry inpackage.json. The installer wires imports automatically when a standard entrypoint is found. - Alpine.js 3.x — required by interactive components (dialog, dropdown, tabs, …); Blade-only components work without it. Detected via
package.json, reported at install time, and recorded inui.json. - Livewire (optional) — detected via
composer.lockorcomposer.json; recorded inui.json.
Quick start
Require the package
Pull the runtime package into your Laravel application with Composer.
Until jml/brok is on Packagist, use the pre-launch install below instead.
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.
php artisan ui:install
Add your first component
Install a component from the registry. Files are copied into your project
and are immediately editable. The local service provider compiles the
<brok:*> tags; rendering never calls the registry.
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.
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:
{
"require": {
"jml/brok": "^0.2"
},
"repositories": {
"brok": {
"type": "path",
"url": "../../packages/ui",
"options": { "versions": { "jml/brok": "0.2.4" } }
}
}
}
Adjust url to the relative or absolute path to packages/ui
from your app, then install:
composer require jml/brok:^0.2
php artisan ui:install
Once the package is published, the path repository is no longer needed — the install collapses to the
composer require jml/brok quick-start above.
Registry endpoint
The CLI reads the hosted registry at https://brokui.dev/r/open by default.
Set BROK_REGISTRY_URL only to point at a self-hosted mirror or a locally built
apps/docs-registry serving /r/open:
# Optional — only for a self-hosted or local registry
BROK_REGISTRY_URL=http://localhost:8080/r/open
Prerequisite details
-
Tailwind CSS 4.x is required. Brok ships
v4-only design-token CSS. Tailwind v3, v5, or an unconfirmable version renders copied components
unstyled.
ui:installandui:doctorwarn loudly when v4 cannot be confirmed — see the Tailwind upgrade guide.ui:doctoris advisory on a fresh project and fails once components are actually installed against a non-v4 Tailwind. -
Alpine.js 3.x 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 callsAlpine.start(),ui:installwarns and can wire the bootstrap for you:Or add the three bootstrap lines yourself if you prefer to control your entrypoint:terminalnpm install alpinejs php artisan ui:install --alpineresources/js/app.jsimport 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.tsor avitepackage dependency. - Dark mode —
dark:utilities, a.darkselector,prefers-color-scheme, or adarkModekey in a Tailwind config. - Alpine —
alpinejsinpackage.jsondependencies. - Livewire —
livewire/livewireincomposer.lockorcomposer.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.
Use block and page tags
<brok:*> and <x-ui.*> components need no setup.
To use an installed block or page as <x-blocks.hero-centered> or
<x-pages.app-shell-inset>, register the anonymous component path once in
AppServiceProvider::boot(). Livewire views work the same way.
use Illuminate\Support\Facades\Blade;
public function boot(): void
{
Blade::anonymousComponentPath(resource_path('views'));
}
The prefixed form, Blade::anonymousComponentPath(resource_path('views/blocks'), 'blocks') and the same for
pages, gives <x-blocks::name> tags instead.
@include('blocks.name') works without any registration.
php artisan ui:doctor warns when the path is missing.
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.