Upgrade prompt

A usage meter, a headline for the state, benefits and the upgrade action, for when an allowance is near or past its limit. Plain Blade, no script.

Anatomy

section[aria-labelledby=headline][data-ds-upgrade-prompt=variant]
├── mark: icon in a tint tile (warning near, danger at/over)
├── p#headline.text-section      ← nearTitle | atTitle | overTitle
├── the slot (a line)
├── ds::usage-meter (label, used, limit, unit, warnAt)
├── ul: benefits, each with a check
├── actions: ds::button primary (href), ds::button ghost (secondaryHref)
└── ✕ (dismissible, not on gate)

gate: a section.relative.grid.min-h-72 on surface-sunken, holding an absolute inset-0 -z-10 placeholder (aria-hidden, inert, 50% opacity, 2px blur: the placeholder slot or five still bars) and the prompt as a max-w-md card centred over it with shadow-float.

State

WhenHeadlineMark
nearused < limitnearTitlewarning
atused = limitatTitledanger
overused > limitoverTitledanger

The meter colours itself by its own thresholds (warnAt, danger at 100%).

Dismiss

As ds::alert's, through the include's document listener (press.js, data-ds-remove): dispatches dismiss (bubbling) from the root, then removes it. Works with no Alpine, and under a strict CSP. Ignored on gate.

The locked content

Never rendered. The gate is what the host renders INSTEAD of the feature; the placeholder is decoration. Content hidden by blur or overlay is still in the source and the accessibility tree, which is not a lock.

Accessibility

Rolesection named by its headline (a region)
Meterrole="meter", value in words
Keyboardthe two links; the ✕
Placeholderaria-hidden, inert

Do not

  • Do not render it below the threshold.
  • Do not put the locked feature behind it. Leave it out.
  • Do not make the gate dismissible.

From the package repo: edit this page on GitHub.

Was this page helpful?