Skip to content
Brok UI

Loading…

No results

App Header

Open source

In-app structural headers and footers — page and section headers, a searchable resource toolbar, and a form action footer.

Preview

4 of 5

resources/views/blocks/app-header-footer.blade.php Blade
@props([
    'status'      => 'saved',
    'currentStep' => null,
    'totalSteps'  => null,
    'cancelLabel' => 'Cancel',
    'saveLabel'   => 'Save changes',
    'deleteLabel' => 'Delete',
    'showDelete'  => false,
    'cancelHref'  => null,
])

@php
    $statusConfig = [
        'saved' => ['icon' => 'check', 'label' => __('All changes saved'), 'class' => 'text-primary'],
        'saving' => ['icon' => 'spinner', 'label' => __('Saving…'), 'class' => 'text-muted-foreground'],
        'error' => ['icon' => 'warning', 'label' => __('Could not save changes'), 'class' => 'text-destructive'],
        'step' => [
            'icon' => 'step',
            'label' => ($currentStep !== null && $totalSteps !== null)
                ? __('Step :current of :total', ['current' => $currentStep, 'total' => $totalSteps])
                : __('Step'),
            'class' => 'text-muted-foreground',
        ],
    ];

    $current = $statusConfig[$status] ?? $statusConfig['saved'];
@endphp

<footer data-slot="section-footer" {{ $attributes->merge(['class' => 'border-t border-border bg-card']) }}>
    <div class="mx-auto max-w-5xl px-4 py-4">
        <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
            <div class="flex shrink-0 items-center">
                @if ($showDelete)
                    <x-ui.button variant="ghost" type="button" class="w-full text-destructive hover:text-destructive sm:w-auto">
                        <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">
                                <polyline points="3 6 5 6 21 6" /><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" /><path d="M10 11v6M14 11v6" /><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" />
                            </svg>
                        </x-slot:icon>
                        {{ __($deleteLabel) }}
                    </x-ui.button>
                @endif
            </div>

            <div class="flex min-w-0 flex-1 items-center justify-start gap-2 sm:justify-center">
                @if ($current['icon'] === 'check')
                    <svg class="size-4 shrink-0 {{ $current['class'] }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" /><polyline points="22 4 12 14.01 9 11.01" />
                    </svg>
                @elseif ($current['icon'] === 'warning')
                    <svg class="size-4 shrink-0 {{ $current['class'] }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" /><line x1="12" y1="9" x2="12" y2="13" /><line x1="12" y1="17" x2="12.01" y2="17" />
                    </svg>
                @elseif ($current['icon'] === 'step' && $currentStep !== null && $totalSteps !== null)
                    <span class="flex items-center gap-2" aria-hidden="true">
                        @for ($i = 1; $i <= (int) $totalSteps; $i++)
                            <span class="block size-2 rounded-full {{ $i === (int) $currentStep ? 'bg-primary' : 'bg-muted-foreground/30' }}"></span>
                        @endfor
                    </span>
                @endif
                <span class="truncate text-sm {{ $current['class'] }}">{{ $current['label'] }}</span>
            </div>

            <div class="flex shrink-0 items-center justify-end gap-2">
                @if ($cancelHref)
                    <x-ui.button variant="ghost" :href="$cancelHref" class="w-full sm:w-auto">{{ __($cancelLabel) }}</x-ui.button>
                @else
                    <x-ui.button variant="ghost" type="button" class="w-full sm:w-auto">{{ __($cancelLabel) }}</x-ui.button>
                @endif
                <x-ui.button variant="default" type="submit" class="w-full sm:w-auto">{{ __($saveLabel) }}</x-ui.button>
            </div>
        </div>
    </div>
</footer>

Installation

terminal
php artisan ui:add blocks/app-header-footer

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/app-header-footer 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-footer.blade.php

Registry dependencies

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-header-footer.md
# Brok UI block: Section Footer (`app-header-footer`)

A form or section footer action bar with a save-status indicator or step dots, an optional destructive action, and cancel and save buttons that stack on mobile.

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

## Render it

```blade
<x-blocks.app-header-footer />
```

## Props

- `status` (string, default `saved`)
- `current-step` (mixed|null, default `null`)
- `total-steps` (mixed|null, default `null`)
- `cancel-label` (string, default `Cancel`)
- `save-label` (string, default `Save changes`)
- `delete-label` (string, default `Delete`)
- `show-delete` (bool, default `false`)
- `cancel-href` (mixed|null, default `null`)

## Use when

- Closing a form or settings section with a save-status indicator (saved, saving, error) or step dots, plus cancel and save buttons.
- Offering an optional destructive delete action alongside the cancel and save buttons, stacked on mobile.

## Avoid when

- Use app-header-page or app-header-section to head a page or section; app-header-footer is a footer action bar, not a header.

## Rules

- Render the installed block with `<x-blocks.app-header-footer />` 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-footer
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/app-header-footer.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

  • Closing a form or settings section with a save-status indicator (saved, saving, error) or step dots, plus cancel and save buttons.
  • Offering an optional destructive delete action alongside the cancel and save buttons, stacked on mobile.

Avoid when

  • Use app-header-page or app-header-section to head a page or section; app-header-footer is a footer action bar, not a header.

Anti-patterns

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

Usage

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

resources/views/welcome.blade.php Blade
<x-blocks.app-header-footer />

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-header-footer.blade.php Blade
@props([
    'status'      => 'saved',
    'currentStep' => null,
    'totalSteps'  => null,
    'cancelLabel' => 'Cancel',
    'saveLabel'   => 'Save changes',
    'deleteLabel' => 'Delete',
    'showDelete'  => false,
    'cancelHref'  => null,
])

@php
    $statusConfig = [
        'saved' => ['icon' => 'check', 'label' => __('All changes saved'), 'class' => 'text-primary'],
        'saving' => ['icon' => 'spinner', 'label' => __('Saving…'), 'class' => 'text-muted-foreground'],
        'error' => ['icon' => 'warning', 'label' => __('Could not save changes'), 'class' => 'text-destructive'],
        'step' => [
            'icon' => 'step',
            'label' => ($currentStep !== null && $totalSteps !== null)
                ? __('Step :current of :total', ['current' => $currentStep, 'total' => $totalSteps])
                : __('Step'),
            'class' => 'text-muted-foreground',
        ],
    ];

    $current = $statusConfig[$status] ?? $statusConfig['saved'];
@endphp

<footer data-slot="section-footer" {{ $attributes->merge(['class' => 'border-t border-border bg-card']) }}>
    <div class="mx-auto max-w-5xl px-4 py-4">
        <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
            <div class="flex shrink-0 items-center">
                @if ($showDelete)
                    <x-ui.button variant="ghost" type="button" class="w-full text-destructive hover:text-destructive sm:w-auto">
                        <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">
                                <polyline points="3 6 5 6 21 6" /><path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" /><path d="M10 11v6M14 11v6" /><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" />
                            </svg>
                        </x-slot:icon>
                        {{ __($deleteLabel) }}
                    </x-ui.button>
                @endif
            </div>

            <div class="flex min-w-0 flex-1 items-center justify-start gap-2 sm:justify-center">
                @if ($current['icon'] === 'check')
                    <svg class="size-4 shrink-0 {{ $current['class'] }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" /><polyline points="22 4 12 14.01 9 11.01" />
                    </svg>
                @elseif ($current['icon'] === 'warning')
                    <svg class="size-4 shrink-0 {{ $current['class'] }}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" /><line x1="12" y1="9" x2="12" y2="13" /><line x1="12" y1="17" x2="12.01" y2="17" />
                    </svg>
                @elseif ($current['icon'] === 'step' && $currentStep !== null && $totalSteps !== null)
                    <span class="flex items-center gap-2" aria-hidden="true">
                        @for ($i = 1; $i <= (int) $totalSteps; $i++)
                            <span class="block size-2 rounded-full {{ $i === (int) $currentStep ? 'bg-primary' : 'bg-muted-foreground/30' }}"></span>
                        @endfor
                    </span>
                @endif
                <span class="truncate text-sm {{ $current['class'] }}">{{ $current['label'] }}</span>
            </div>

            <div class="flex shrink-0 items-center justify-end gap-2">
                @if ($cancelHref)
                    <x-ui.button variant="ghost" :href="$cancelHref" class="w-full sm:w-auto">{{ __($cancelLabel) }}</x-ui.button>
                @else
                    <x-ui.button variant="ghost" type="button" class="w-full sm:w-auto">{{ __($cancelLabel) }}</x-ui.button>
                @endif
                <x-ui.button variant="default" type="submit" class="w-full sm:w-auto">{{ __($saveLabel) }}</x-ui.button>
            </div>
        </div>
    </div>
</footer>

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