App Header
In-app structural headers and footers — page and section headers, a searchable resource toolbar, and a form action footer.
Preview
@props([
'title' => 'Revenue overview',
'subtitle' => 'Track performance metrics for the current billing period.',
'stats' => null,
])
@php
$stats ??= [
['label' => 'Total revenue', 'value' => '$48,295', 'delta' => '+12.4%', 'up' => true],
['label' => 'Active users', 'value' => '3,841', 'delta' => '+5.7%', 'up' => true],
['label' => 'Churn rate', 'value' => '2.1%', 'delta' => '-0.3%', 'up' => false],
['label' => 'Avg. session', 'value' => '4m 32s', 'delta' => '+8.1%', 'up' => true],
];
@endphp
<header {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
<div class="mx-auto max-w-7xl px-4 py-6">
<div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
<div class="flex flex-col gap-2">
<h1 class="text-2xl font-bold text-foreground">{{ __($title) }}</h1>
@if ($subtitle)
<p class="text-sm text-muted-foreground">{{ __($subtitle) }}</p>
@endif
</div>
<div class="flex shrink-0 items-center gap-2">
<x-ui.button variant="ghost">
<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="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><polyline points="7 10 12 15 17 10" /><line x1="12" y1="15" x2="12" y2="3" /></svg>
</x-slot:icon>
{{ __('Export') }}
</x-ui.button>
<x-ui.button variant="default">
<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"><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
</x-slot:icon>
{{ __('Create') }}
</x-ui.button>
</div>
</div>
<dl class="mt-6 grid grid-cols-2 divide-x divide-y divide-border rounded-lg border border-border lg:grid-cols-4 lg:divide-y-0">
@foreach ($stats as $stat)
<div class="flex flex-col gap-2 p-4">
<dt class="truncate text-xs font-medium uppercase tracking-wide text-muted-foreground">{{ __($stat['label']) }}</dt>
<dd class="flex items-end justify-between gap-2">
<span class="text-2xl font-bold tabular-nums text-foreground">{{ $stat['value'] }}</span>
@if (! empty($stat['delta']))
<span class="mb-0.5 flex items-center gap-0.5 text-xs font-medium {{ $stat['up'] ? 'text-primary' : 'text-muted-foreground' }}">
<svg class="size-3 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
@if ($stat['up'])
<polyline points="18 15 12 9 6 15" />
@else
<polyline points="6 9 12 15 18 9" />
@endif
</svg>
<span>{{ $stat['delta'] }}</span>
</span>
@endif
</dd>
</div>
@endforeach
</dl>
</div>
</header>
Installation
php artisan ui:add blocks/app-header-page-stats
Registry contract
Install confidence
php artisan ui:add blocks/app-header-page-stats
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.3
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/app-header-page-stats.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: Page Header Stats (`app-header-page-stats`)
An application page header with a title, subtitle and actions above an inline four-up KPI stat row with trend deltas.
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-header-page-stats
```
## Render it
```blade
<x-blocks.app-header-page-stats />
```
## Props
- `title` (string, default `Revenue overview`)
- `subtitle` (string, default `Track performance metrics for the current billing period.`)
- `stats` (mixed|null, default `null`)
## Use when
- Heading a dashboard page with a title, subtitle and actions above an inline four-up KPI stat row that shows trend deltas.
- Surfacing headline metrics (revenue, users, churn) directly under the page title rather than in a separate widget.
## Avoid when
- Use app-header-page for a header without KPI stats, or dashboard-widget-system for a standalone metrics card instead.
## Rules
- Render the installed block with `<x-blocks.app-header-page-stats />` 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-header-page-stats
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/app-header-page-stats.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
- Heading a dashboard page with a title, subtitle and actions above an inline four-up KPI stat row that shows trend deltas.
- Surfacing headline metrics (revenue, users, churn) directly under the page title rather than in a separate widget.
Avoid when
- Use app-header-page for a header without KPI stats, or dashboard-widget-system for a standalone metrics card instead.
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-header-page-stats />
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([
'title' => 'Revenue overview',
'subtitle' => 'Track performance metrics for the current billing period.',
'stats' => null,
])
@php
$stats ??= [
['label' => 'Total revenue', 'value' => '$48,295', 'delta' => '+12.4%', 'up' => true],
['label' => 'Active users', 'value' => '3,841', 'delta' => '+5.7%', 'up' => true],
['label' => 'Churn rate', 'value' => '2.1%', 'delta' => '-0.3%', 'up' => false],
['label' => 'Avg. session', 'value' => '4m 32s', 'delta' => '+8.1%', 'up' => true],
];
@endphp
<header {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
<div class="mx-auto max-w-7xl px-4 py-6">
<div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
<div class="flex flex-col gap-2">
<h1 class="text-2xl font-bold text-foreground">{{ __($title) }}</h1>
@if ($subtitle)
<p class="text-sm text-muted-foreground">{{ __($subtitle) }}</p>
@endif
</div>
<div class="flex shrink-0 items-center gap-2">
<x-ui.button variant="ghost">
<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="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><polyline points="7 10 12 15 17 10" /><line x1="12" y1="15" x2="12" y2="3" /></svg>
</x-slot:icon>
{{ __('Export') }}
</x-ui.button>
<x-ui.button variant="default">
<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"><line x1="12" y1="5" x2="12" y2="19" /><line x1="5" y1="12" x2="19" y2="12" /></svg>
</x-slot:icon>
{{ __('Create') }}
</x-ui.button>
</div>
</div>
<dl class="mt-6 grid grid-cols-2 divide-x divide-y divide-border rounded-lg border border-border lg:grid-cols-4 lg:divide-y-0">
@foreach ($stats as $stat)
<div class="flex flex-col gap-2 p-4">
<dt class="truncate text-xs font-medium uppercase tracking-wide text-muted-foreground">{{ __($stat['label']) }}</dt>
<dd class="flex items-end justify-between gap-2">
<span class="text-2xl font-bold tabular-nums text-foreground">{{ $stat['value'] }}</span>
@if (! empty($stat['delta']))
<span class="mb-0.5 flex items-center gap-0.5 text-xs font-medium {{ $stat['up'] ? 'text-primary' : 'text-muted-foreground' }}">
<svg class="size-3 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
@if ($stat['up'])
<polyline points="18 15 12 9 6 15" />
@else
<polyline points="6 9 12 15 18 9" />
@endif
</svg>
<span>{{ $stat['delta'] }}</span>
</span>
@endif
</dd>
</div>
@endforeach
</dl>
</div>
</header>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.0.3 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0