Notification

Toasts: notify(), updateNotification(), hideNotification(), clearNotifications(); shown in a ray-toaster (a polite live region in the top layer). ray-notification is usable on its own.

Source on GitHub

Notify With an action Loading → done Error
ray-remote 0.4.1 is ready to publish. type error at 12:5: 'f' expects 2 argument(s) update.json is signed with a key that expires in 7 days. ray 0.9 is available. bundle-macos-arm64.zip Sunday, December 3 at 9:00 AM

Several toasts stack; hover (or tap, on touch screens) to spread them. Swipe one sideways to dismiss it.

Code

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-notification>

notify({ id, title, message, color, icon, loading, autoClose (ms, default 4000; false = stays), closable, withBorder, onClose }) returns its id. A color adds a status icon in that color: green/teal a check, red/pink an error, yellow/orange a warning, others info. The status icon and the loader are 1.5rem with a 1.5 stroke; set --ray-notification-icon-size and --ray-notification-icon-stroke to change them.

PropertyAttributeTypeDefaultDescription
labellabelstringTitle.
colorcolor reflectsstringStatus color: tints the status icon (and a slotted icon's circle).
iconiconstringStatus icon from the registry (default: from the color); "none" for no icon.
loadingloading reflectsbooleanShows a spinner (notify() does not auto-close it).
hideClosehide-close reflectsbooleanNo close button.
withBorderwith-border reflectsbooleanDraws a border.
actionLabelaction-labelstringText of an action button (e.g. "Undo"); pressing it fires ray-action.
actionIcon—objectBefore the action's text: an icon name, or a node (a <ray-pulse> while an alarm rings).
actions—objectSeveral action buttons (e.g. "Taken" and "Snooze"); replaces actionLabel. Each takes a button variant (default "default"; "filled" marks the main answer), a color (default the notification's) and a name (adds the part action-<name>). Pressing one fires ray-action with its index.
EventDescription
ray-closeThe close button was pressed.
ray-actionAn action button was pressed; detail.index says which (notify() runs its onClick and closes it).
SlotDescription
(default)Message.
actionYour own action controls (ray-button…), beside the close button, after the action buttons.
iconYour own icon, in a colored circle (replaces the status icon).
PartDescription
actionsThe row of action buttons and the action slot.
actionEach action button. Each also has the part action-<index> (action-0, action-1…) and, with a name, action-<name>, to style one alone.
status-iconThe status icon.

<ray-toaster>

Created by notify() when missing; add one yourself to choose its position. A stack (newest in front, older ones peeking behind) that spreads into a list on hover or keyboard focus; on touch screens a tap expands it, a tap outside collapses it, and a sideways swipe dismisses a toast. Auto-close pauses while expanded. Full width on phones.

PropertyAttributeTypeDefaultDescription
positionposition reflectsbottom-end | bottom-start | bottom-center | top-end | top-start | top-center | bottom-right | bottom-left | top-right | top-leftbottom-endCorner of the stack: -start/-end follow the writing direction; -left/-right are sides of the screen.
limitlimitnumber5Maximum kept; the oldest go first.
visiblevisiblenumber3Toasts shown in the collapsed stack (the rest wait, hidden).
expandexpand reflectsbooleanAlways expanded: a list instead of a stack.
gapgapnumber12Pixels between toasts when expanded.

Texts

What it writes itself, in English; setStrings() translates them (Getting started: Languages).

KeyEnglish
notification.closeClose notification
notification.regionNotifications