Toast
Short notifications in the bottom-right corner.
Use toast() to confirm an action or report an error without blocking the page. Toasts stack in the bottom-right corner and close after 4.5 seconds.
Toasts use a dark surface, so they stand out above dense record pages. A 16px icon shows the tone. There is no coloured side bar.
Tones
The preview above places the toasts in the page so you can see every tone. Click a button below to show a real toast in the corner.
Options
| Option | Default | Description |
|---|---|---|
title | empty | Bold first line. |
message | empty | Muted second line. Hidden when empty. |
tone | info | info, success, warning or danger. Sets the icon and its colour. |
duration | 4500 | Milliseconds before the toast closes. 0 keeps it open. |
Pass a string to show a title only: NSUI.toast('Saved').
Sticky toasts and dismissing
Set duration: 0 to keep the toast until the user closes it. toast() returns a function that closes the toast from code.
Motion
A toast slides up 16px from the bottom edge and fades in over 200ms. It leaves to the same edge in 150ms. The other toasts slide to their new places. With reduced motion, toasts only fade.
Theming
The surface uses --nsui-fg and the title uses --nsui-bg. The message uses --nsui-ink-muted. A 1px border uses --nsui-ink-border. The icons use --nsui-info-ink, --nsui-success-ink, --nsui-warning-ink and --nsui-danger-ink. If your theme makes --nsui-fg light, set these to dark values.
Accessibility
The toast region is a polite live region. danger toasts use role="alert", so screen readers announce them at once. Other tones use role="status". The icons are hidden from screen readers; the title carries the meaning. The close button is 24px and has the label "Dismiss".
Toaster
toast() adds one <nsui-toaster> to the page on first use. You do not need to add it yourself. It has no attributes.
API
NSUI is a community project. It is not an official Oracle NetSuite product. NetSuite is a trademark of Oracle.