Skip to content
Brok UI

Loading…

No results

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.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 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 in ui.json.
  • Livewire (optional) — detected via composer.lock or composer.json; recorded in ui.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.

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. The local service provider compiles the <brok:*> tags; rendering never calls the registry.

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.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:

terminal
composer require jml/brok:^0.2
terminal
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:

.env
# 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: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 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 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 mode — dark: utilities, a .dark selector, prefers-color-scheme, or a darkMode key in a Tailwind config.
  • Alpine — alpinejs in package.json dependencies.
  • Livewire — livewire/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.

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.

app/Providers/AppServiceProvider.php PHP
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.