v0.0.2
Demos (demo panel, opens in a new tab)

Appearance

Set up the panel layout, the menu, the colors, light/dark mode and the fonts here.

Note

The panel layouts, the JSON menu and the sign-in and error screens are in Zubazar UI Pro; colors, the mode, the theme switcher and the ⌘K search are in the free package (License).

Choosing a layout

A page opens in the layout named in its @extends line:

blade
@extends('layouts.admin.vertical')

@section('title', __('Reports'))

@section('content')
    <zb:page-header :title="__('Reports')" />
@endsection
Layout When
layouts.admin.vertical Vertical menu on the left; for most admin panels.
layouts.admin.horizontal Menu in the top bar; for apps with few main sections.
layouts.admin.blank No menu: sign-in, registration, password, error and maintenance screens.

On a Livewire page, set the layout with #[Layout('layouts.admin.vertical')] (Livewire page).

Layout files

text
resources/views/layouts/admin/
├── vertical.blade.php      <zb:layout.sidebar>
├── horizontal.blade.php    <zb:layout.horizontal>
├── blank.blade.php         <zb:layout.blank>
└── sections/
    ├── sidebar.blade.php   logo and menu
    ├── navbar.blade.php    search, language switcher, user menu
    └── footer.blade.php    footer

The section files fill the layout component's slots (what is a slot?). Change the logo, the user menu or the footer in the matching section file.

  • @yield('content') places a Blade page and $slot a Livewire page; the @vite line is in the head slot.
  • The tab title comes from @section('title'), or else from the #[Title] key, and is translated with __().
  • Slots: head, logo, wordmark, nav, mobileNav (horizontal), heading, search, actions (e.g. zb:locale-switcher), userMenu, drawerFooter, footer.
  • Props: title, brand-name, home-url, brand-tagline, customizer, theme-toggle, page-title, drawer-title, stacked (horizontal), preference-url and the appearance options. Details: Vertical layout, Horizontal layout.

Sign-in and error pages

Pages without a menu use the layouts.admin.blank layout. An error screen is drawn with zb:message-panel:

blade
@extends('layouts.admin.blank')

@section('content')
    <zb:message-panel code="404" :heading="__('Page not found')" :description="__('The page may have moved.')">
        <zb:slot:action><zb:button :href="route('dashboard')">{{ __('Back to the dashboard') }}</zb:button></zb:slot:action>
    </zb:message-panel>
@endsection

The other slots are media and illustration. For Laravel's error page, put the code in resources/views/errors/404.blade.php.

A sign-in screen is drawn with zb:auth-panel:

blade
<zb:auth-panel variant="basic" :home-url="route('home')">
    <zb:slot:logo><img src="/logo.svg" alt="Acme" class="h-8"></zb:slot:logo>
    <zb:auth-header :title="__('Welcome')" :description="__('Sign in to your account.')" />
    …form…
</zb:auth-panel>

variant="cover" (the default) shows an illustration on the left (the illustration slot) and the form on the right; basic shows the form in a single centered card.

Warning

Zubazar UI only provides the look; you build the sign-in and registration logic (your own controllers, or Fortify, Breeze). Fields: zb:input, zb:checkbox, zb:auth-session-status.

Your own layout

In your own layout, put zb:layout.head inside <head>: it applies the mode and the color before the first paint, so there is no white flash. zb:layout.blank gives only the document. Zubazar UI Pro also has zb:layout.auth, zb:layout.message and zb:layout.print for printing (receipts, invoices). Every layout prints @stack('page-scripts') at the end.

Page scrolling

In the panel the window scrolls and the sidebar stays put; while a modal is open the page behind is locked. In your own dialog, ZubazarUI.overlays.open(dialog, { close: closeDialog, trap: dialog }) sets up the lock, Esc, Tab and the focus return together; ZubazarUI.overlays.close(dialog) removes them. Just the lock: ZubazarUI.scrollLock.lock() / unlock().

Content width

The layout decides the page's width. The top bar, the content and the footer sit in the same container (.panel-container), so their edges line up. The gutter is 16 pixels on phones, 24 on tablets and 32 on desktops. Don't give your pages a limit of their own such as mx-auto max-w-7xl.

Value Look
full (the panel's default) The whole content area.
default At most 1280 pixels, centered (the store's default).
wide At most 1440 pixels, centered. The old boxed value is read as wide.
wider At most 1600 pixels, centered.
A CSS length A limit of your own: 1520px, 90rem, 92vw.

Any other value counts as default. The order: the value a page forces (Layout::page(['content_width' => 'wide'])), the layout's content-width prop, the user's choice in the theme switcher, and last layout.content_width in config/zubazar-ui.php. The value is written on <html> before the first paint (data-content-width="wide" or --zb-container-width), so the page doesn't shift.

Outside the panel the same container is the zb-container class or the <zb:container> component. A band keeps its full-width background and puts its content in the container:

blade
<header class="border-b border-line bg-surface">
    <zb:container class="flex h-16 items-center gap-3">…</zb:container>
</header>
<zb:container as="section" class="py-8">…</zb:container>

A form that should stay narrow keeps its own max-w-*. Grids in the container pick their columns by its width (@container). Don't use Tailwind's container class: it jumps at the breakpoints and doesn't know the sidebar.

The panel menu is a single JSON file: resources/menu/main.json. The vertical, horizontal and mobile menus and the ⌘K search are built from it.

json
{
    "menu": [
        { "section": "General" },
        { "title": "Dashboard", "icon": "home", "route": "dashboard" },
        { "title": "Customers", "icon": "users", "route": "customers.index", "active": "customers.*" }
    ]
}

To add a page, add a line for its named route; "active": "customers.*" keeps the item active on the detail page too. Titles are translation keys: put "Customers": "Müşteriler" in lang/tr.json (Localization).

Field What it does Example
section A section heading; top level only. "section": "Records"
title The item's text (a translation key). "title": "Customers"
icon An zb:icon name (Heroicons). "icon": "users"
route A route name; if it isn't defined, the link becomes #. "route": "customers.index"
params The route parameters. "params": { "user": 1 }
url A URL instead of a route. "url": "/reports/2025"
active The pages where it appears active: a route or /path pattern, * wildcard, an array for several. "active": "customers.*"
badge A number or a short label; true on a group shows the child count. "badge": "New"
target _blank opens a new tab. "target": "_blank"
children Child items; at most three levels. "children": [ … ]
  • url accepts only http, https, mailto, tel and in-app URLs; anything else becomes # (in every link prop of the kit as well). Write another site with https://.
  • Without active, an item is active only on its own page.
  • An item with children is a group that opens and closes. Empty sections and groups are hidden; unknown fields are ignored.
json
{ "title": "Reports", "icon": "chart-bar", "route": "reports.index", "active": ["reports.*", "/exports/*"] },
{ "title": "Documentation", "icon": "book-open", "url": "https://example.com/docs", "target": "_blank" },
{ "title": "Archive", "icon": "archive-box", "badge": true, "children": [
    { "title": "Sales", "route": "archive.sales" },
    { "title": "Years", "children": [ { "title": "2025", "url": "/archive/2025" } ] }
] }

Authorization

The menu doesn't check permissions. Filter the definition by role in PHP:

php
$items = json_decode(file_get_contents(resource_path('menu/main.json')), true)['menu'];
$items = array_values(array_filter($items, fn ($item) => ($item['title'] ?? '') !== 'Users' || auth()->user()->isAdmin()));

$menu = \Zubazar\Panel\Menu::resolve($items);

Warning

Hiding an item doesn't protect the page. Protect the routes with middleware or policies as well.

The layout file reads the menu at the top and the section files draw it:

blade
@php($menu = \Zubazar\Panel\Menu::fromFile('main'))

<zb:slot:nav><zb:menu :menu="$menu" /></zb:slot:nav>
<zb:slot:search><zb:command-palette :items="$menu->searchItems()" /></zb:slot:search>

The horizontal layout's top bar uses <zb:menu :menu="$menu" horizontal />; the sections prop gathers the sections into dropdowns (auto: with more than six items). zb:menu takes a file name, a file path, an array or a Menu object.

Multiple menus

Each menu is its own file under resources/menu/, e.g. customer.json for the customer panel: Menu::fromFile('customer'). If the horizontal menu should differ, create horizontal.json; otherwise both layouts share one file.

The definition can also be an array, e.g. from the database: Menu::resolve(['menu' => $account->menu_items]); URLs such as javascript: are still never drawn. To change items before they are drawn, pass transform; isActive lets you decide the active item (returning null falls back to the default rule):

php
$menu = new \Zubazar\Panel\Menu($items,
    transform: fn (array $item) => ($item['route'] ?? null) === 'tickets.index' ? [...$item, 'badge' => $openTicketCount] : $item,
);

You can also write the menu by hand instead of JSON: zb:nav.heading, zb:nav.item, zb:nav.group… (Menu items). In a hand-written menu, wrap items in @can.

Command palette

zb:command-palette is the search in the top bar; it opens with ⌘K or Ctrl+K. Its props: items (each with label, href, group, hint), placeholder, empty and shortcut="false", which turns the shortcut off. Add pages that aren't in the menu:

blade
<zb:command-palette :items="[...$menu->searchItems(), ['label' => __('Help'), 'href' => route('help'), 'group' => __('Other')]]" />

It also opens on the command-palette-open event.

Colors

Every color name is a Tailwind color; the current theme gives its value. Use them in your own markup too, no dark: needed:

blade
<div class="rounded-sm bg-surface p-4 shadow-sm">
    <h3 class="font-semibold text-ink">Pending orders</h3>
    <p class="text-sm text-muted">Last 30 days</p>
    <span class="rounded-sm bg-success-tint px-2 text-success-tint-ink">Delivered</span>
</div>
Name For
page, surface The page background (give it to <body> in your own layout); cards, menus, popovers.
field, sunken, hover, track, inverse Form fields; sunken areas such as table headers; hover; progress tracks; tooltips.
line, line-soft, line-strong, control Borders and dividers; the checkbox border.
ink, body, dim, muted, faint Headings, body, secondary text, hints; faint only for decorative icons.

The semantic colors are primary, secondary, success, info, warning, danger, dark and accent. Each has the same names: bg-primary (fill), hover:bg-primary-hover, text-on-primary (text on the fill), text-primary-ink (links), bg-primary-tint and bg-primary-soft (light backgrounds), text-primary-tint-ink (text on them), border-primary-line. Opacity suffixes work: border-line/80. All values: Colors.

Changing the primary color

Every primary shade, the focus ring and the links derive from --zb-tone-primary:

css
/* resources/css/app.css, after the @import lines */
@layer base {
    :root, [data-theme] {
        --zb-tone-primary: #0f766e;
    }
}

The others work the same way: --zb-tone-success, --zb-tone-danger… The user's chosen color comes first.

Light and dark mode

The mode is light, dark or system, which follows the device. layout.mode sets the default and the user changes it with the theme switcher. The choice is written as <html data-theme="dark"> before the first paint.

Making one part dark or light

data-theme can go on any element; the components inside take that theme's colors:

blade
<aside data-theme="dark" class="bg-surface p-4">
    <zb:button>New order</zb:button>
</aside>

data-theme doesn't paint the background; add bg-surface or bg-page. It nests, and the nearest one applies. In a sector theme, write the theme's own dark member: data-theme="{{ \Zubazar\Ui\Support\Appearance::dark() }}".

Appearance in JavaScript

Alpine has $store.appearance (value, set('dark'), toggle()) and $store.brand (set('green'), forget()). Without Alpine, ZubazarUI.appearance gives the same choices:

js
ZubazarUI.appearance.get();               // mode, brandColor, skin, contentWidth, navbarMode, sidebarCollapsed, semiDark
ZubazarUI.appearance.setMode('dark');     // setBrandColor, setSkin, setContentWidth, setSemiDark, setSidebarCollapsed, setNavbarMode, reset
const stop = ZubazarUI.appearance.subscribe((choices, changed) => console.log(changed));

In charts, use ZubazarUI.isDark(element) and ZubazarUI.tokenColor(element, '--zb-line') (returns rgb()).

The user's color

The user picks the primary color in the theme switcher: a preset or their own #rrggbb.

Preset Value
default The theme's own color (#794dff in the built-in theme).
green · red · yellow · blue #008933 · #d83838 · #9f6b13 · #038197
gray · dark #6b7280 · #3f404d

Readability is taken care of (at least 4.5:1). layout.brand_color sets the app's default and the layout's brand-color prop the color saved on the account.

Appearance options

The panel layouts take these props; write them on the <zb:layout.sidebar> tag:

Prop What it does
mode light, dark or system.
brand-color A preset name or #rrggbb.
skin="bordered" Thin lines instead of shadows.
content-width default, wide, wider, full or a CSS length (Content width).
semi-dark In light mode, only the sidebar is dark.
sidebar-mode="collapsed" The menu shrinks to 72 pixels and opens on hover.
navbar-mode fixed, static or hidden (hidden on wide screens).
customizer The theme switcher panel on the right edge.
theme-toggle The light/dark button in the top bar; false removes it.
scope Where the choices are kept; panel by default.

semi-dark, sidebar-mode and navbar-mode exist only in the vertical layout.

Theme switcher

The mode, the color and (in Zubazar UI Pro) the theme are in one component:

blade
<zb:theme-switcher />                                     {{-- button --}}
<zb:theme-switcher as="drawer" />                         {{-- right-edge panel --}}
<zb:theme-switcher as="inline" :sections="['color']" />   {{-- color only --}}

Every option: Theme switcher.

Default settings

Set the app's defaults once in config/zubazar-ui.php:

php
'layout' => [
    'mode' => 'system',       // light | dark | system
    'theme' => null,          // null: built-in light/dark
    'brand_color' => 'blue',
    'skin' => 'bordered',     // default | bordered
    'content_width' => null,  // default | wide | wider | full | 1520px
    'customizer' => true,
],

Priority: the value a page forces (Layout::page()), the user's preference (the layout prop or the value kept in the browser), config/zubazar-ui.php, the package default. Reset to default goes back to this file's values. If the file is missing, create it with php artisan vendor:publish --tag=zubazar-ui-config (Every key).

Settings for a single page

blade
@php(\Zubazar\Ui\Support\Layout::page(['sidebar_mode' => 'collapsed', 'navbar_mode' => 'static']))

Call it in Blade, in a controller or in Livewire's mount(). The keys are the same as in config/zubazar-ui.php; an unknown one throws an error. The value applies only to this request.

Saving the choices

Choices are kept in the browser per scope (localStorage['zubazar-ui:{scope}']): the panel uses panel, the store shop, other pages app; the panel and the store don't affect each other. For a scope of your own, pass scope="customer".

To keep them across devices, pass preference-url; every change is posted there as JSON: { "mode": "dark" }, { "brand": "blue" }, { "sidebar": "collapsed" }, { "navbar": "static" }, { "skin": "bordered" }, { "content": "wide" }, { "semiDark": true }.

blade
<zb:layout.sidebar :mode="auth()->user()?->theme_mode" :preference-url="route('preferences.update')" …>

You write the route and the saving. Pass a preference that isn't saved yet as null, not with ?? 'fixed'; otherwise the browser's choice is overridden.

Sector themes

Zubazar UI Pro's ready-made site looks; e-commerce has Nova, Vivid, Atelier and Volt. A theme changes only the look; the tags stay the same. Each theme is a pair: nova and nova-dark.

  1. List the themes in themes in config/zubazar-ui-pro.php (default ['nova', 'atelier', 'vivid', 'volt']).
  2. Run php artisan zubazar:themes; it writes resources/css/zb-themes.css and resources/js/zb-themes.js. Your CSS needs @import './zb-themes.css'; after Zubazar UI. When the list changes, run it again and rebuild.
  3. Choose the theme: in the store, commerce.theme (SHOP_THEME), see Choosing a theme.

Your own color theme

Define the theme once and give its values in CSS:

php
// AppServiceProvider::boot()
\Zubazar\Ui\Support\Appearance::define('ocean', 'ocean', 'ocean-dark', ['light' => '#f4f8fb']);
css
@layer base {
    :is([data-theme='ocean'], [data-theme='ocean-dark']) { --zb-tone-primary: #0e7490; }
    [data-theme='ocean'] { --zb-page: #f4f8fb; }
    [data-theme='ocean-dark'] { --zb-page: #071318; --zb-surface: #0d1d24; }
}

To choose it: 'theme' => 'ocean' in config/zubazar-ui.php, theme="ocean" on a layout, or Appearance::use('ocean') for one request.

Names use lower-case letters, digits and hyphens; the dark member's name ends in dark (light, dark, system, default are reserved). Write only the values that differ; the rest are derived. The fourth argument is the backgrounds the user's color is measured against. Check that text reads at 4.5:1.

Changing a component

Classes you pass with class are added to the component's own. When two classes of the same kind clash (e.g. two backgrounds), add ! to make yours win:

blade
<zb:card class="border-2 border-primary-line bg-sunken!">…</zb:card>
<zb:input name="code" input-class="h-12 font-mono" />

On a form field, input-class styles the field itself and replaces the kit's class of the same kind; no ! needed.

To change the markup, copy the component file from the package, with the same name, into resources/views/vendor/zubazar-ui/components/ui/ (for Zubazar UI Pro components, vendor/zubazar-ui-pro/components/ui/). E.g. a copy of button.blade.php replaces <zb:button>.

Warning

A copy doesn't get package updates. After updating, compare it with the package's version.

Fonts and corners

css
@layer base {
    :root, [data-theme] {
        --zb-font-sans: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
        --zb-radius: 0.5rem;
    }
}

The defaults are Public Sans (text) and DM Mono (code, numbers). Others: --zb-font-mono, --zb-font-display (headings), --zb-font-brand (the logo lettering), --zb-radius-check (checkbox). Loading a new font: Fonts.

Focus ring

The focus ring uses the primary color's tone. If the primary color is red, separate it so it isn't confused with the error ring (at least 3:1):

css
:root { --zb-tone-focus: #2563eb; }

Troubleshooting

  • The color didn't change: npm run dev must be running, or run npm run build. Your block must come after the @import lines, inside @layer base.
  • A dark part's background stays light: data-theme doesn't paint the background; add bg-surface. Write data-theme="dark", not class="dark".
  • A sector theme looks unstyled: run php artisan zubazar:themes and rebuild.
  • Menu file not found: fromFile('main') looks for resources/menu/main.json. On a JSON error (e.g. a trailing comma) reading stops.
  • A link becomes #: the route name isn't defined, or url uses an unsafe scheme.
  • An item doesn't look active: add e.g. customers.* to active.

Learn more

Zubazar UI · ZubazarDesigned for people.