Sale
Promotional sale sections — a bold gradient panel with countdown pills, dual CTAs and a discount code, and a dismissible full-width promo bar with a copyable code.
Preview
@props([
'message' => 'Summer sale ends in',
'code' => 'SAVE20',
'cta' => 'Shop the sale',
'ctaHref' => '#',
'targetDate' => null,
])
@php
// Default to a near-term deadline so the bar reads as genuinely urgent out of
// the box; callers pass their own ISO-8601 string via `targetDate`.
$targetDate = $targetDate ?: now()->addDays(2)->toIso8601String();
@endphp
<x-ui.section
data-slot="sale-03"
x-data="{ open: true }"
x-show="open"
space="none" surface="primary" class="relative w-full" {{ $attributes }}
>
<div class="mx-auto max-w-7xl px-4 py-4 pe-12 sm:pe-14">
<div class="flex flex-col items-center gap-4 text-center sm:flex-row sm:justify-between sm:gap-4 sm:text-start">
<div class="flex flex-col items-center gap-2 sm:flex-row sm:gap-4">
<p class="text-sm font-semibold leading-snug sm:text-base">{{ __($message) }}</p>
<x-ui.countdown :target-date="$targetDate" size="sm" variant="outline" tone="inverse" />
</div>
<div class="flex flex-wrap items-center justify-center gap-2 sm:flex-nowrap">
<div class="flex items-center gap-2">
<span class="text-xs text-primary-foreground">{{ __('Use code') }}</span>
<x-ui.badge class="border-transparent bg-primary-foreground font-mono tracking-wider text-primary">{{ $code }}</x-ui.badge>
<x-ui.copy-button :value="$code" :label="__('Copy code :code', ['code' => $code])" class="text-primary-foreground hover:bg-primary-foreground/15 hover:text-primary-foreground" />
</div>
<x-ui.button :href="$ctaHref" size="sm" class="bg-background text-foreground hover:bg-background/90">
{{ __($cta) }}
<svg class="ms-2 size-4 shrink-0 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>
</x-ui.button>
</div>
</div>
</div>
<x-ui.button
variant="ghost"
size="sm"
:icon-label="__('Dismiss sale announcement')"
x-on:click="open = false"
class="absolute end-2 top-1/2 -translate-y-1/2 text-primary-foreground/80 hover:bg-primary-foreground/15 hover:text-primary-foreground"
>
<svg class="size-4 shrink-0" 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>
</x-ui.section>
Installation
php artisan ui:add blocks/sale-countdown-bar
Registry contract
Install confidence
php artisan ui:add blocks/sale-countdown-bar
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.2
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/sale-countdown-bar.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: Sale Countdown Bar (`sale-countdown-bar`)
A slim full-width urgency bar on the primary surface: an announcement message, a live days/hours/minutes/seconds countdown to the deadline, a one-click copyable promo-code badge with a copied confirmation, a contrast call-to-action, and a dismiss button. Stacks vertically on mobile and collapses to a single row on desktop.
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/sale-countdown-bar
```
## Render it
```blade
<x-blocks.sale-countdown-bar />
```
## Props
- `message` (string, default `Summer sale ends in`) — Urgency message shown beside the countdown.
- `code` (string, default `SAVE20`) — Discount code shown in the badge.
- `cta` (string, default `Shop the sale`) — Call-to-action button label.
- `cta-href` (string, default `#`) — Call-to-action destination.
- `target-date` (mixed|null, default `null`) — ISO-8601 deadline the countdown counts down to; null defaults to two days from now.
## Use when
- Displaying a dismissible, full-width urgency bar with a live countdown, a copyable promo code and a call to action.
- Wanting the message to feel time-critical while still letting the visitor dismiss it.
## Avoid when
- Needing a non-dismissible sale section or strip; use sale-promo or sale-banner instead.
## Rules
- Render the installed block with `<x-blocks.sale-countdown-bar />` 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/sale-countdown-bar
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/sale-countdown-bar.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
- Displaying a dismissible, full-width urgency bar with a live countdown, a copyable promo code and a call to action.
- Wanting the message to feel time-critical while still letting the visitor dismiss it.
Avoid when
- Needing a non-dismissible sale section or strip; use sale-promo or sale-banner instead.
Anti-patterns
- Do not replace semantic props with conflicting utility classes.
- Do not remove labels, focus styles, or state attributes.
- Anatomy
Usage
Render the block as a component, passing data where useful:
<x-blocks.sale-countdown-bar />
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([
'message' => 'Summer sale ends in',
'code' => 'SAVE20',
'cta' => 'Shop the sale',
'ctaHref' => '#',
'targetDate' => null,
])
@php
// Default to a near-term deadline so the bar reads as genuinely urgent out of
// the box; callers pass their own ISO-8601 string via `targetDate`.
$targetDate = $targetDate ?: now()->addDays(2)->toIso8601String();
@endphp
<x-ui.section
data-slot="sale-03"
x-data="{ open: true }"
x-show="open"
space="none" surface="primary" class="relative w-full" {{ $attributes }}
>
<div class="mx-auto max-w-7xl px-4 py-4 pe-12 sm:pe-14">
<div class="flex flex-col items-center gap-4 text-center sm:flex-row sm:justify-between sm:gap-4 sm:text-start">
<div class="flex flex-col items-center gap-2 sm:flex-row sm:gap-4">
<p class="text-sm font-semibold leading-snug sm:text-base">{{ __($message) }}</p>
<x-ui.countdown :target-date="$targetDate" size="sm" variant="outline" tone="inverse" />
</div>
<div class="flex flex-wrap items-center justify-center gap-2 sm:flex-nowrap">
<div class="flex items-center gap-2">
<span class="text-xs text-primary-foreground">{{ __('Use code') }}</span>
<x-ui.badge class="border-transparent bg-primary-foreground font-mono tracking-wider text-primary">{{ $code }}</x-ui.badge>
<x-ui.copy-button :value="$code" :label="__('Copy code :code', ['code' => $code])" class="text-primary-foreground hover:bg-primary-foreground/15 hover:text-primary-foreground" />
</div>
<x-ui.button :href="$ctaHref" size="sm" class="bg-background text-foreground hover:bg-background/90">
{{ __($cta) }}
<svg class="ms-2 size-4 shrink-0 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>
</x-ui.button>
</div>
</div>
</div>
<x-ui.button
variant="ghost"
size="sm"
:icon-label="__('Dismiss sale announcement')"
x-on:click="open = false"
class="absolute end-2 top-1/2 -translate-y-1/2 text-primary-foreground/80 hover:bg-primary-foreground/15 hover:text-primary-foreground"
>
<svg class="size-4 shrink-0" 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>
</x-ui.section>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.1.2 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0