Skip to content

Notify

A utility function to show toast notifications dynamically mounted on the page. Supports multiple notification types, customizable titles, messages, and positions, with automatic dismissal and smooth animations.

vue
<template>
  <!-- plugin example -->
  <button @click="$notify({title: 'Success!', message: 'Object saved'})"> </button>
</template>
<script> 
import { notify } from '@opengis/core';

// function example
notify({
  type: 'success',
  title: 'Success!',
  message: 'Your changes have been saved.',
  position: 'top',
});
</script>
Interface
ts
export type Notify = {
  type?: 'success' | 'warning' | 'error' | 'info';
  title: string;
  message: string;
  position?: 'top' | 'right-bottom' | 'left-bottom' | 'bottom';
};
API
ParameterTypeDefaultDescription
type'success' | 'warning' | 'error' | 'info''info'Notification type, controls icon and styling
titlestringrequiredNotification title
messagestringrequiredNotification message
position'top' | 'right-bottom' | 'left-bottom' | 'bottom''right-bottom'Screen position where notifications appear

Type

Defines the message style and semantic meaning — e.g., success for positive feedback, warning for caution, error for failure, and info for neutral notifications.

ts
notify({
    type: "success", // type: 'success' | 'warning' | 'error' | 'info'
    title: "Changes saved",
    message: "Your product changes have been saved.",
    position: "right-bottom",
  });

Position

Specifies where the element appears on the screen — top, bottom, or anchored to a bottom corner (right-bottom, left-bottom).

Top

ts
notify({
  type: "info",
  title: "Changes saved",
  message: "Your product changes have been saved.",
  position: "top", // 'top' | 'right-bottom' | 'left-bottom' | 'bottom'
});