Workspace billing status
Contextual notices sit inline with the billing controls they affect.
GhostInlineAlert is inline contextual feedback for errors, warnings, and recoverable failures near the content they describe. Import it from @ghostvue/themes for the default visual treatment. For headless markup with your own styles, see Advanced: headless composition.
Solid, soft, and outline GhostInlineAlert notices with contextual actions.
Contextual notices sit inline with the billing controls they affect.
<script setup lang="ts">
import { nextTick, ref, useTemplateRef } from 'vue'
import {
GhostButton,
GhostCard,
GhostInlineAlert,
type GhostButtonExposed,
} from '@ghostvue/themes'
const showQuotaNotice = ref(true)
const status = ref('')
function retryCharge(): void {
status.value = 'Payment retry queued.'
}
const dismissButton = useTemplateRef<GhostButtonExposed>('dismissButton')
const restoreButton = useTemplateRef<GhostButtonExposed>('restoreButton')
// Dismiss and Restore each unmount the button that was pressed. Move focus to
// the control that replaces it so keyboard users are not dropped on the page.
async function dismissQuota(): Promise<void> {
showQuotaNotice.value = false
status.value = 'Usage notice dismissed.'
await nextTick()
restoreButton.value?.focus()
}
async function restoreNotices(): Promise<void> {
showQuotaNotice.value = true
status.value = 'Notices restored.'
await nextTick()
dismissButton.value?.focus()
}
</script>
<template>
<section class="notices" aria-labelledby="notices-title">
<GhostCard>
<template #header>
<div class="notices__header">
<h2 id="notices-title" class="notices__title">
Workspace billing status
</h2>
<p class="notices__lead">
Contextual notices sit inline with the billing controls they affect.
</p>
</div>
</template>
<div class="notices__stack">
<!--
These notices are present on first paint, so they keep the default
announce="off" and are read in document order. The footer status
line announces what the actions did.
-->
<GhostInlineAlert variant="solid" tone="danger">
<template #title>Payment method declined</template>
<template #message>
The card ending in 4242 failed authorization. Update billing details
before Friday to avoid pausing background workers.
</template>
<template #actions>
<GhostButton size="sm" variant="outline" @click="retryCharge">
Retry charge
</GhostButton>
</template>
</GhostInlineAlert>
<GhostInlineAlert variant="soft" tone="accent">
<template #title>Annual invoice scheduled</template>
<template #message>
Your Pro renewal ($348.00) is scheduled for December 1, 2026.
</template>
</GhostInlineAlert>
<GhostInlineAlert
v-if="showQuotaNotice"
variant="outline"
tone="neutral"
>
<template #title>Storage at 82% of included quota</template>
<template #message>
Artifact retention is set to 30 days. Adjust retention in workspace
settings if you need more headroom.
</template>
<template #actions>
<GhostButton
ref="dismissButton"
size="sm"
variant="ghost"
tone="neutral"
@click="dismissQuota"
>
Dismiss
</GhostButton>
</template>
</GhostInlineAlert>
</div>
<template #footer>
<div class="notices__footer">
<p class="notices__status" role="status">{{ status }}</p>
<GhostButton
v-if="!showQuotaNotice"
ref="restoreButton"
size="sm"
variant="ghost"
tone="neutral"
@click="restoreNotices"
>
Restore dismissed
</GhostButton>
</div>
</template>
</GhostCard>
</section>
</template>
<style scoped>
.notices {
max-inline-size: 38rem;
}
.notices__header {
display: grid;
gap: var(--ghost-space-gap-xs);
padding-block-end: var(--ghost-space-stack-sm);
}
.notices__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.notices__lead,
.notices__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
overflow-wrap: anywhere;
}
.notices__stack {
display: grid;
gap: var(--ghost-space-stack-md);
}
.notices__footer {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: space-between;
min-block-size: var(--ghost-control-size-sm-min);
}
</style>
The billing status card stacks solid, soft, and outline GhostInlineAlert variants from @ghostvue/themes, each next to the controls it affects. Actions sit in #actions, so Retry charge and Dismiss stay in the tab order. Outline and ghost buttons in a danger notice use the alert's foreground for their label and focus ring. Outline buttons also use it for the border. The notices are on the page from first paint, so they keep the default announce="off". The footer's role="status" line reports what each action did ("Payment retry queued.", "Usage notice dismissed."). Dismissing the usage notice moves focus to Restore dismissed, and restoring moves it back to Dismiss, because each press removes the button that was pressed.
Set announce to status or alert only when copy appears or changes after mount — for example after a failed save or a delayed load error. Do not use live semantics for copy that is present in the initial HTML with no later change unless you intentionally want a mount announcement.
announce | Role on root | Typical use |
|---|---|---|
off | (none) | Static contextual feedback present on first paint |
status | status | Recoverable or informational updates |
alert | alert | Urgent errors needing immediate attention |
One mounted announce="status" alert whose text changes in place from checking to partially unavailable to up to date while saved readings stay visible.
<script setup lang="ts">
import { computed, reactive, ref } from 'vue'
import {
GhostBadge,
GhostButton,
GhostCard,
GhostInlineAlert,
type GhostInlineAlertTone,
} from '@ghostvue/themes'
type FeedId = 'buoy' | 'wind' | 'tide'
interface Feed {
name: string
reading: string
/** Minutes since the reading was measured. */
age: number
available: boolean
}
type Phase = 'checking' | 'partial' | 'retrying' | 'current'
interface PhaseCopy {
tone: GhostInlineAlertTone
title: string
message: string
action: string
}
const feeds = reactive<Record<FeedId, Feed>>({
buoy: {
name: 'Harbor buoy',
reading: '1.2 m swell',
age: 18,
available: true,
},
wind: { name: 'Pier wind', reading: '14 kn SW', age: 9, available: true },
tide: {
name: 'Tide gauge',
reading: '2.1 m rising',
age: 9,
available: true,
},
})
const phase = ref<Phase>('checking')
const copy: Record<Phase, PhaseCopy> = {
checking: {
tone: 'neutral',
title: 'Checking 3 feeds…',
message: 'Saved readings stay on screen until each feed responds.',
action: 'Receive responses',
},
partial: {
tone: 'danger',
title: 'Harbor buoy is unavailable',
message:
'Showing its saved reading. Pier wind and tide gauge are up to date.',
action: 'Retry harbor buoy',
},
retrying: {
tone: 'neutral',
title: 'Retrying harbor buoy…',
message: 'Its saved reading stays on screen until the feed responds.',
action: 'Receive response',
},
current: {
tone: 'accent',
title: 'All 3 feeds are up to date',
message: 'Readings refresh every 10 minutes.',
action: 'Refresh feeds',
},
}
const current = computed(() => copy[phase.value])
function ageText(feed: Feed): string {
const prefix = feed.available ? 'Updated' : 'Saved'
return feed.age === 0
? `${prefix} just now`
: `${prefix} ${String(feed.age)} min ago`
}
// Stand-ins for feed responses, so each phase can be inspected. Readings and
// their ages change outside the alert, so they are not announced.
function nextStep(): void {
switch (phase.value) {
case 'checking':
feeds.wind = { ...feeds.wind, reading: '16 kn SW', age: 0 }
feeds.tide = { ...feeds.tide, reading: '2.3 m rising', age: 0 }
feeds.buoy.available = false
phase.value = 'partial'
break
case 'partial':
phase.value = 'retrying'
break
case 'retrying':
feeds.buoy = { ...feeds.buoy, reading: '1.4 m swell', age: 0 }
feeds.buoy.available = true
phase.value = 'current'
break
case 'current':
for (const feed of Object.values(feeds)) feed.age += 10
phase.value = 'checking'
break
}
}
</script>
<template>
<section class="feed-status" aria-labelledby="feed-status-title">
<GhostCard>
<template #header>
<h2 id="feed-status-title" class="feed-status__title">
Coastal conditions
</h2>
</template>
<div class="feed-status__body">
<!--
One alert stays mounted for the whole refresh, so its role="status"
region exists before the text changes and each change is announced
politely. Remounting it per phase could drop announcements.
-->
<GhostInlineAlert
announce="status"
variant="soft"
:tone="current.tone"
:heading-level="3"
>
<template #title>{{ current.title }}</template>
<template #message>{{ current.message }}</template>
</GhostInlineAlert>
<ul class="feed-status__list">
<li v-for="feed in feeds" :key="feed.name" class="feed-status__item">
<span class="feed-status__name">{{ feed.name }}</span>
<span class="feed-status__reading">{{ feed.reading }}</span>
<span class="feed-status__age">
{{ ageText(feed) }}
<GhostBadge
v-if="!feed.available"
size="sm"
tone="danger"
variant="soft"
>
Offline
</GhostBadge>
</span>
</li>
</ul>
</div>
<template #footer>
<GhostButton
size="sm"
variant="outline"
tone="neutral"
@click="nextStep"
>
{{ current.action }}
</GhostButton>
</template>
</GhostCard>
</section>
</template>
<style scoped>
.feed-status {
max-inline-size: 36rem;
}
.feed-status__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.feed-status__body {
display: grid;
gap: var(--ghost-space-stack-md);
}
.feed-status__list {
display: grid;
gap: var(--ghost-space-gap-sm);
list-style: none;
margin: 0;
padding: 0;
}
.feed-status__item {
align-items: baseline;
column-gap: var(--ghost-space-gap-sm);
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
row-gap: var(--ghost-space-gap-2xs);
}
.feed-status__name {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-medium);
line-height: var(--ghost-type-line-snug);
}
.feed-status__reading {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-variant-numeric: tabular-nums;
line-height: var(--ghost-type-line-snug);
text-align: end;
}
.feed-status__age {
align-items: center;
color: var(--ghost-text-muted);
display: flex;
flex-wrap: wrap;
font-size: var(--ghost-type-size-xs);
gap: var(--ghost-space-gap-xs);
grid-column: 1 / -1;
line-height: var(--ghost-type-line-normal);
}
</style>
Three coastal feeds refresh in parallel. One alert with announce="status" stays mounted for the whole refresh, and its title and message change in place: "Checking 3 feeds…", then "Harbor buoy is unavailable" when one feed fails, then "Retrying harbor buoy…" and "All 3 feeds are up to date". Press the footer button to walk each response. Because the live region exists before its text changes, each update is announced politely; mounting a new alert per phase can drop announcements. Changing tone on the same alert keeps the region.
The saved buoy reading stays visible while its feed is down, and the other feeds update beside it. Each reading's age ("Updated just now", "Saved 18 min ago") sits outside the alert, so routine age changes are not announced. For an urgent failure that needs immediate attention, use announce="alert" instead.
Soft danger styling from @ghostvue/themes.
<script setup lang="ts">
import { GhostInlineAlert } from '@ghostvue/themes'
</script>
<template>
<GhostInlineAlert :heading-level="2" tone="danger" variant="soft">
<template #title>Could not refresh rows</template>
<template #message>
The server returned an error. Your last successful data is still shown
below.
</template>
</GhostInlineAlert>
</template>
@ghostvue/themes adds these to the headless GhostInlineAlert API, which it forwards:
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'solid' | 'soft' | 'outline' | 'ghost' | "soft" | Visual treatment. The default omits data-variant. |
tone | 'accent' | 'neutral' | 'danger' | 'success' | 'warning' | "neutral" | Semantic color intent, independent of variant and not a status enum. success and warning use the status tokens, as on GhostBadge; there is no info tone. The default omits data-tone. |
Behavioral props (announce, headingLevel, as) pass through to the unstyled component. Defaults omit data-variant and data-tone so CSS treats missing hooks as soft / neutral.
Neutral, success, warning, and danger soft alerts side by side, with transparent actions on the status tones.
<script setup lang="ts">
import { ref } from 'vue'
import { GhostButton, GhostInlineAlert } from '@ghostvue/themes'
const status = ref('')
</script>
<template>
<section class="service-health" aria-labelledby="service-health-title">
<h2 id="service-health-title" class="service-health__title">
Service health
</h2>
<!--
The title says the status in words, so the tone only adds color. Pick
success for healthy or completed, warning for degraded or needs attention
soon, and danger for failures. Accent follows the brand color and does
not mean success.
-->
<div class="service-health__stack">
<GhostInlineAlert tone="neutral">
<template #title>Maintenance window on Sunday</template>
<template #message>
Search indexing pauses from 02:00 to 03:00 UTC. Queries still return
cached results.
</template>
</GhostInlineAlert>
<GhostInlineAlert tone="success">
<template #title>API gateway is healthy</template>
<template #message>
All 6 regions responded within 120 ms over the last hour.
</template>
<template #actions>
<GhostButton
size="sm"
variant="ghost"
@click="status = 'Opened the uptime report.'"
>
View uptime report
</GhostButton>
</template>
</GhostInlineAlert>
<GhostInlineAlert tone="warning">
<template #title>Database replicas are degraded</template>
<template #message>
Replica lag in eu-west is 45 seconds. Reads may return stale rows
until it catches up.
</template>
<template #actions>
<GhostButton
size="sm"
variant="outline"
@click="status = 'Opened the replica dashboard.'"
>
Review replicas
</GhostButton>
</template>
</GhostInlineAlert>
<GhostInlineAlert tone="danger">
<template #title>Webhook delivery failed</template>
<template #message>
38 events could not be delivered. They will retry automatically for 24
hours.
</template>
</GhostInlineAlert>
</div>
<p class="service-health__status" role="status">{{ status }}</p>
</section>
</template>
<style scoped>
.service-health {
display: grid;
gap: var(--ghost-space-stack-md);
max-inline-size: 38rem;
}
.service-health__title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
}
.service-health__stack {
display: grid;
gap: var(--ghost-space-stack-sm);
}
.service-health__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
min-block-size: 1lh;
}
</style>
tone picks a color, not a status. The title and message say what happened, and announce still decides live-region semantics; tone never sets a role. Choose the tone that matches the copy:
neutral for informational notices, such as a planned maintenance window.success for healthy or completed states.warning for degraded states, or ones that need attention soon.danger for failures.accent for brand emphasis only.Do not use accent to mean success. It follows the brand color, so it turns purple in Vibrant and is close to neutral in Mono. success and warning take their colors from the --ghost-status-success-* and --ghost-status-warning-* tokens, the same mapping as GhostBadge, so an alert and a badge beside it match. The title and message both use the status foreground. The solid variant swaps the status foreground and background and has no gradient. Outline and ghost buttons in #actions take the alert's text color, as they do in a danger alert. There is no info tone; use neutral.
Use above or inside a table region for load and mutation failures. Keep actions in #actions so retry controls stay keyboard reachable.
Recoverable table error with a retry action.
<script setup lang="ts">
import { GhostButton, GhostInlineAlert } from '@ghostvue/themes'
</script>
<template>
<GhostInlineAlert
:heading-level="2"
as="section"
tone="danger"
variant="outline"
data-testid="table-load-error"
>
<template #title>Unable to load table</template>
<template #message>
A network error prevented rows from loading. Cached data may be stale.
</template>
<template #actions>
<GhostButton type="button">Retry load</GhostButton>
</template>
</GhostInlineAlert>
</template>
GhostToast with GhostToastProvider and useGhostToast.GhostFieldError inside GhostField.announce="alert". That spuriously announces on every visit. Keep announce="off" for static copy.announce="off" for copy present on first paint.announce="alert" when an error appears after an async action.announce="status" for recoverable informational updates after load.#actions; the root is not focusable.Specification: GhostInlineAlert specification.
For teams that bring their own design system, the headless GhostInlineAlert from @ghostvue/vue renders the same parts and live-region roles with no styles.
Title and message without live-region semantics.
<script setup lang="ts">
import { GhostInlineAlert } from '@ghostvue/vue'
</script>
<template>
<GhostInlineAlert :heading-level="2" as="section">
<template #title>Filters are active</template>
<template #message>Showing rows that match your current search.</template>
</GhostInlineAlert>
</template>
The root is a native div by default. Use as="section" when the alert is a named landmark with a title. Static copy uses announce="off" (the default) so assistive technology reads it in document order without a live-region announcement.
useGhostInlineAlert bindings on a section root.
<script setup lang="ts">
import { useGhostInlineAlert } from '@ghostvue/vue'
const { as, headingTag, titleId, rootProps } = useGhostInlineAlert({
as: 'section',
announce: 'off',
hasTitle: true,
headingLevel: 2,
})
</script>
<template>
<component :is="as" v-bind="rootProps">
<component :is="headingTag" :id="titleId" data-part="title">
Recoverable warning
</component>
<div data-part="message">Some rows were skipped during import.</div>
</component>
</template>
announce=alert after a simulated failure.
<script setup lang="ts">
import { ref } from 'vue'
import { GhostButton, GhostInlineAlert } from '@ghostvue/vue'
const showFailure = ref(false)
function simulateFailure() {
showFailure.value = true
}
</script>
<template>
<GhostButton type="button" @click="simulateFailure">
Simulate save failure
</GhostButton>
<GhostInlineAlert v-if="showFailure" :heading-level="2" announce="alert">
<template #title>Save failed</template>
<template #message>Your changes were not persisted.</template>
<template #actions>
<GhostButton type="button">Retry save</GhostButton>
</template>
</GhostInlineAlert>
</template>
The alert mounts with announce="alert" after a simulated save failure.
The unstyled root uses class ghost-inline-alert, data-part="root", and data-ghost-inline-alert. Slot wrappers use data-part="title", message, and actions. There is no data-state hook.
| Prop | Type | Default | Description |
|---|---|---|---|
announce | GhostInlineAlertAnnounce | "off" | Live-region behavior. Default off for static inline feedback. Use status or alert only when copy appears or changes after mount. |
as | GhostInlineAlertElement | "div" | Root element. Prefer div inside table cells. |
headingLevel | GhostInlineAlertHeadingLevel | 3 | Heading level wrapping the title slot. |
| Slot | Slot props | Description |
|---|---|---|
actions | — | Optional action controls such as GhostButton. Children stay focusable. |
message | — | Primary supporting copy. |
title | — | Optional heading. Rendered as h1–h6 from headingLevel. |
Slots: #title, #message, #actions. Native attributes fall through to the root. A template ref exposes element: HTMLElement | null.
When #title is present, as is section, and announce is off, the root receives aria-labelledby pointing at the heading id generated by useGhostId.