Skip to content
Brok UI

Loading…

No results

App Navbar

Open source

In-app top navigation bars — brand, primary links, search, notifications and a user avatar menu.

Preview

resources/views/blocks/app-navbar-tabs.blade.php Blade
@props([
    'brand'        => 'Acme',
    'workspace'    => 'Marketing site',
    'tabs'         => null,
    'userName'     => 'Jane Smith',
    'userInitials' => 'JS',
    'userSrc'      => null,
    'notifyCount'  => 4,
])

@php
    $tabs ??= [
        ['label' => 'Overview', 'href' => '#', 'active' => true],
        ['label' => 'Activity', 'href' => '#', 'active' => false],
        ['label' => 'Settings', 'href' => '#', 'active' => false],
        ['label' => 'Members', 'href' => '#', 'active' => false],
    ];
    $notifyLabel = $notifyCount > 0 ? __(':count unread notifications', ['count' => $notifyCount]) : __('Notifications');
@endphp

<nav aria-label="{{ __('Main') }}" data-slot="app-navbar-tabs" {{ $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 min-w-0 items-center gap-4">
                <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"><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>
                @if ($workspace)
                    <span class="shrink-0 text-muted-foreground/40" aria-hidden="true">/</span>
                    <span class="truncate text-sm font-medium text-foreground">{{ __($workspace) }}</span>
                @endif
            </div>

            <div class="flex shrink-0 items-center gap-2">
                <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.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 shrink-0 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>

    <div class="mx-auto max-w-7xl px-4">
        <nav aria-label="{{ __('Section') }}" class="-mb-px flex gap-6 overflow-x-auto">
            @foreach ($tabs as $tab)
                <a href="{{ $tab['href'] }}" @class(['inline-flex shrink-0 items-center border-b-2 pb-4 pt-2 text-sm font-medium transition-colors', 'border-primary text-foreground' => $tab['active'] ?? false, 'border-transparent text-muted-foreground hover:border-border hover:text-foreground' => ! ($tab['active'] ?? false)]) @if ($tab['active'] ?? false) aria-current="page" @endif>{{ __($tab['label']) }}</a>
            @endforeach
        </nav>
    </div>
</nav>

Installation

terminal
php artisan ui:add blocks/app-navbar-tabs

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/app-navbar-tabs 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.4
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/app-navbar-tabs.blade.php

Registry dependencies

avatar badge brand button

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.

app-navbar-tabs.md
# Brok UI block: App Navbar Tabs (`app-navbar-tabs`)

A two-row in-app navbar — brand, notifications and user menu above an underlined section-tab bar.

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-tabs
```

## Render it

```blade
<x-blocks.app-navbar-tabs />
```

## Props

- `brand` (string, default `Acme`)
- `workspace` (string, default `Marketing site`)
- `tabs` (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 `4`)

## Use when

- Topping an application with a two-row navbar: brand, notifications and user menu on top, an underlined section-tab bar below.
- Showing which workspace or project is active via a breadcrumb-style label beside the brand mark.

## Avoid when

- Use app-navbar-default or app-navbar-search for a single-row navbar without a section-tab row.

## Rules

- Render the installed block with `<x-blocks.app-navbar-tabs />` 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-tabs
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/app-navbar-tabs.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 two-row navbar: brand, notifications and user menu on top, an underlined section-tab bar below.
  • Showing which workspace or project is active via a breadcrumb-style label beside the brand mark.

Avoid when

  • Use app-navbar-default or app-navbar-search for a single-row navbar without a section-tab row.

Anti-patterns

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

Usage

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

resources/views/welcome.blade.php Blade
<x-blocks.app-navbar-tabs />

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/app-navbar-tabs.blade.php Blade
@props([
    'brand'        => 'Acme',
    'workspace'    => 'Marketing site',
    'tabs'         => null,
    'userName'     => 'Jane Smith',
    'userInitials' => 'JS',
    'userSrc'      => null,
    'notifyCount'  => 4,
])

@php
    $tabs ??= [
        ['label' => 'Overview', 'href' => '#', 'active' => true],
        ['label' => 'Activity', 'href' => '#', 'active' => false],
        ['label' => 'Settings', 'href' => '#', 'active' => false],
        ['label' => 'Members', 'href' => '#', 'active' => false],
    ];
    $notifyLabel = $notifyCount > 0 ? __(':count unread notifications', ['count' => $notifyCount]) : __('Notifications');
@endphp

<nav aria-label="{{ __('Main') }}" data-slot="app-navbar-tabs" {{ $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 min-w-0 items-center gap-4">
                <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"><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>
                @if ($workspace)
                    <span class="shrink-0 text-muted-foreground/40" aria-hidden="true">/</span>
                    <span class="truncate text-sm font-medium text-foreground">{{ __($workspace) }}</span>
                @endif
            </div>

            <div class="flex shrink-0 items-center gap-2">
                <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.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 shrink-0 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>

    <div class="mx-auto max-w-7xl px-4">
        <nav aria-label="{{ __('Section') }}" class="-mb-px flex gap-6 overflow-x-auto">
            @foreach ($tabs as $tab)
                <a href="{{ $tab['href'] }}" @class(['inline-flex shrink-0 items-center border-b-2 pb-4 pt-2 text-sm font-medium transition-colors', 'border-primary text-foreground' => $tab['active'] ?? false, 'border-transparent text-muted-foreground hover:border-border hover:text-foreground' => ! ($tab['active'] ?? false)]) @if ($tab['active'] ?? false) aria-current="page" @endif>{{ __($tab['label']) }}</a>
            @endforeach
        </nav>
    </div>
</nav>

Ownership & lifecycle

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