Portable UI

useNotifications

v1.0.0

Hook to show and dismiss notifications from module components.

Import

import { useNotifications } from '@meteorack/modules-sdk-ui/notifications';

How To Use It

  • Call notify({ type, message }) to show a notification. Returns the notification id for manual dismissal.

Works Well With

Methods

notifications: Notification[]

All active notifications.

notify(options: NotifyOptions): string

Show a notification. Returns its id.

dismiss(id: string): void

Dismiss by id.

dismissAll(): void

Dismiss all notifications.

Example

bootstrap.php
import { useNotifications } from '@meteorack/modules-sdk-ui/notifications';

function SaveButton() {
  const { notify } = useNotifications();
  return (
    <button onClick={() => notify({ type: 'success', message: 'Settings saved.' })}>
      Save
    </button>
  );
}