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

Vertical layout

The panel layout with a menu on the left; as the application's main Blade layout it draws the whole page.

zb:layout.sidebar zubazar/ui-pro

PRO

This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →

Basic usage

BLADE

Put your assets in head, the menu in nav and the page content in the default slot.

blade
<zb:layout.sidebar :title="$title ?? null" brand-name="Zubazar Panel" brand-tagline="Store Management" :home-url="route('dashboard')">
    <zb:slot:head>
        <link rel="icon" href="/favicon.svg" type="image/svg+xml">
        @vite(['resources/css/app.css', 'resources/js/app.js'])
    </zb:slot:head>
    <zb:slot:nav><zb:menu menu="main" /></zb:slot:nav>

    {{ $slot }}
</zb:layout.sidebar>
PropValues
titleTab title; defaults to the application name
brand-nameName above the menu; defaults to config('app.name')
brand-taglineSmall line below the name
home-urlLink of the logo; defaults to url('/')

Top bar

BLADE

The top bar holds page-title or the heading slot on the left, search in the middle, and actions, the light/dark button and userMenu on the right.

blade
<zb:layout.sidebar page-title="Sales report">
    <zb:slot:search>
        <zb:command-palette :items="$searchItems" />
    </zb:slot:search>

    <zb:slot:actions>
        <zb:button variant="ghost" size="icon" aria-label="Notifications" title="Notifications">
            <zb:icon name="bell" />
        </zb:button>
    </zb:slot:actions>

    <zb:slot:userMenu>
        <zb:user-menu :name="auth()->user()->name">
            <zb:dropdown.item :href="route('profile.edit')" wire:navigate>Settings</zb:dropdown.item>
        </zb:user-menu>
    </zb:slot:userMenu>

    {{ $slot }}
</zb:layout.sidebar>
PropValues
page-titlePage title on the left of the top bar
theme-toggletrue | false

User preferences

BLADE

If you pass the user's saved preferences, the page opens with that look from the very first frame.

blade
<zb:layout.sidebar
    brand-name="Zubazar Panel"
    :mode="auth()->user()?->theme_mode"
    :brand-color="auth()->user()?->brand_color"
    :sidebar-mode="auth()->user()?->sidebar_mode"
    :navbar-mode="auth()->user()?->navbar_mode"
    :semi-dark="auth()->user()?->semi_dark"
    :preference-url="route('ui-preference.update')"
>
    {{ $slot }}
</zb:layout.sidebar>
PropValues
modelight | dark | system
brand-colordefault | green | red | yellow | blue | gray | dark | #rrggbb
sidebar-modeexpanded | collapsed
navbar-modefixed | static | hidden | null
semi-darktrue | false | null
preference-urlPOST URL where the preferences are saved

Theme switcher panel

Theme switcher panel: view
BLADE

With customizer on, a gear button on the right edge opens the theme switcher panel.

blade
<p class="text-sm text-muted">Press the gear button on the right edge to open the panel.</p>
<zb:theme-switcher as="drawer" :sections="['mode', 'color', 'skin', 'width', 'sidebar', 'navbar']" />

{{-- In the layout: <zb:layout.sidebar customizer …> --}}
PropValues
customizertrue | false

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
title—nullTab title; defaults to the application name
brand-name—config('app.name')Brand name above the menu (when there is no wordmark slot)
brand-tagline—nullSmall line below the brand name
home-url—url('/')Link of the logo
drawer-title—nullTitle of the mobile drawer; defaults to brand-name
page-title—nullPage title on the left of the top bar (when no heading slot is given)
theme-togglebooleantrueThe light/dark button in the top bar (zb:theme-switcher)
mode—nulllight · dark · system; when null, the preference in the browser
theme—nullA color theme's key; when null, the current theme (the built-in light/dark)
scope—nullThe scope the choices are kept in, in the browser; when null, panel
brand-color—nulldefault · green · red · yellow · blue · gray · dark · #rrggbb
sidebar-mode—nullexpanded · collapsed; when null, the preference in the browser
navbar-mode—nullfixed · static · hidden; when null, the preference in the browser, or fixed if there is none
preference-url—nullURL that the appearance preferences are POSTed to
skin—nulldefault · bordered (no shadows, 1px borders)
content-width—nulldefault (1280px) · wide (1440px) · wider (1600px) · full · a CSS length (1520px); boxed is wide. The top bar, the page and the footer share one container; null: the browser's choice, then config, then full
semi-dark—nullDark sidebar in light mode (data-theme="dark"); false turns it off, when null the preference in the browser
customizerbooleanfalseThe theme switcher panel on the right edge

Slots: head, logo (a square mark, about 30 pixels: it stays alone when the menu is collapsed), wordmark (the text beside the mark), nav, heading, search, actions, userMenu, drawerFooter, default (page content)

Advanced

2 examples

Logo and wordmark

BLADE

If your logo is a mark and a wordmark, pass the mark to the logo slot and the wordmark (e.g. an SVG) to wordmark; the wordmark is drawn in place of brand-name and brand-tagline. When the menu is collapsed only the mark remains, and brand-name is still used as the mobile drawer's title.

blade
<zb:layout.sidebar brand-name="Zubazar Panel" :home-url="route('dashboard')">
    <zb:slot:logo><img src="/logo-icon.svg" alt="" class="size-[1.875rem]"></zb:slot:logo>
    <zb:slot:wordmark><img src="/logo-text.svg" alt="Zubazar Panel" class="h-[1.875rem] w-auto"></zb:slot:wordmark>

    {{-- … --}}
</zb:layout.sidebar>

Bordered look and dark menu

BLADE

skin="bordered" removes the shadows and draws cards and bars with a 1px border. semi-dark shows only the sidebar dark in light mode; :semi-dark="false" turns the dark menu off even if it was left on in the browser.

blade
<zb:layout.sidebar brand-name="Zubazar Panel" skin="bordered" semi-dark>
    {{ $slot }}
</zb:layout.sidebar>
PropValues
skindefault | bordered
semi-darktrue | false | null

Developer notes

Events, hooks and details
  • The layout renders the whole document, from the <html> tag to the </body> tag; use it on its own in the application's main Blade layout.
  • @livewireScripts, notifications (zb:toast-container) and the form guard dialog are already included in the layout.
  • The sidebar is collapsed with the button at its top; while collapsed, it opens temporarily on mouse hover.
  • The drawer title is drawer-title, or brand-name when that is not given; drawerFooter is pinned to the bottom of the drawer.
  • Without a title, the search aligns to the left; search shows at md and up. To remove the light/dark button (<zb:theme-switcher />), pass :theme-toggle="false".
  • A preference passed to the layout always takes precedence over the choice stored in the browser. null means "not saved": the choice in the browser is used, or the default if there is none; do not pass a separate default for users without a saved value.
  • With preference-url, the new value is POSTed to this URL whenever the user changes the look (details on the Head page).
  • navbar-mode: fixed keeps the top bar in place, static scrolls it with the content, hidden hides it on wide screens (on phones and tablets it stays, since it holds the menu button); if nothing is saved anywhere, fixed is used.
  • semi-dark writes data-theme="dark" on the menu; when omitted, the choice in the browser is used.
  • The panel (<zb:theme-switcher as="drawer">) offers the mode, primary color, card style, content width, menu and top bar; choices apply right away, are kept in the browser under the panel scope and, with preference-url, are saved to the account. Details are on the Theme switcher page.
  • In the example the panel is used on its own; the menu and top bar options have no effect here.
Zubazar UI · ZubazarDesigned for people.