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.
Several toasts stack; hover (or tap, on touch screens) to spread them. Swipe one sideways to dismiss it.
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.
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
label | label | string | Title. | |
color | color reflects | string | Status color: tints the status icon (and a slotted icon's circle). | |
icon | icon | string | Status icon from the registry (default: from the color); "none" for no icon. | |
loading | loading reflects | boolean | Shows a spinner (notify() does not auto-close it). | |
hideClose | hide-close reflects | boolean | No close button. | |
withBorder | with-border reflects | boolean | Draws a border. | |
actionLabel | action-label | string | Text of an action button (e.g. "Undo"); pressing it fires ray-action. | |
actionIcon | — | object | Before the action's text: an icon name, or a node (a <ray-pulse> while an alarm rings). | |
actions | — | object | Several 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. |
| Event | Description |
|---|---|
ray-close | The close button was pressed. |
ray-action | An action button was pressed; detail.index says which (notify() runs its onClick and closes it). |
| Slot | Description |
|---|---|
| (default) | Message. |
action | Your own action controls (ray-button…), beside the close button, after the action buttons. |
icon | Your own icon, in a colored circle (replaces the status icon). |
| Part | Description |
|---|---|
actions | The row of action buttons and the action slot. |
action | Each action button. Each also has the part action-<index> (action-0, action-1…) and, with a name, action-<name>, to style one alone. |
status-icon | The 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.
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
position | position reflects | bottom-end | bottom-start | bottom-center | top-end | top-start | top-center | bottom-right | bottom-left | top-right | top-left | bottom-end | Corner of the stack: -start/-end follow the writing direction; -left/-right are sides of the screen. |
limit | limit | number | 5 | Maximum kept; the oldest go first. |
visible | visible | number | 3 | Toasts shown in the collapsed stack (the rest wait, hidden). |
expand | expand reflects | boolean | Always expanded: a list instead of a stack. | |
gap | gap | number | 12 | Pixels between toasts when expanded. |
Texts
What it writes itself, in English; setStrings() translates them (Getting started: Languages).
| Key | English |
|---|---|
notification.close | Close notification |
notification.region | Notifications |