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

Toast

A brief notification in a fixed corner stack; canvas surface behind a 1px overlay border, status tints for the four polite statuses and the danger fill for critical ones.

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

Live variants

default

Settings saved.

Markup
<j3w1-toast id="example-toast-default"><div class="toast-stack" role="region" aria-label="Notifications">
  <div class="toast" role="status">
    <span class="toast-glyph" aria-hidden="true">i</span>
    <p class="toast-text">Settings saved.</p>
    <button class="toast-close" type="button" aria-label="Dismiss">✕</button>
    <span class="toast-count" aria-hidden="true">+2</span>
  </div>
</div></j3w1-toast>

status

Battery at 10%.

Screenshot copied.

Workspace 3 moved to the left output.

Layout locked.

Markup
<j3w1-toast id="example-toast-status"><div class="toast-stack" role="region" aria-label="Notifications">
  <div class="toast toast-danger" role="alert">
    <span class="toast-glyph" aria-hidden="true">✕</span>
    <p class="toast-text">Connection lost. Changes are queued.</p>
    <button class="toast-close" type="button" aria-label="Dismiss">✕</button>
  </div>
  <div class="toast toast-warning" role="status">
    <span class="toast-glyph" aria-hidden="true">!</span>
    <p class="toast-text">Battery at 10%.</p>
    <button class="toast-close" type="button" aria-label="Dismiss">✕</button>
  </div>
  <div class="toast toast-success" role="status">
    <span class="toast-glyph" aria-hidden="true">✓</span>
    <p class="toast-text">Screenshot copied.</p>
    <button class="toast-close" type="button" aria-label="Dismiss">✕</button>
  </div>
  <div class="toast toast-info" role="status">
    <span class="toast-glyph" aria-hidden="true">i</span>
    <p class="toast-text">Workspace 3 moved to the left output.</p>
    <button class="toast-close" type="button" aria-label="Dismiss">✕</button>
  </div>
  <div class="toast toast-neutral" role="status">
    <span class="toast-glyph" aria-hidden="true">·</span>
    <p class="toast-text">Layout locked.</p>
    <button class="toast-close" type="button" aria-label="Dismiss">✕</button>
    <span class="toast-count" aria-hidden="true">+2</span>
  </div>
</div></j3w1-toast>

with-action

Window closed.

Markup
<j3w1-toast id="example-toast-with-action"><div class="toast-stack" role="region" aria-label="Notifications">
  <div class="toast" role="status">
    <span class="toast-glyph" aria-hidden="true">i</span>
    <p class="toast-text">Window closed.</p>
    <button class="toast-action" type="button">Undo</button>
    <button class="toast-close" type="button" aria-label="Dismiss">✕</button>
    <span class="toast-count" aria-hidden="true">+2</span>
  </div>
</div></j3w1-toast>

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/toast.css';
import '@j3w1/ui/register/toast';

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 toast --out ./vendor/j3w1/toast

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

Toast toast

  • Family: Feedback and overlays
  • Maturity: stable
  • Priority: R1
  • Since: 0.1.0
  • Native control: native <div role=status> (role=alert for danger) inside a region named Notifications; native buttons for the action and dismiss — APG pattern
  • specified
  • demonstrated

A brief notification in a fixed corner stack; canvas surface behind a 1px overlay border, status tints for the four polite statuses and the danger fill for critical ones.

Report an issue with this component

Tokens

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

PartRoleValueUse
root.bgcolor.surface.canvasapproveduse#000000Page and terminal background.
root.bordercolor.border.overlayapproveduse#c81a1aD-041 owner correction: red control and floating-frame borders, distinct from rose text.
root.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.
glyph.textcolor.status.info.textapproveduse#82b4ffD-041 status.info.text: color.primitive.modern.blue.
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.
danger.bgcolor.status.danger.fillobserveduse#dc282eDanger fill.
danger.textcolor.status.danger.on-fillobserveduse#f9faf9Text on the danger fill (4.58:1).
danger.button-bg-hovercolor.action.destructive.pressed-bgobserveduse#ae1914Destructive button pressed fill.
action.textcolor.text.linkapproveduse#f73f35Strong red link text, distinct from rose body text and headings; retain the underline.
action.bg-hovercolor.interaction.hover.bgapproveduse#1c1010D-041 interaction.hover.bg: color.primitive.modern.hover.
action.text-hovercolor.text.link-hoverobserveduse#f4eeeeLink text on hover, over interaction.hover.bg-strong.
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.
count.textcolor.text.mutedapproveduse#d4868bD-041 owner correction: rose is the default UI and reading foreground; near-white is reserved for document headings, highlights and contrast-critical fills.
stack.zz.toastobserveduse40

State matrix

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

StatePlainFive statuses stackedWith action
default

Settings saved.

Battery at 10%.

Screenshot copied.

Workspace 3 moved to the left output.

Layout locked.

Window closed.

hover
focus-visible
stacked
reduced-motion

Purpose

A short notice that belongs to no one element on the page: “Saved”, “Copied”, “Connection lost”. It leaves on its own after a pause or when dismissed. A decision is a dialog; a notice tied to a form is an alert.

Anatomy

Parts as listed in the anatomy. The danger toast is the historical critical notification: color.status.danger.fill with color.status.danger.on-fill for the text, the glyph and both buttons.

States

StateVisualNon-colour channel
defaultcanvas surface, 1px overlay border, glyph in the status text colourthe glyph; the worded text
hoveraction → color.interaction.hover.bg with color.text.link-hover; Dismiss → color.action.tertiary.hover-bg; the timeout pausescursor: pointer; the action’s underline thickens
focus-visible1px dashed color.interaction.focus.ring at −2px on the focused button, color.status.danger.on-fill on the danger fill; the timeout pausesthe ring
stackedone column, 4px gap, newest at the end; the last visible toast shows “+n” in color.text.mutedthe count text; at most three visible
reduced-motionno transition; present or absentprefers-reduced-motion; nothing moves

No disabled, selected or busy state.

Keyboard

As in the key table. F6 is the web reference’s shortcut; the timeout pauses while a toast has focus or the pointer.

Accessibility

The text states the outcome in words; the glyph is aria-hidden. Every toast has Dismiss; the timeout, at least 8 seconds, is extended for toasts with an action, and an action is never the only way to reach what it does. Text meets 4.5:1 on the canvas, on its tint and on the danger fill; borders, and the danger fill against the canvas, 3:1.

Portability

Hosts with a notification daemon send the text and urgency instead of drawing a toast. Toolkits with a native toast overlay use it and record that the danger fill is not available.

Non-examples

A toast that slides in. A rounded, shadowed pill. No Dismiss and gone in two seconds. Taking focus on appearance. More than three stacked with no count. A form error as a toast. Colour-only status without the glyph and worded text.

Contrast report

26 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
toast default textdefaulttextcolor.text.default #e99499color.surface.canvas #0000009.164.5pass
toast default borderdefaultuicolor.border.overlay #c81a1acolor.surface.canvas #0000003.623pass
toast hover texthovertextcolor.text.link-hover #f4eeeecolor.interaction.hover.bg #1c101016.194.5pass
toast focus-visible textfocus-visibletextcolor.action.tertiary.text #e99499color.surface.canvas #0000009.164.5pass
toast focus-visible outlinefocus-visibleuicolor.interaction.focus.ring #e53935color.surface.canvas #0000004.973pass
toast stacked textstackedtextcolor.text.muted #d4868bcolor.surface.canvas #0000007.584.5pass
toast stacked borderstackeduicolor.border.overlay #c81a1acolor.surface.canvas #0000003.623pass
toast reduced-motion textreduced-motiontextcolor.text.default #e99499color.surface.canvas #0000009.164.5pass
toast reduced-motion borderreduced-motionuicolor.border.overlay #c81a1acolor.surface.canvas #0000003.623pass
glyph on the plain toast—textcolor.status.info.text #82b4ffcolor.surface.canvas #0000009.924.5pass
action text on the plain toast—textcolor.text.link #f73f35color.surface.canvas #0000005.724.5pass
warning glyph on its tint—textcolor.status.warning.text #e5c07bcolor.status.warning.tint #1f1a0c10.044.5pass
warning border on its tint—uicolor.status.warning.border #e5c07bcolor.status.warning.tint #1f1a0c10.043pass
text on the warning tint—textcolor.text.default #e99499color.status.warning.tint #1f1a0c7.564.5pass
success glyph on its tint—textcolor.status.success.text #82d9a0color.status.success.tint #0f1a0e10.544.5pass
success border on its tint—uicolor.status.success.border #82d9a0color.status.success.tint #0f1a0e10.543pass
text on the success tint—textcolor.text.default #e99499color.status.success.tint #0f1a0e7.804.5pass
info glyph on its tint—textcolor.status.info.text #82b4ffcolor.status.info.tint #0f141c8.734.5pass
info border on its tint—uicolor.status.info.border #82b4ffcolor.status.info.tint #0f141c8.733pass
text on the info tint—textcolor.text.default #e99499color.status.info.tint #0f141c8.064.5pass
neutral glyph on its tint—textcolor.status.neutral.text #d4868bcolor.status.neutral.tint #140b0b7.014.5pass
neutral border on its tint—uicolor.status.neutral.border #986f72color.status.neutral.tint #140b0b4.483pass
text on the neutral tint—textcolor.text.default #e99499color.status.neutral.tint #140b0b8.464.5pass
text, glyph and buttons on the danger fill—textcolor.status.danger.on-fill #f9faf9color.status.danger.fill #dc282e4.584.5pass
the danger fill is its own boundary against the canvas—uicolor.status.danger.fill #dc282ecolor.surface.canvas #0000004.393pass
danger border on the danger fill (decorative)—uicolor.status.danger.border #e53935color.status.danger.fill #dc282e1.131pass

Keys

KeyAction
F6 / a host shortcutMoves focus into the notification region; toasts never steal focus when they appear.
Tab / Shift+TabWithin the region, reaches the action and then Dismiss of each toast in order.
Enter / SpaceActivates the action or dismisses.
EscapeDismisses the focused toast and returns focus to the region, then to the page.

For agents

Component JSON ·Implementation brief ·Build a task kit ·

Related: alert dialog progress badge

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