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
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
Basic usage
Put your assets in head, the menu in nav and the page content in the default slot.
<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>
| Prop | Values |
|---|---|
title | Tab title; defaults to the application name |
brand-name | Name above the menu; defaults to config('app.name') |
brand-tagline | Small line below the name |
home-url | Link of the logo; defaults to url('/') |
Top bar
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.
<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>
| Prop | Values |
|---|---|
page-title | Page title on the left of the top bar |
theme-toggle | true | false |
User preferences
If you pass the user's saved preferences, the page opens with that look from the very first frame.
<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>
| Prop | Values |
|---|---|
mode | light | dark | system |
brand-color | default | green | red | yellow | blue | gray | dark | #rrggbb |
sidebar-mode | expanded | collapsed |
navbar-mode | fixed | static | hidden | null |
semi-dark | true | false | null |
preference-url | POST URL where the preferences are saved |
Theme switcher panel
With customizer on, a gear button on the right edge opens the theme switcher panel.
<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 …> --}}
| Prop | Values |
|---|---|
customizer | true | false |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
title | — | null | Tab title; defaults to the application name |
brand-name | — | config('app.name') | Brand name above the menu (when there is no wordmark slot) |
brand-tagline | — | null | Small line below the brand name |
home-url | — | url('/') | Link of the logo |
drawer-title | — | null | Title of the mobile drawer; defaults to brand-name |
page-title | — | null | Page title on the left of the top bar (when no heading slot is given) |
theme-toggle | boolean | true | The light/dark button in the top bar (zb:theme-switcher) |
mode | — | null | light · dark · system; when null, the preference in the browser |
theme | — | null | A color theme's key; when null, the current theme (the built-in light/dark) |
scope | — | null | The scope the choices are kept in, in the browser; when null, panel |
brand-color | — | null | default · green · red · yellow · blue · gray · dark · #rrggbb |
sidebar-mode | — | null | expanded · collapsed; when null, the preference in the browser |
navbar-mode | — | null | fixed · static · hidden; when null, the preference in the browser, or fixed if there is none |
preference-url | — | null | URL that the appearance preferences are POSTed to |
skin | — | null | default · bordered (no shadows, 1px borders) |
content-width | — | null | default (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 | — | null | Dark sidebar in light mode (data-theme="dark"); false turns it off, when null the preference in the browser |
customizer | boolean | false | The 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
Logo and wordmark
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.
<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>
Developer notes
- 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, orbrand-namewhen that is not given;drawerFooteris pinned to the bottom of the drawer. - Without a title, the search aligns to the left;
searchshows atmdand 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.
nullmeans "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:fixedkeeps the top bar in place,staticscrolls it with the content,hiddenhides it on wide screens (on phones and tablets it stays, since it holds the menu button); if nothing is saved anywhere,fixedis used.semi-darkwritesdata-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 thepanelscope and, withpreference-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.