Trial banner

How long a trial has left, with a ring and the way to upgrade: a ds::announcement-bar above the app, or a card in a page. Plain Blade but for dismissKey.

Anatomy

bar:   ds::announcement-bar[data-ds-trial=state] (tone, href, actionLabel, dismissKey)
       └── [ring: ds::progress circle sm, in aria-hidden] message (+ slot)

card:  div[data-ds-trial=state] (dsDismiss root with dismissKey)
       └── div.rounded-panel.border.{wash}
           ├── ring (ds::progress circle md, the days in its middle) or a clock
           ├── p.font-semibold message, then the slot
           └── ds::button href (primary, sm), ✕ (data-ds-dismiss) with dismissKey

Counting

In PHP, once, at render. endsAt is parsed with Carbon and compared with Carbon::now() in the end date's timezone; days are calendar days between the two dates' starts of day. Past the end is expired. daysLeft instead: 0 is the last day, negative has ended. One of the two is required (throws).

StateWhenToneTextRing
days2+ days, above warnAtaccentmessage (:count)yes
days / tomorrowwarnAt days or fewerwarningmessage / tomorrowMessageyes
today0 daysdangertodayMessageno: a clock (card)
expiredafter the enddangerexpiredMessageno: a clock (card)

The ring is ds::progress variant="circle", value = days left (clamped to total), max = total, in the tone. It is hidden from assistive technology because the sentence carries the same thing; a progressbar's percentage would be the time said twice, worse.

Variants

  • bar: the announcement bar with :icon="false", the ring in its message. A landmark named by label ("Trial"); never a live region, never urgent. Dismissal, pre-paint check and all, is the bar's own.
  • card: the alert's washes per tone, rounded-panel, wrapping. With dismissKey it is a dsDismiss root with the announcement bar's grid-row collapse and the same pre-paint Dismissal::script; its ✕ is invisible until the script starts. No key, no ✕.

Accessibility

Rolebar: region named label; card: none
Statein words; tone and ring repeat it
Keyboardthe action link; the ✕ when shown
Motionthe collapse is motion-safe:; nothing else moves

Do not

  • Do not count in the browser. The server's count is the one the billing code agrees with.
  • Do not show "0 days left". The last day and the end have sentences.
  • Do not dismiss without a key. It would be back on the next load.

From the package repo: edit this page on GitHub.

Was this page helpful?