Trial banner
"Your trial ends in 5 days", with a ring for the time left and the way to upgrade. A bar above the app, or a card in a page.

Plain Blade. Only dismissKey needs Alpine
and the package's script, as announcement bar's does.
Use it
{{-- Above the app's chrome, in the layout --}}
@if ($team->onTrial())
<x-ds::trial-banner :endsAt="$team->trial_ends_at" :total="14" :href="route('billing')" />
@endif
{{-- In a page, as a card --}}
<x-ds::trial-banner variant="card" :endsAt="$team->trial_ends_at" :href="route('billing')">
Upgrade to keep your projects and their history.
</x-ds::trial-banner>
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
variant | bar card | bar | A announcement bar across the top, or a card in the page. |
endsAt | date string or DateTimeInterface | — | When the trial ends. Counted against the server's clock. |
daysLeft | int | — | Or the whole days left, if you count them: 0 is the last day, below 0 has ended. One of the two is required. |
total | int | 14 | The trial's length in days, for the ring. |
warnAt | int | 3 | Days left at which it turns warning. |
href | string | — | Where to upgrade. Draws the action. |
actionLabel | string | Upgrade | The action's words. |
dismissKey | string | — | A localStorage key; dismissed stays dismissed on later loads. Needs Alpine and the script. |
message | string | Your trial ends in :count days. | Two or more days left; :count is the number. |
tomorrowMessage | string | Your trial ends tomorrow. | One day left. |
todayMessage | string | Your trial ends today. | The last day. |
expiredMessage | string | Your trial has ended. | After the end. |
label | string | Trial | The bar's landmark name. |
nonce | string | Vite's | The CSP nonce for the dismissKey check. |
The default slot follows the message, for a line of your own.
How it counts
Days are calendar days on the server's clock, worked out once when the page renders: a trial ending at any hour tomorrow is "tomorrow", one ending later today is "today", and one whose end has passed has ended. Pass a date in the timezone that matters to the reader (the team's, not the server's) if those differ. Nothing ticks in the browser: a page left open overnight says what it said when it was rendered.
Tone, and the ended state
| Left | Tone | Shows |
|---|---|---|
more than warnAt days | accent | the message and the ring |
warnAt days or fewer | warning | the message and the ring |
| the last day | danger | "ends today", a clock instead of an empty ring |
| ended | danger | "has ended": its own sentence, never "0 days left" |
The ring is progress's circle, emptying as the days go. It is a picture of the sentence beside it, so it is hidden from screen readers: the words carry the time.
Dismissing
dismissKey works as the announcement bar's: a ✕ appears once the script has
started, and the dismissal is kept in localStorage under the key and checked
before the first paint. Give each stage its own key so the reminder comes back
when it matters:
<x-ds::trial-banner :endsAt="$endsAt" dismissKey="trial-{{ $team->id }}-{{ $daysLeft <= 3 ? 'late' : 'early' }}" />
Without a key there is no ✕: a trial reminder dismissed for one page load would be back on the next.
Accessibility
- The bar is a landmark named "Trial", read where it sits; it does not interrupt. The card is plain content.
- The state is in words. The tone and the ring repeat it for the eye.
Don't
- Don't show it on every page and in a card at once. One reminder.
- Don't tick a countdown in the browser. A clock counting seconds turns a reminder into pressure, and it disagrees with the server.
- Don't use it for billing failures. That is an alert, or the
announcement bar's
urgent.
More in specs/trial-banner.md.
From the package repo: edit this page on GitHub.