j3w1 / theme

j3w1 / theme4.0.0

j3w1 / command

  • SPEC Overview
  • SPEC Foundations
  • SPEC Components
  • SPEC Patterns
  • SPEC Tokens
  • SPEC Tools
  • SPEC Workbench
  • SPEC Form builder
  • SPEC Task kit
  • SPEC Recipes
  • SPEC Figma bridge
  • SPEC Report an issue
  • SPEC Implement
  • SPEC For agents
  • SPEC Ports
  • SPEC Releases
  • SPEC Specification
  • DEMO Vue application demo

Alert

An inline status message with a mandatory glyph on the status tint behind a 1px status border; role alert for danger, status otherwise.

stable · light DOM · 4.0.0. Light DOM retains static content, native semantics, label relationships and host composition without duplicating controls.

Live variants

danger

Markup
<j3w1-alert id="example-alert-danger"><div class="alert alert-danger" role="alert">
  <span class="alert-glyph" aria-hidden="true">✕</span>
  <div class="alert-body">
    <strong class="alert-title">Build failed</strong>
    <p class="alert-text">Two token references do not resolve in the default profile.</p>
  </div>
</div></j3w1-alert>

warning

Unsaved changes

The draft is kept locally until you publish.

Markup
<j3w1-alert id="example-alert-warning"><div class="alert alert-warning" role="status">
  <span class="alert-glyph" aria-hidden="true">!</span>
  <div class="alert-body">
    <strong class="alert-title">Unsaved changes</strong>
    <p class="alert-text">The draft is kept locally until you publish.</p>
  </div>
</div></j3w1-alert>

success

Saved

The settings apply to new windows.

Markup
<j3w1-alert id="example-alert-success"><div class="alert alert-success" role="status">
  <span class="alert-glyph" aria-hidden="true">✓</span>
  <div class="alert-body">
    <strong class="alert-title">Saved</strong>
    <p class="alert-text">The settings apply to new windows.</p>
  </div>
</div></j3w1-alert>

info

Fonts

The reference font is not distributed; a metric-compatible fallback is used.

Markup
<j3w1-alert id="example-alert-info"><div class="alert alert-info" role="status">
  <span class="alert-glyph" aria-hidden="true">i</span>
  <div class="alert-body">
    <strong class="alert-title">Fonts</strong>
    <p class="alert-text">The reference font is not distributed; a metric-compatible fallback is used.</p>
  </div>
</div></j3w1-alert>

neutral

Read only

This profile is approved; open a decision to change it.

Markup
<j3w1-alert id="example-alert-neutral"><div class="alert alert-neutral" role="status">
  <span class="alert-glyph" aria-hidden="true">·</span>
  <div class="alert-body">
    <strong class="alert-title">Read only</strong>
    <p class="alert-text">This profile is approved; open a decision to change it.</p>
  </div>
</div></j3w1-alert>

dismissible

New version

Example notification. Dismiss removes this local message.

Markup
<j3w1-alert id="example-alert-dismissible"><div class="alert alert-info" role="status">
  <span class="alert-glyph" aria-hidden="true">i</span>
  <div class="alert-body">
    <strong class="alert-title">New version</strong>
    <p class="alert-text">Example notification. Dismiss removes this local message.</p>
  </div>
  <button class="alert-close" type="button" aria-label="Dismiss">✕</button>
</div></j3w1-alert>

Install and register

Use the exact version. If npm publication is pending, install the release tarball from the installation guide.

npm install --save-exact @j3w1/ui@4.0.0
import '@j3w1/ui/tokens.css';
import '@j3w1/ui/styles/alert.css';
import '@j3w1/ui/register/alert';

Insert the maintained markup above after loading these imports. Its native children provide accessible names and form behavior; the empty custom tag alone does not create a control.

Vue SFC, React, Astro and plain HTML integration →

Copy the complete implementation

npx --package=@j3w1/ui@4.0.0 j3w1-ui copy alert --out ./vendor/j3w1/alert

The CLI verifies every file before writing and refuses overwrites. Serve the output over HTTP and open index.html. Keep its modules, CSS, tokens and licence notices together.

Public API

attributes

NameType / signatureMeaning
disabledCustomEventDisable the native controls owned by this instance.
loadingCustomEventMark the primary control busy and prevent duplicate activation.

properties

NameType / signatureMeaning
disabledbooleanDelegates disabled state to native children.
namestringNative control name; application form keys remain explicit.

methods

NameType / signatureMeaning
refresh(): voidReconnect behavior after replacing native child structure.
focus(options?: FocusOptions): voidFocus the first usable native control.
dismiss(id?: string): voidDismiss a message; focused actions move to the next available control.

events

NameType / signatureMeaning
j3w1-dismissCustomEventCancelable message dismissal.
j3w1-retryCustomEventRequest recovery; the host owns the result.
j3w1-actionCustomEventAn explicit message action.

Dependencies and verification

Registered components: none. Style dependencies: none.

Package presence establishes an available implementation. Actual passes depend on the tested artifact and environment. Read specification execution evidence; read packed-consumer evidence; inspect the complete state matrix.

Full implementation manifest, API and token dependency closure

Canonical specification

Alert alert

  • Family: Feedback and overlays
  • Maturity: stable
  • Priority: R1
  • Since: 0.1.0
  • Native control: native landmark-free block; role=alert for danger, role=status for every other status; an optional native close button — APG pattern
  • specified
  • demonstrated

An inline status message with a mandatory glyph on the status tint behind a 1px status border; role alert for danger, status otherwise.

Report an issue with this component

Tokens

Focus a role to inspect its values; follow its link for persistent usage and source details.

PartRoleValueUse
danger.bgcolor.status.danger.tintobserveduse#2b0e0dDanger background tint.
danger.bordercolor.status.danger.borderobserveduse#e53935Danger border, 2px on invalid inputs.
danger.textcolor.status.danger.textobserveduse#f07178D-041 readable error text on neutral surfaces and native warning tints.
warning.bgcolor.status.warning.tintapproveduse#1f1a0cWarning background tint.
warning.bordercolor.status.warning.borderapproveduse#e5c07bD-041 status.warning.border: color.primitive.modern.amber.
warning.textcolor.status.warning.textapproveduse#e5c07bD-041 status.warning.text: color.primitive.modern.amber.
success.bgcolor.status.success.tintapproveduse#0f1a0eSuccess background tint.
success.bordercolor.status.success.borderapproveduse#82d9a0D-041 status.success.border: color.primitive.modern.green.
success.textcolor.status.success.textapproveduse#82d9a0D-041 status.success.text: color.primitive.modern.green.
info.bgcolor.status.info.tintapproveduse#0f141cInfo background tint.
info.bordercolor.status.info.borderapproveduse#82b4ffD-041 status.info.border: color.primitive.modern.blue.
info.textcolor.status.info.textapproveduse#82b4ffD-041 status.info.text: color.primitive.modern.blue.
neutral.bgcolor.status.neutral.tintapproveduse#140b0bD-041 status.neutral.tint: color.primitive.modern.raised.
neutral.bordercolor.status.neutral.borderapproveduse#986f72D-041 status.neutral.border: color.primitive.modern.control.
neutral.textcolor.status.neutral.textapproveduse#d4868bD-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
body.textcolor.text.defaultapproveduse#e99499D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
close.textcolor.action.tertiary.textapproveduse#e99499D-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
close.bg-hovercolor.action.tertiary.hover-bgobserveduse#1c0a09Ghost and icon button hover.
close.ringcolor.interaction.focus.ringobserveduse#e539351px dashed focus ring on controls and rows.

State matrix

Every declared state and combination, statically rendered; the default cell is live. Sizes: compact, comfortable (switch with the density control above).

StateDangerWarningSuccessInfoNeutralDismissible
default
Unsaved changes

The draft is kept locally until you publish.

Saved

The settings apply to new windows.

Fonts

The reference font is not distributed; a metric-compatible fallback is used.

Read only

This profile is approved; open a decision to change it.

New version

0.2.0 adds the extended overlay.

hover
focus-visible

Purpose

A status message that belongs to the page or form around it: a failed submit, a saved draft, a deprecation notice. It stays in flow, is never timed, and is announced once when it appears. Transient confirmations are toasts; blocking questions are dialogs.

Anatomy

Parts as listed in the anatomy. Each of the five statuses uses its own tint, border and text roles.

States

StateVisualNon-colour channel
defaultstatus tint, 1px status border, glyph and title in the status text colourthe glyph ✕ ! ✓ i ·
hoverclose button → color.action.tertiary.hover-bg; the alert itself does not reactcursor: pointer on the button only
focus-visible1px dashed color.interaction.focus.ring ring at −2px on the close buttonthe ring

No disabled, selected or loading state: a message that is no longer true is removed, not greyed.

Keyboard

As in the key table. Escape does nothing so a page-level Escape handler is never swallowed.

Accessibility

Danger is role="alert" (assertive) because it needs attention now; the other four are role="status" (polite). The container exists before its text is set so the live region fires; never inject text together with the container. The glyph is aria-hidden and the title states the status in words (“Build failed”, “Saved”), so nothing depends on colour or the glyph alone. The close button is at least 24×24 CSS pixels. Text meets 4.5:1 on every tint; borders 3:1.

Portability

The glyph is a text character, not an icon font. A toolkit with a native info bar maps its type to the five statuses and keeps the glyph in the text; one without a tint draws the border only and records the deviation.

Non-examples

A coloured left stripe with no border. A rounded, shadowed card. A banner that slides in or auto-dismisses. Colour-only status without the glyph and a worded title. role="alert" for success. A close icon with no accessible name. Fixed-position alerts covering content.

Contrast report

20 declared pairs measured on resolved sRGB values with the WCAG 2.x formula; 0 waived (decorative only), 0 failing. A pass is a design target for the named role, not an application-wide conformance claim.

PairStateKindForegroundBackgroundRatioMinResult
alert default textdefaulttextcolor.status.danger.text #f07178color.status.danger.tint #2b0e0d6.274.5pass
alert default borderdefaultuicolor.status.danger.border #e53935color.status.danger.tint #2b0e0d4.243pass
alert hover texthovertextcolor.action.tertiary.text #e99499color.action.tertiary.hover-bg #1c0a098.354.5pass
alert focus-visible textfocus-visibletextcolor.action.tertiary.text #e99499color.status.info.tint #0f141c8.064.5pass
alert focus-visible outlinefocus-visibleuicolor.interaction.focus.ring #e53935color.status.info.tint #0f141c4.373pass
body text on the danger tint—textcolor.text.default #e99499color.status.danger.tint #2b0e0d7.824.5pass
warning glyph and title on the warning tint—textcolor.status.warning.text #e5c07bcolor.status.warning.tint #1f1a0c10.044.5pass
warning border on the warning tint—uicolor.status.warning.border #e5c07bcolor.status.warning.tint #1f1a0c10.043pass
body text on the warning tint—textcolor.text.default #e99499color.status.warning.tint #1f1a0c7.564.5pass
success glyph and title on the success tint—textcolor.status.success.text #82d9a0color.status.success.tint #0f1a0e10.544.5pass
success border on the success tint—uicolor.status.success.border #82d9a0color.status.success.tint #0f1a0e10.543pass
body text on the success tint—textcolor.text.default #e99499color.status.success.tint #0f1a0e7.804.5pass
info glyph and title on the info tint—textcolor.status.info.text #82b4ffcolor.status.info.tint #0f141c8.734.5pass
info border on the info tint—uicolor.status.info.border #82b4ffcolor.status.info.tint #0f141c8.733pass
body text on the info tint—textcolor.text.default #e99499color.status.info.tint #0f141c8.064.5pass
neutral glyph and title on the neutral tint—textcolor.status.neutral.text #d4868bcolor.status.neutral.tint #140b0b7.014.5pass
neutral border on the neutral tint—uicolor.status.neutral.border #986f72color.status.neutral.tint #140b0b4.483pass
body text on the neutral tint—textcolor.text.default #e99499color.status.neutral.tint #140b0b8.464.5pass
close button on the info tint—textcolor.action.tertiary.text #e99499color.status.info.tint #0f141c8.064.5pass
ring on the info tintfocus-visibleuicolor.interaction.focus.ring #e53935color.status.info.tint #0f141c4.373pass

Keys

KeyAction
TabReaches the close button when present; the alert itself is never focusable.
Enter / SpaceDismisses; focus returns to the element that had it, or to the next focusable element after the alert.
EscapeNothing; alerts are not dialogs.

For agents

Component JSON ·Implementation brief ·Build a task kit ·

Related: toast badge dialog empty-state error-state

Stress fixtures: FX-LONG FX-320 FX-ZOOM-200 FX-I18N FX-RTL FX-RM FX-HC FX-STATE-MATRIX