App Navbar
In-app top navigation bars — brand, primary links, search, notifications and a user avatar menu.
Preview
@props([
'brand' => 'Acme',
'links' => null,
'userName' => 'Jane Smith',
'userInitials' => 'JS',
'userSrc' => null,
'notifyCount' => 3,
])
@php
$links ??= [
['label' => 'Dashboard', 'href' => '#', 'active' => true],
['label' => 'Projects', 'href' => '#', 'active' => false],
['label' => 'Tasks', 'href' => '#', 'active' => false],
['label' => 'Reports', 'href' => '#', 'active' => false],
];
$notifyLabel = $notifyCount > 0
? __(':count unread notifications', ['count' => $notifyCount])
: __('Notifications');
@endphp
<nav aria-label="{{ __('Main') }}" {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
<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="md: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>
<x-ui.brand href="#" :label="__($brand)" class="shrink-0" aria-label="{{ __(':brand home', ['brand' => $brand]) }}">
<x-slot:icon>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />
</svg>
</x-slot:icon>
</x-ui.brand>
<nav aria-label="{{ __('Primary') }}" class="ms-4 hidden items-center gap-2 md:flex">
@foreach ($links as $link)
<a
href="{{ $link['href'] }}"
@class([
'rounded-md px-4 py-2 text-sm font-medium transition-colors',
'bg-muted text-foreground' => $link['active'] ?? false,
'text-muted-foreground hover:bg-muted/50 hover:text-foreground' => ! ($link['active'] ?? false),
])
@if ($link['active'] ?? false) aria-current="page" @endif
>{{ __($link['label']) }}</a>
@endforeach
</nav>
</div>
<div class="flex items-center gap-2">
<x-ui.input-group class="hidden w-56 lg:flex">
<x-ui.input-group.addon><svg 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.input-group.addon>
<x-ui.input-group.input type="search" :placeholder="__('Search…')" aria-label="{{ __('Search') }}" />
</x-ui.input-group>
<div class="relative">
<x-ui.button variant="ghost" size="icon" aria-label="{{ $notifyLabel }}">
<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 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" /><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0" />
</svg>
</x-ui.button>
@if ($notifyCount > 0)
<x-ui.badge variant="destructive" size="sm" class="pointer-events-none absolute -end-1 -top-1 flex size-5 items-center justify-center rounded-full p-0" aria-hidden="true">{{ $notifyCount > 99 ? '99+' : $notifyCount }}</x-ui.badge>
@endif
</div>
<x-ui.button variant="ghost" class="flex items-center gap-2 px-2" aria-label="{{ __('Account menu for :name', ['name' => $userName]) }}">
<x-ui.avatar :src="$userSrc" :alt="$userName" :fallback="$userInitials" size="sm" />
<span class="hidden text-sm font-medium text-foreground sm:inline">{{ $userName }}</span>
<svg class="size-4 text-muted-foreground" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m6 9 6 6 6-6" />
</svg>
</x-ui.button>
</div>
</div>
</div>
</nav>
Installation
php artisan ui:add blocks/app-navbar-default
Registry contract
Install confidence
php artisan ui:add blocks/app-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.0.5
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/app-navbar-default.blade.php |
Registry dependencies
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.
# Brok UI block: App Navbar (`app-navbar-default`)
An in-app top navigation bar with a brand mark, primary links, a search field, a notification button with a count badge and a user avatar menu.
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/app-navbar-default
```
## Render it
```blade
<x-blocks.app-navbar-default />
```
## Props
- `brand` (string, default `Acme`)
- `links` (mixed|null, default `null`)
- `user-name` (string, default `Jane Smith`)
- `user-initials` (string, default `JS`)
- `user-src` (mixed|null, default `null`)
- `notify-count` (int, default `3`)
## Use when
- Topping an authenticated application with a brand mark, primary nav links, a search field, notifications and a user avatar menu.
- Showing an unread-notification count badge next to the bell icon.
## Avoid when
- Use app-navbar-search for a search-first command bar, or app-navbar-tabs for a two-row navbar with a section-tab bar.
## Rules
- Render the installed block with `<x-blocks.app-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/app-navbar-default
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/app-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
- Topping an authenticated application with a brand mark, primary nav links, a search field, notifications and a user avatar menu.
- Showing an unread-notification count badge next to the bell icon.
Avoid when
- Use app-navbar-search for a search-first command bar, or app-navbar-tabs for a two-row navbar with a section-tab bar.
Anti-patterns
- Do not replace semantic props with conflicting utility classes.
- Do not remove labels, focus styles, or state attributes.
Usage
Render the block as a component, passing data where useful:
<x-blocks.app-navbar-default />
Built from primitives
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.
@props([
'brand' => 'Acme',
'links' => null,
'userName' => 'Jane Smith',
'userInitials' => 'JS',
'userSrc' => null,
'notifyCount' => 3,
])
@php
$links ??= [
['label' => 'Dashboard', 'href' => '#', 'active' => true],
['label' => 'Projects', 'href' => '#', 'active' => false],
['label' => 'Tasks', 'href' => '#', 'active' => false],
['label' => 'Reports', 'href' => '#', 'active' => false],
];
$notifyLabel = $notifyCount > 0
? __(':count unread notifications', ['count' => $notifyCount])
: __('Notifications');
@endphp
<nav aria-label="{{ __('Main') }}" {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
<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="md: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>
<x-ui.brand href="#" :label="__($brand)" class="shrink-0" aria-label="{{ __(':brand home', ['brand' => $brand]) }}">
<x-slot:icon>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2" />
</svg>
</x-slot:icon>
</x-ui.brand>
<nav aria-label="{{ __('Primary') }}" class="ms-4 hidden items-center gap-2 md:flex">
@foreach ($links as $link)
<a
href="{{ $link['href'] }}"
@class([
'rounded-md px-4 py-2 text-sm font-medium transition-colors',
'bg-muted text-foreground' => $link['active'] ?? false,
'text-muted-foreground hover:bg-muted/50 hover:text-foreground' => ! ($link['active'] ?? false),
])
@if ($link['active'] ?? false) aria-current="page" @endif
>{{ __($link['label']) }}</a>
@endforeach
</nav>
</div>
<div class="flex items-center gap-2">
<x-ui.input-group class="hidden w-56 lg:flex">
<x-ui.input-group.addon><svg 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.input-group.addon>
<x-ui.input-group.input type="search" :placeholder="__('Search…')" aria-label="{{ __('Search') }}" />
</x-ui.input-group>
<div class="relative">
<x-ui.button variant="ghost" size="icon" aria-label="{{ $notifyLabel }}">
<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 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" /><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0" />
</svg>
</x-ui.button>
@if ($notifyCount > 0)
<x-ui.badge variant="destructive" size="sm" class="pointer-events-none absolute -end-1 -top-1 flex size-5 items-center justify-center rounded-full p-0" aria-hidden="true">{{ $notifyCount > 99 ? '99+' : $notifyCount }}</x-ui.badge>
@endif
</div>
<x-ui.button variant="ghost" class="flex items-center gap-2 px-2" aria-label="{{ __('Account menu for :name', ['name' => $userName]) }}">
<x-ui.avatar :src="$userSrc" :alt="$userName" :fallback="$userInitials" size="sm" />
<span class="hidden text-sm font-medium text-foreground sm:inline">{{ $userName }}</span>
<svg class="size-4 text-muted-foreground" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m6 9 6 6 6-6" />
</svg>
</x-ui.button>
</div>
</div>
</div>
</nav>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.0.5 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0