Skip to content
Brok UI

Loading…

No results

Store Navbar

Open source

Storefront navigation bars — utility strip, category links, search and wishlist/account/cart actions with a cart count.

Preview

resources/views/blocks/store-navbar-default.blade.php Blade
@props([
    'brand'        => 'Storefront',
    'brandHref'    => '/',
    'showUtilBar'  => true,
    'utilMessage'  => 'Free shipping on orders over $50',
    'links'        => null,
    'cartCount'    => 3,
    'cartHref'     => '/cart',
    'wishlistHref' => '/wishlist',
    'accountHref'  => '/account',
    'searchAction' => '/search',
])

@php
    $links ??= [
        ['label' => 'Shop', 'href' => '/shop', 'sale' => false],
        ['label' => 'Men', 'href' => '/men', 'sale' => false],
        ['label' => 'Women', 'href' => '/women', 'sale' => false],
        ['label' => 'Collections', 'href' => '/collections', 'sale' => false],
        ['label' => 'Sale', 'href' => '/sale', 'sale' => true],
    ];
@endphp

<nav aria-label="{{ __('Store') }}" data-slot="store-navbar" {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
    @if ($showUtilBar)
        <div class="bg-muted py-2">
            <p class="text-center text-xs text-muted-foreground">{{ __($utilMessage) }}</p>
        </div>
    @endif

    <div class="mx-auto max-w-7xl px-4">
        <div class="flex h-16 items-center justify-between gap-4">
            <div class="flex items-center gap-2">
                <x-ui.button variant="ghost" size="icon" class="lg:hidden" aria-label="{{ __('Open menu') }}">
                    <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <line x1="4" y1="6" x2="20" y2="6" /><line x1="4" y1="12" x2="20" y2="12" /><line x1="4" y1="18" x2="20" y2="18" />
                    </svg>
                </x-ui.button>
                <a href="{{ $brandHref }}" class="text-lg font-bold text-foreground transition-colors hover:text-foreground/80" aria-label="{{ __(':brand home', ['brand' => $brand]) }}">{{ __($brand) }}</a>
            </div>

            <nav aria-label="{{ __('Categories') }}" class="hidden items-center gap-2 lg:flex">
                @foreach ($links as $link)
                    @if ($link['sale'])
                        <a href="{{ $link['href'] }}" class="inline-flex items-center gap-2 rounded-md px-4 py-2 text-sm font-medium text-link transition-colors hover:bg-muted">
                            {{ __($link['label']) }}
                            <x-ui.badge variant="default" size="sm">{{ __('-30%') }}</x-ui.badge>
                        </a>
                    @else
                        <a href="{{ $link['href'] }}" class="rounded-md px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-muted">{{ __($link['label']) }}</a>
                    @endif
                @endforeach
            </nav>

            <div class="flex items-center gap-2 sm:gap-2">
                <form method="GET" action="{{ $searchAction }}" role="search" class="relative hidden md:block">
                    <span class="pointer-events-none absolute inset-y-0 start-3 flex items-center text-muted-foreground" aria-hidden="true">
                        <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <circle cx="11" cy="11" r="8" /><path d="m21 21-4.35-4.35" />
                        </svg>
                    </span>
                    <x-ui.input type="search" name="q" class="w-48 ps-10 lg:w-64" :placeholder="__('Search products…')" aria-label="{{ __('Search products') }}" />
                </form>

                <x-ui.button variant="ghost" size="icon" class="md:hidden" :href="$searchAction" aria-label="{{ __('Search') }}">
                    <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <circle cx="11" cy="11" r="8" /><path d="m21 21-4.35-4.35" />
                    </svg>
                </x-ui.button>

                <x-ui.button variant="ghost" size="icon" :href="$wishlistHref" class="!hidden sm:!inline-flex" aria-label="{{ __('Wishlist') }}">
                    <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
                    </svg>
                </x-ui.button>

                <x-ui.button variant="ghost" size="icon" :href="$accountHref" class="!hidden sm:!inline-flex" aria-label="{{ __('Account') }}">
                    <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7" />
                    </svg>
                </x-ui.button>

                <x-ui.notification-badge :count="$cartCount">
                    <x-ui.button variant="ghost" size="icon" :href="$cartHref" aria-label="{{ __('Cart, :count items', ['count' => $cartCount]) }}">
                        <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z" /><line x1="3" y1="6" x2="21" y2="6" /><path d="M16 10a4 4 0 0 1-8 0" />
                        </svg>
                    </x-ui.button>
                </x-ui.notification-badge>
            </div>
        </div>
    </div>
</nav>

Installation

terminal
php artisan ui:add blocks/store-navbar-default

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/store-navbar-default writes only the generated targets below. The CLI validates each file hash before writing and prompts before replacing local changes unless --force is used.

Version
1.1.1
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/store-navbar-default.blade.php

Registry dependencies

button input badge notification-badge

Package dependencies

composer: jml/brok:^0.2

Use with AI

A brief for your coding agent: what the block is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this block in an assistant.

store-navbar-default.md
# Brok UI block: Store Navbar (`store-navbar-default`)

An e-commerce store navigation bar with a utility shipping strip, brand, category links with a sale badge, search, and wishlist, account and cart icons with a cart count.

Brok UI is a Laravel Blade registry. `ui:add` copies this block into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.

## Install

```bash
php artisan ui:add blocks/store-navbar-default
```

## Render it

```blade
<x-blocks.store-navbar-default />
```

## Props

- `brand` (string, default `Storefront`) — Brand name shown in the navbar.
- `brand-href` (string, default `/`) — Destination for the brand link.
- `show-util-bar` (bool, default `true`) — Toggles the utility shipping strip above the nav.
- `util-message` (string, default `Free shipping on orders over $50`) — Message shown in the utility strip.
- `links` (mixed|null, default `null`) — Category nav links, each optionally flagged as a sale link; null falls back to sample data.
- `cart-count` (int, default `3`) — Number shown on the cart badge.
- `cart-href` (string, default `/cart`) — Cart destination.
- `wishlist-href` (string, default `/wishlist`) — Wishlist destination.
- `account-href` (string, default `/account`) — Account destination.
- `search-action` (string, default `/search`) — Search form submission endpoint.

## Use when

- Building a standard ecommerce navbar with a utility shipping strip, category links, search, wishlist and cart icons.
- Using it as the default storefront header when a mega-menu is not needed.

## Avoid when

- Needing a mega-menu category flyout; use store-navbar-mega instead. Wanting a minimal centered layout; use store-navbar-minimal instead.

## Rules

- Render the installed block with `<x-blocks.store-navbar-default />` and pass data through its props; edit the copied file only for structural changes.
- Keep the semantic design tokens (`bg-background`, `text-muted-foreground`); never swap in raw colour utilities.
- Keep the `data-slot` attributes and the logical (start/end) spacing so the markup still mirrors under `dir="rtl"`.

## Links

- Docs: https://brokui.dev/blocks/store-navbar-default
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/store-navbar-default.json

Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.

Guidance

Use when

  • Building a standard ecommerce navbar with a utility shipping strip, category links, search, wishlist and cart icons.
  • Using it as the default storefront header when a mega-menu is not needed.

Avoid when

  • Needing a mega-menu category flyout; use store-navbar-mega instead. Wanting a minimal centered layout; use store-navbar-minimal instead.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
root store-navbar

Usage

Render the block as a component, passing data where useful:

resources/views/welcome.blade.php Blade
<x-blocks.store-navbar-default />

Built from primitives

Composes <brok:*> Semantic tokens Re-themeable RTL-ready

This block composes installed <brok:*> primitives and semantic design tokens only — it does not reimplement any primitive. Re-theme it (light, dark, admin, customer) by editing CSS variables; flip the preview to RTL to confirm it mirrors.

Source

The exact, editable file ui:add writes into your app. The preview above renders this same source — there are no preview-only blocks.

resources/views/blocks/store-navbar-default.blade.php Blade
@props([
    'brand'        => 'Storefront',
    'brandHref'    => '/',
    'showUtilBar'  => true,
    'utilMessage'  => 'Free shipping on orders over $50',
    'links'        => null,
    'cartCount'    => 3,
    'cartHref'     => '/cart',
    'wishlistHref' => '/wishlist',
    'accountHref'  => '/account',
    'searchAction' => '/search',
])

@php
    $links ??= [
        ['label' => 'Shop', 'href' => '/shop', 'sale' => false],
        ['label' => 'Men', 'href' => '/men', 'sale' => false],
        ['label' => 'Women', 'href' => '/women', 'sale' => false],
        ['label' => 'Collections', 'href' => '/collections', 'sale' => false],
        ['label' => 'Sale', 'href' => '/sale', 'sale' => true],
    ];
@endphp

<nav aria-label="{{ __('Store') }}" data-slot="store-navbar" {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
    @if ($showUtilBar)
        <div class="bg-muted py-2">
            <p class="text-center text-xs text-muted-foreground">{{ __($utilMessage) }}</p>
        </div>
    @endif

    <div class="mx-auto max-w-7xl px-4">
        <div class="flex h-16 items-center justify-between gap-4">
            <div class="flex items-center gap-2">
                <x-ui.button variant="ghost" size="icon" class="lg:hidden" aria-label="{{ __('Open menu') }}">
                    <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <line x1="4" y1="6" x2="20" y2="6" /><line x1="4" y1="12" x2="20" y2="12" /><line x1="4" y1="18" x2="20" y2="18" />
                    </svg>
                </x-ui.button>
                <a href="{{ $brandHref }}" class="text-lg font-bold text-foreground transition-colors hover:text-foreground/80" aria-label="{{ __(':brand home', ['brand' => $brand]) }}">{{ __($brand) }}</a>
            </div>

            <nav aria-label="{{ __('Categories') }}" class="hidden items-center gap-2 lg:flex">
                @foreach ($links as $link)
                    @if ($link['sale'])
                        <a href="{{ $link['href'] }}" class="inline-flex items-center gap-2 rounded-md px-4 py-2 text-sm font-medium text-link transition-colors hover:bg-muted">
                            {{ __($link['label']) }}
                            <x-ui.badge variant="default" size="sm">{{ __('-30%') }}</x-ui.badge>
                        </a>
                    @else
                        <a href="{{ $link['href'] }}" class="rounded-md px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-muted">{{ __($link['label']) }}</a>
                    @endif
                @endforeach
            </nav>

            <div class="flex items-center gap-2 sm:gap-2">
                <form method="GET" action="{{ $searchAction }}" role="search" class="relative hidden md:block">
                    <span class="pointer-events-none absolute inset-y-0 start-3 flex items-center text-muted-foreground" aria-hidden="true">
                        <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <circle cx="11" cy="11" r="8" /><path d="m21 21-4.35-4.35" />
                        </svg>
                    </span>
                    <x-ui.input type="search" name="q" class="w-48 ps-10 lg:w-64" :placeholder="__('Search products…')" aria-label="{{ __('Search products') }}" />
                </form>

                <x-ui.button variant="ghost" size="icon" class="md:hidden" :href="$searchAction" aria-label="{{ __('Search') }}">
                    <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <circle cx="11" cy="11" r="8" /><path d="m21 21-4.35-4.35" />
                    </svg>
                </x-ui.button>

                <x-ui.button variant="ghost" size="icon" :href="$wishlistHref" class="!hidden sm:!inline-flex" aria-label="{{ __('Wishlist') }}">
                    <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
                    </svg>
                </x-ui.button>

                <x-ui.button variant="ghost" size="icon" :href="$accountHref" class="!hidden sm:!inline-flex" aria-label="{{ __('Account') }}">
                    <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <circle cx="12" cy="8" r="4" /><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7" />
                    </svg>
                </x-ui.button>

                <x-ui.notification-badge :count="$cartCount">
                    <x-ui.button variant="ghost" size="icon" :href="$cartHref" aria-label="{{ __('Cart, :count items', ['count' => $cartCount]) }}">
                        <svg class="size-5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z" /><line x1="3" y1="6" x2="21" y2="6" /><path d="M16 10a4 4 0 0 1-8 0" />
                        </svg>
                    </x-ui.button>
                </x-ui.notification-badge>
            </div>
        </div>
    </div>
</nav>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.1.1
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0