App Navbar
In-app top navigation bars — brand, primary links, search, notifications and a user avatar menu.
Preview
@props([
'brand' => 'Acme',
'brandHref' => '#',
'newHref' => '#',
'notifyCount' => 5,
'userName' => 'Jane Smith',
'userInitials' => 'JS',
'userSrc' => null,
])
@php
$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 gap-4">
<x-ui.brand :href="$brandHref" :label="$brand" collapse 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"><path d="M12 2 2 7l10 5 10-5-10-5Z" /><path d="M2 17l10 5 10-5" /><path d="M2 12l10 5 10-5" /></svg>
</x-slot:icon>
</x-ui.brand>
<x-ui.input-group class="mx-auto w-full max-w-2xl flex-1">
<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 or jump to…')" aria-label="{{ __('Search or jump to a page') }}" />
<x-ui.input-group.addon align="inline-end"><x-ui.kbd>⌘K</x-ui.kbd></x-ui.input-group.addon>
</x-ui.input-group>
<div class="flex shrink-0 items-center gap-2 sm:gap-2">
<x-ui.button variant="default" size="sm" :href="$newHref" aria-label="{{ __('New') }}">
<x-slot:icon><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"><path d="M12 5v14M5 12h14" /></svg></x-slot:icon>
<span class="hidden sm:inline">{{ __('New') }}</span>
</x-ui.button>
<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 tabular-nums" aria-hidden="true">{{ $notifyCount > 99 ? '99+' : $notifyCount }}</x-ui.badge>
@endif
</div>
<x-ui.avatar :src="$userSrc" :alt="$userName" :fallback="$userInitials" size="sm" />
</div>
</div>
</div>
</nav>
Installation
php artisan ui:add blocks/app-navbar-search
Registry contract
Install confidence
php artisan ui:add blocks/app-navbar-search
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.6
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/app-navbar-search.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 Search (`app-navbar-search`)
An in-app top bar built around a prominent command/search field, with a brand mark, a New action, notifications and a user avatar.
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-search
```
## Render it
```blade
<x-blocks.app-navbar-search />
```
## Props
- `brand` (string, default `Acme`)
- `brand-href` (string, default `#`)
- `new-href` (string, default `#`)
- `notify-count` (int, default `5`)
- `user-name` (string, default `Jane Smith`)
- `user-initials` (string, default `JS`)
- `user-src` (mixed|null, default `null`)
## Use when
- Topping an application with a prominent command/search field as the primary focus, alongside a brand mark and a New action.
- Keeping notifications and the user avatar menu at the end of the bar while the search field takes the centre.
## Avoid when
- Use app-navbar-default for a link-first navbar, or app-navbar-tabs for a two-row navbar with a section-tab bar.
## Rules
- Render the installed block with `<x-blocks.app-navbar-search />` 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-search
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/app-navbar-search.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 application with a prominent command/search field as the primary focus, alongside a brand mark and a New action.
- Keeping notifications and the user avatar menu at the end of the bar while the search field takes the centre.
Avoid when
- Use app-navbar-default for a link-first navbar, 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-search />
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',
'brandHref' => '#',
'newHref' => '#',
'notifyCount' => 5,
'userName' => 'Jane Smith',
'userInitials' => 'JS',
'userSrc' => null,
])
@php
$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 gap-4">
<x-ui.brand :href="$brandHref" :label="$brand" collapse 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"><path d="M12 2 2 7l10 5 10-5-10-5Z" /><path d="M2 17l10 5 10-5" /><path d="M2 12l10 5 10-5" /></svg>
</x-slot:icon>
</x-ui.brand>
<x-ui.input-group class="mx-auto w-full max-w-2xl flex-1">
<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 or jump to…')" aria-label="{{ __('Search or jump to a page') }}" />
<x-ui.input-group.addon align="inline-end"><x-ui.kbd>⌘K</x-ui.kbd></x-ui.input-group.addon>
</x-ui.input-group>
<div class="flex shrink-0 items-center gap-2 sm:gap-2">
<x-ui.button variant="default" size="sm" :href="$newHref" aria-label="{{ __('New') }}">
<x-slot:icon><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"><path d="M12 5v14M5 12h14" /></svg></x-slot:icon>
<span class="hidden sm:inline">{{ __('New') }}</span>
</x-ui.button>
<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 tabular-nums" aria-hidden="true">{{ $notifyCount > 99 ? '99+' : $notifyCount }}</x-ui.badge>
@endif
</div>
<x-ui.avatar :src="$userSrc" :alt="$userName" :fallback="$userInitials" size="sm" />
</div>
</div>
</div>
</nav>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.0.6 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0