Notification
Keep people informed with messages they can act on or dismiss, with optional automatic closing.
Live TypeScript example
Try the component here, then use the source below in your application.
- JavaScript
- 3.8 KiB
- Component CSS
- 1.1 KiB
- Shared theme CSS
- 3.8 KiBonce per application
How sizes are measured
The JavaScript figure includes this component’s required helpers. CSS includes its styling dependencies. Each entry is bundled separately for ES2022, minified, then compressed with gzip level 9. Your bundler may share helpers across components. Images, fonts, examples and application code are excluded.
Before compression: JavaScript 9.7 KiB; component CSS 2.8 KiB. These figures describe browser assets, not the complete package download.
View all component measurements →Interact with the Notification example. The code below shows its actual inputs and callbacks.
import '@blukavantui/web/theme.css'
import {createNotification} from '@blukavantui/web/notification';
import {showNotification} from '@blukavantui/web/notification';
import {updateNotification} from '@blukavantui/web/notification';
import '@blukavantui/web/notification.css';
export function mount(host: HTMLElement) {
const hostKey = "example-" + crypto.randomUUID();
const notices = createNotification(host, { HostKey: hostKey });
const button = document.createElement("button");
button.textContent = "Show notification";
button.className = "blu-common-button blu-common-button--primary";
button.onclick = () => showNotification({ Key: "saved", Title: "Changes saved", Color: "Success", Duration: 0 }, hostKey);
const update = document.createElement("button");
update.textContent = "Show then update";
update.className = "blu-common-button";
update.onclick = () => {
showNotification({ Key: "export", Title: "Preparing export", Color: "Processing", Duration: 0 }, hostKey);
updateNotification({ Key: "export", Title: "Export ready", Description: "Your application supplies the real export result.", Color: "Success", Duration: 0 }, hostKey);
};
host.append(button, update);
return { destroy() { notices.destroy(); button.remove(); update.remove(); } };
}
const instance = mount(document.getElementById('example')!)
// When this page or framework component is removed:
// instance.destroy()
Install the library and add the host element
npm install https://blukavantui.blutekmedia.com/downloads/blukavantui-web-0.6.2.tgz<div id="example"></div>This example uses the downloadable @blukavantui/web package. Your application handles persistence and authentication through its typed callbacks. The starter ZIP includes this same example.
createNotification
Pass options as the second argument and callbacks in the third argument. Keep the returned instance to update options or dispose it when its view is removed.
import { createNotification } from '@blukavantui/web/notification';
import '@blukavantui/web/notification.css';Load @blukavantui/web/theme.css once in your app shell.createNotification(host: HTMLElement, options: T.NotificationOptions, events?: T.NotificationEvents)Reference for @blukavantui/web 0.6.2. Required and optional follow the shipped TypeScript declarations; optional does not imply a particular default. Pass typed arrays and objects directly where shown.
Options
5| Name | Type / requirement | Usage |
|---|---|---|
HostKey | stringOptional | Unique key used by Notification_Show, Notification_Update and Notification_Dismiss. Use one host per key. |
Placement | stringOptional | TopRight, TopLeft, BottomRight or BottomLeft. |
MaxVisible | numberOptional | Maximum visible messages (1–10). Older messages are dismissed when exceeded. |
AccessibleLabel | stringOptional | Accessible name of the message region. |
ExtendedClass | stringOptional | Additional CSS classes on the component root. |
Callbacks
3| Name | Type / requirement | Usage |
|---|---|---|
Action | (key: string) => unknownOptional | |
Dismissed | (key: string, reason: string) => unknownOptional | |
Error | (message: string) => unknownOptional |
Instance methods & properties
3| Name | Signature / type | Usage |
|---|---|---|
element | HTMLElement | Root owned by this instance. Dispose before removing its host. |
update | (patch: Partial<T.NotificationOptions>) => void | Apply a partial options update to this instance. |
destroy | () => void | Dispose the instance and its listeners when the view is removed. |
Exported helpers
showNotification
showNotification(message: T.BluNotificationMessage, hostKey?: string): stringupdateNotification
updateNotification(message: T.BluNotificationMessage, hostKey?: string): stringdismissNotification
dismissNotification(key?: string, hostKey?: string): voidRelated data types
Expand a type for its fields and allowed values.
BluNotificationMessage
interface BluNotificationMessage {
/** Stable unique key. Reusing it updates a message. */
Key: string;
/** Message heading. */
Title: string;
/** Supporting message text. */
Description?: string;
/** Shared ComponentColor code. Error and Danger are assertively announced. */
Color?: string;
/** Visible seconds; default 0 stays until dismissed. Use a timed message only when its information is also available persistently. Pauses on hover and focus. */
Duration?: number;
/** Optional action caption; emits OnAction then dismisses. */
ActionLabel?: string;
}Use these inputs, events, actions and structures in Service Studio. Names and data bindings are specific to the native Blocks.
Part of the full commercial BluKavantUI for OutSystems edition. View OutSystems editions →
Open OutSystems showcase ↗- Web runtime
- Supported
- TypeScript
- Supported
- OutSystems
- Supported
Statuses describe the component’s rendered code and interactions. Supply accessible content and follow the component guidance when integrating it.
Accessibility guidance →Purpose and use
Keep people informed with messages they can act on or dismiss, with optional automatic closing.
Keyboard design guidance
Timers pause while a message is hovered or focused. Action and dismiss controls are labelled. Errors are announced assertively.
See the support status above for review coverage and any limitations.
In your application
Provide useful labels, preserve visible focus, and test the component with your actual content. Use text alongside status colors and check contrast in each state.
Events0No events yet.
Interact with an example to see its events.