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

Phone menu

The phone and tablet menu that opens from the left: the logo, the product search, the pages, the categories, the light/dark mode button and the language.

zb:shop.mobile-menu zubazar/ui-pro

PRO

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

The menu and its button

The menu and its button: view
BLADE

<zb:shop.menu-button /> opens the drawer and <zb:shop.mobile-menu /> draws it; logo picks the logo's style.

blade
<zb:shop.menu-button />
<zb:shop.mobile-menu logo="default" />
PropValues
logodefault | modern | classic

In your own navbar

BLADE

If you do not use the store's navbar, add the button and the drawer to your own header; a page has a single <zb:shop.mobile-menu />.

blade
<header class="flex h-16 items-center gap-3 border-b border-line bg-bar px-4">
    <zb:shop.menu-button class="-ms-2" />
    <a href="{{ route('home') }}" aria-label="Home"><zb:shop.logo variant="modern" /></a>
    …
</header>

<zb:shop.mobile-menu logo="modern" />

{{-- With your own button --}}
<zb:drawer.trigger name="web-menu">
    <zb:button variant="white">Menu</zb:button>
</zb:drawer.trigger>

The menu's content

PHP

The drawer's pages come from menu(), its categories from categories() and its languages from languages().

php
public function menu(): array
{
    return [
        ['label' => 'New arrivals', 'url' => route('web.products.index', ['sort' => 'newest']), 'active' => request()->query('sort') === 'newest'],
        ['label' => 'Deals', 'url' => route('web.products.index', ['sale' => 1]), 'active' => request()->boolean('sale')],
    ];
}

public function languages(): array
{
    return ['en' => 'English', 'tr' => 'Türkçe'];
}
PropValues
menu()label, url, active
categories()Category: name, icon, url()
languages()code => name; with more than one, a language switcher

Props

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

PropTypeDefaultDescription
logo—defaultThe logo's style: default (Nova) · modern (Vivid) · classic (Atelier)

Developer notes

Events, hooks and details
  • The ready-made navbar presets use a drawer of their own instead, which drills down into the sub-menus.
  • The menu button is hidden on wide screens (lg); Esc or a click on the backdrop closes the drawer.
  • The drawer is named web-menu; the product search goes to the web.products.index route with q, and the mode button is <zb:theme-switcher />.
  • To open the drawer with another button, wrap that button in <zb:drawer.trigger name="web-menu">; the trigger adds aria-haspopup and an aria-expanded that follows the drawer.
  • The active page is highlighted in the primary colour and gets aria-current="page".
  • BaseStorefront gives Home, Products, Categories and Deals as the pages; a store with one language draws no language switcher.
Zubazar UI · ZubazarDesigned for people.