Skip to content
Brok UI

Loading…

No results

Banner

Open source

Announcement bars — a slim dismissible top-of-page announcement on the primary surface, static or auto-rotating.

Preview

resources/views/blocks/banner-announcement.blade.php Blade
@props([
    'eyebrow'  => 'New',
    'message'  => 'We just shipped a major update to our component library.',
    'ctaLabel' => 'Read the changelog',
    'href'     => '#',
])

<div
    x-data="{ open: true }"
    x-show="open"
    role="region"
    aria-label="{{ __('Announcement') }}"
    data-slot="announcement-banner"
    {{ $attributes->merge(['class' => 'relative w-full bg-primary text-primary-foreground']) }}
>
    <div class="mx-auto max-w-7xl px-4 py-2 pe-12 sm:pe-14">
        <div class="flex flex-wrap items-center justify-center gap-x-4 gap-y-2 text-sm">
            <x-ui.badge class="shrink-0 border-primary-foreground/40 bg-transparent text-primary-foreground">{{ __($eyebrow) }}</x-ui.badge>

            <span class="text-primary-foreground">{{ __($message) }}</span>

            <a href="{{ $href }}" class="inline-flex shrink-0 items-center gap-x-2 font-medium underline decoration-primary-foreground/50 underline-offset-2 transition-colors hover:decoration-primary-foreground">
                {{ __($ctaLabel) }}
                <svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                    <path d="M5 12h14M13 6l6 6-6 6" />
                </svg>
            </a>
        </div>
    </div>

    <div class="absolute inset-y-0 end-2 flex items-center sm:end-4">
        <x-ui.button variant="ghost" size="icon" x-on:click="open = false" aria-label="{{ __('Dismiss') }}" class="text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground">
            <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="M18 6 6 18M6 6l12 12" />
            </svg>
        </x-ui.button>
    </div>
</div>

Installation

terminal
php artisan ui:add blocks/banner-announcement

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

badge button

Package dependencies

composer: jml/brok:^0.2

npm: alpinejs

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.

banner-announcement.md
# Brok UI block: Announcement Banner (`banner-announcement`)

A slim full-width announcement bar with an eyebrow pill, a message, an inline call-to-action link and an end-aligned dismiss button on the primary surface.

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/banner-announcement
```

## Render it

```blade
<x-blocks.banner-announcement />
```

## Props

- `eyebrow` (string, default `New`)
- `message` (string, default `We just shipped a major update to our component library.`)
- `cta-label` (string, default `Read the changelog`)
- `href` (string, default `#`)

## Use when

- Announcing a short, site-wide message (e.g. a new release) in a slim, dismissible bar on the primary surface.
- Pairing an eyebrow badge and inline call-to-action link with an end-aligned dismiss button.

## Avoid when

- Use banner-rotating for several rotating messages, or banner-newsletter for a newsletter-signup banner instead of an announcement.

## Rules

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

  • Announcing a short, site-wide message (e.g. a new release) in a slim, dismissible bar on the primary surface.
  • Pairing an eyebrow badge and inline call-to-action link with an end-aligned dismiss button.

Avoid when

  • Use banner-rotating for several rotating messages, or banner-newsletter for a newsletter-signup banner instead of an announcement.

Anti-patterns

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

Usage

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

resources/views/welcome.blade.php Blade
<x-blocks.banner-announcement />

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/banner-announcement.blade.php Blade
@props([
    'eyebrow'  => 'New',
    'message'  => 'We just shipped a major update to our component library.',
    'ctaLabel' => 'Read the changelog',
    'href'     => '#',
])

<div
    x-data="{ open: true }"
    x-show="open"
    role="region"
    aria-label="{{ __('Announcement') }}"
    data-slot="announcement-banner"
    {{ $attributes->merge(['class' => 'relative w-full bg-primary text-primary-foreground']) }}
>
    <div class="mx-auto max-w-7xl px-4 py-2 pe-12 sm:pe-14">
        <div class="flex flex-wrap items-center justify-center gap-x-4 gap-y-2 text-sm">
            <x-ui.badge class="shrink-0 border-primary-foreground/40 bg-transparent text-primary-foreground">{{ __($eyebrow) }}</x-ui.badge>

            <span class="text-primary-foreground">{{ __($message) }}</span>

            <a href="{{ $href }}" class="inline-flex shrink-0 items-center gap-x-2 font-medium underline decoration-primary-foreground/50 underline-offset-2 transition-colors hover:decoration-primary-foreground">
                {{ __($ctaLabel) }}
                <svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                    <path d="M5 12h14M13 6l6 6-6 6" />
                </svg>
            </a>
        </div>
    </div>

    <div class="absolute inset-y-0 end-2 flex items-center sm:end-4">
        <x-ui.button variant="ghost" size="icon" x-on:click="open = false" aria-label="{{ __('Dismiss') }}" class="text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground">
            <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="M18 6 6 18M6 6l12 12" />
            </svg>
        </x-ui.button>
    </div>
</div>

Ownership & lifecycle

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