Skip to content

GhostInlineAlert specification ​

Status: Proposed for GHO-76 implementation scope. Approval is PR review of this spec together with the implementation.

Purpose and user problems ​

GhostInlineAlert is inline contextual feedback for errors, warnings, and recoverable failures near the content they describe. Immediate DataTable uses include row-load failures, mutation failures, and retryable table errors shown above or inside a table region. Sighted users see a compact title, message, and optional action controls. Assistive technology reads the same copy in document order, with role="status" or role="alert" only when the consumer opts in for content that appears or updates after mount.

Non-goals ​

  • Global notification management, toasts, snackbars, or stacked notification lists. Use a future GhostToast / provider for transient global feedback.
  • Dismissible chrome, auto-timeout, or swipe-to-dismiss. Consumers own removal with v-if and their own close buttons if needed.
  • Fixed severity or status enums (variant="error", type="warning"). Headless styling hooks and themed tone express color intent; meaning lives in slot copy.
  • Replacing GhostFieldError inside GhostField. Field validation errors stay on the field primitive.
  • useControllableState — there is no model.
  • A parallel styling-hooks vocabulary beyond ADR 0004 (data-part, class, omitted-default data-* visual hooks).

Public API ​

Props and configuration ​

Headless @ghostvue/vue GhostInlineAlert / useGhostInlineAlert:

PropTypeDefaultContract
announce'off' | 'status' | 'alert''off'Live-region semantics. off is static feedback with no role. status sets role="status" (polite). alert sets role="alert" (assertive). Use status/alert only for copy that appears or changes after mount, not for always-present page chrome.
headingLevel1 | 2 | 3 | 4 | 5 | 63Level of the native heading wrapping the #title slot. Omitted #title skips the heading.
asGhostInlineAlertElement'div'Root element. Prefer div inside table cells; use section when the alert is a named landmark.
ts
type GhostInlineAlertElement = 'div' | 'section'
type GhostInlineAlertHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6
type GhostInlineAlertAnnounce = 'off' | 'status' | 'alert'

Named ESM exports: GhostInlineAlert, useGhostInlineAlert, and the types above. Headless behavior lives in the composable; the SFC renders the root, named slots, and part wrappers.

Native attributes and event listeners fall through to the root. useGhostId('ghost-inline-alert-title') supplies the title heading id when the #title slot is rendered. When #title is present, as is section, and announce is off, the root receives aria-labelledby pointing at that id. Default div roots never get aria-labelledby (generic div has no nameable role). When announce is status or alert, the root receives the matching role and does not also use aria-labelledby on the same node.

v-model contracts ​

There is no model. Visibility, copy, and live semantics are consumer-owned.

Events, callbacks, slots, and exposed methods ​

SlotPart elementContract
titletitleOptional short heading. Rendered as h{headingLevel} with generated id.
messagemessagePrimary supporting copy. Rendered in a <div> so paragraphs and lists are valid.
actionsactionsOptional action controls (e.g. GhostButton). Children remain focusable; the root is not.

No default slot. No component-specific events. Template ref exposes:

  • element: HTMLElement | null — the root host after mount.

Themed @ghostvue/themes GhostInlineAlert ​

Wraps the unstyled component. Behavioral props pass through. Visual props:

PropTypeDefaultContract
variant'solid' | 'soft' | 'outline' | 'ghost''soft'Visual treatment (same set as GhostBadge).
tone'accent' | 'neutral' | 'danger' | 'success' | 'warning''neutral'Semantic color intent, independent of variant. Not a status enum. success and warning follow the status tone amendment.

Sets data-themed on the inner root (same pattern as GhostEmptyState). Sets data-variant / data-tone when not the default so CSS can treat omitted hooks as soft / neutral.

State model ​

Stateless presentational markup. No data-state. Live behavior is entirely from the announce prop and consumer mount timing.

Loading, empty, disabled, read-only, and error states ​

None apply as component states. Consumers mount the alert when they have copy to show. Loading indicators belong to GhostSpinner / GhostSkeleton siblings.

Async behavior ​

The component performs no async work. For failures after fetch, consumers typically mount the alert with announce="alert" or toggle announce when copy appears. The primitive does not detect “after mount” automatically; misuse of announce on static initial content is a consumer documentation issue.

Consumer data ​

No data props and no mutation. Slot content is consumer-owned.

Accessibility contract ​

Semantics and relationships ​

DOM reading order: #title, #message, #actions.

The title uses a native heading when the slot is present. Message copy is ordinary text in a div with data-part="message".

When announce is off, the root has no live-region role. With #title and as="section", aria-labelledby names the section.

When announce is status, the root is role="status" (implicit aria-live="polite"). When announce is alert, the root is role="alert" (implicit aria-live="assertive").

Choose status for recoverable or informational updates; choose alert for urgent errors that need immediate attention. Do not set announce to status or alert for copy that is present in the initial HTML with no later change unless the surrounding workflow intentionally wants a mount announcement.

Interactive controls live only in #actions. They are not part of the root accessible name unless named normally as buttons or links.

Keyboard interaction ​

No root key handling. #actions children keep normal tab order.

Focus behavior ​

The root is not focusable. Actions remain focusable when present.

Assistive technology expectations ​

Static alerts (announce="off") are read in document order like surrounding content. Live alerts announce their subtree when inserted or when the root role changes from a non-live configuration to status/alert as supported by the platform. The component does not move focus when an alert appears.

Rendering and customization ​

Slots and fallthrough attributes are the headless customization API. Stable hooks:

  • class ghost-inline-alert
  • data-part="root" on the host
  • data-part="title" | "message" | "actions" on slot wrappers
  • data-ghost-inline-alert="" on the root for instance queries
  • no data-state at introduction

Themed recipe CSS applies under .ghost-theme, .ghost-themed-scope, or [data-themed] on the root. Layout is inline-start block flow (not centered like GhostEmptyState).

Environment behavior ​

SSR and hydration ​

Markup is deterministic from props and slot presence. Generated title ids come from useGhostId and must match between server and client (covered by expectSsrHydration). The exposed element is null until mount.

Mobile and touch ​

No gestures. Action buttons inside #actions own touch target size when using GhostButton.

Performance ​

Constant-time render. No listeners or observers.

Composition ​

useGhostInlineAlert owns root bindings. Unstyled GhostInlineAlert composes useGhostId. Optional actions compose with GhostButton. No overlay or portal primitives.

Machine-readable contracts: packages/vue/manifests/ghost-inline-alert.manifest.json and packages/themes/manifests/ghost-inline-alert.manifest.json.

Test plan ​

  • Vue unit tests: default markup, announce roles, section aria-labelledby only when announce is off, slots and part order, fallthrough, exposed element, composable contract, and SSR renderToString.
  • SSR hydration: expectSsrHydration for title id stability.
  • Compile-time tests for props and exposed ref.
  • Integration tests for themed wrapper and theme CSS token wiring.
  • Browser: axe on registered examples; live example with announce="alert" after interaction; action focus in actions slot.
  • Visual baselines for registered examples via pnpm test:visual:docker.

Documentation plan ​

docs/components/inline-alert.md with API reference, static vs live announce guidance, DataTable failure patterns, themed props, accessibility notes, and registered examples. Playground section mirroring headless and themed cases.

Compatibility and release impact ​

Additive; minor Changesets for @ghostvue/vue and @ghostvue/themes.

Open architectural questions ​

None blocking. GHO-38 remains undecided; this reuses existing data-part and class hooks.

Status tone amendment ​

Important

Approved on 2026-12-02 by zprue743. This amendment adds success and warning to the themed tone. It reuses the Badge status-tone mapping and adds no tokens. The maintainer zprue743 chose this tone set on 2026-12-01 and approved the amendment text on 2026-12-02. It is implemented in @ghostvue/themes, and the themed props table above includes both tones.

Why status tones ​

An inline alert that reports a healthy or degraded state has no tone for it. accent follows the brand color, so a "healthy" alert turns purple in Vibrant and is close to neutral in Mono. neutral reads as inactive, so a "degraded" alert looks like ordinary copy. GhostBadge already takes success and warning for the same reason; an alert next to a badge should be able to use the same tone.

Proposed public API ​

Themed GhostInlineAlert in @ghostvue/themes only:

PropTypeDefaultContract
tone'accent' | 'neutral' | 'danger' | 'success' | 'warning''neutral'Semantic color intent, independent of variant. Not a status enum.
  • GhostInlineAlertTone gains success and warning. The default stays neutral and still omits data-tone; the new tones render data-tone="success" and data-tone="warning".
  • info is not added. Informational copy keeps neutral, as on GhostBadge.
  • tone stays a color intent. The title and message carry the meaning, and announce still decides live-region semantics; tone never sets a role.
  • Headless @ghostvue/vue does not change: no prop, type, or manifest change.

Token mapping ​

accent, neutral, and danger keep their action-tone colors. success and warning read the existing status tokens, exactly as GhostBadge does, with no new tokens and no per-component tokens. Text applies to the root, the title, and the message:

VariantTextFillBorder
soft--ghost-status-<tone>-fg--ghost-status-<tone>-bg--ghost-status-<tone>-border
outline--ghost-status-<tone>-fgtransparent--ghost-status-<tone>-fg
ghost--ghost-status-<tone>-fgtransparenttransparent
solid--ghost-status-<tone>-bg--ghost-status-<tone>-fg--ghost-status-<tone>-fg

<tone> is success or warning.

  • Title and message. Both use the text color in the table. The neutral soft alert's muted message color is not used for status tones, because the required contrast pair is status.<tone>.fg on status.<tone>.bg.
  • Solid. solid swaps the fg and bg pair, so it keeps the same ratio. There is no gradient fill: themes define gradients only for action tones.
  • Actions. Transparent action controls in #actions (outline and ghost GhostButton) take the alert's text color in every variant. Today the recipe rule that does this matches only data-tone="danger". The implementation must extend it to success and warning. Without it, those buttons keep their default accent color, which can fall far below 3:1 on a solid status fill. Filled action buttons keep their own tone.
  • Forced colors. Unchanged: every tone resolves to CanvasText on Canvas.

Accessibility ​

Roles, names, live-region behavior, keyboard, and focus do not change. Color stays a supplementary encoding: the title and message still say what happened.

Implementation acceptance cases ​

  1. Wrapper (unit). tone="success" and tone="warning" render the matching data-tone; neutral and an omitted tone render none. A type test accepts both new tones and rejects tone="info".
  2. Token wiring (integration). The recipe maps each new tone and variant to the status tokens in the table, reads no action-tone token for them, and turns the solid gradient off.
  3. Contrast. pnpm contrast keeps the --ghost-status-success-* and --ghost-status-warning-* text and fill pairs at WCAG 2 AA in light and dark for all four flagships (default, Calm, Vibrant, Mono). A browser check measures the rendered title and message text of each new tone in every variant, in light and dark, for the same four themes (at least 4.5:1).
  4. Transparent actions. The existing danger-action contrast matrix in tests/e2e/ghost-inline-alert.spec.ts also covers success and warning. For each new tone, every alert variant (solid, soft, outline, ghost), outline and ghost action buttons, light and dark, and all four flagships, it requires the following. The button label is at least 4.5:1 against the alert fill. The focus ring of the focused button is at least 3:1. The outline button border is opaque and at least 3:1. The ghost button border stays transparent. A registered example or playground fixture provides one alert per new tone with a transparent action.
  5. Distinct tones in Mono. In Mono, light and dark, a browser check renders neutral, success, warning, and danger soft alerts side by side and asserts that adjacent tones resolve to different text colors and fills.
  6. Defaults unchanged. Existing tones, the neutral default, and the registered examples render as before.
  7. Manifests and API tables. pnpm manifests:write records the tones in packages/themes/manifests/ghost-inline-alert.manifest.json, and pnpm docs:api:write updates the generated API table.

Documentation plan ​

  • docs/components/inline-alert.md explains which tone to pick (success for healthy or completed, warning for degraded or needs attention soon, danger for failures) and that accent does not mean success.
  • One runnable example shows the status tones side by side.
  • A @ghostvue/themes Changeset.

Compatibility ​

Additive for @ghostvue/themes (minor Changeset). Existing tones, the neutral default, and omitted-attribute behavior are unchanged, and @ghostvue/vue is untouched. Removing a tone, or adding a tone not listed here, requires compatibility review.