Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@meniga/notifications

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@meniga/notifications

A notification framework to display user notifications/feedback in a React app"

latest
npmnpm
Version
6.3.0
Version published
Maintainers
1
Created
Source

@meniga/notifications

This package is used to display notifications to the user, for example whether an action that required server activity was successful or not. It uses a local store to keep track of notifications and event listeners to react to the changes.

The UI component that is used is NotificationBar from @meniga/ui, see possible props and modifiers here: https://developer.meniga.cloud/index.html?path=/story/alerts-notificationbar--default

Usage

  • Use the NotificationsBar component in your app layout file, to position where the notification should be displayed.

Example:

import { NotificationsBar } from '@meniga/notifications';

(somewhere in your app layout)

<NotificationsBar />
  • Import the 'showNotification' utility function from the package in order to show a notification (for example in an event handler when responding to a successful or a failed API request).

Params:

  • type string - type of notification to display, scan be 'info', 'positive', 'warning' or 'negative'.
  • text string - the text to display in the notification.
  • title string - an optional title to display in the notification (optional).
  • id string - a unique id for the notification (optional)
  • useTimeout boolean - whether or not to use a timeout to hide the notification (optional, default = true).
  • ui object - props to pass to NotificationBar component (optional).
import { showNotification } from '@meniga/notifications';

showNotification(type, text, icon, id, useTimeout, { ...ui });

If you set useTimeout as false, you have to specify a unique id for the notification, because the only way to dismiss the notification is to then use the hideNotification(id) method.

import { showNotification, hideNotification } from '@meniga/notifications';

const notificationId = 'my-unique-id';

showNotification(type, text, notificationId, false);
hideNotification(notificationId);

FAQs

Package last updated on 06 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts