Socket
Socket
Sign inDemoInstall

rc-notification

Package Overview
Dependencies
19
Maintainers
5
Versions
72
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-notification

notification ui component for react


Version published
Maintainers
5
Weekly downloads
1,170,080
increased by4.41%
Install size
3.26 MB

Weekly downloads

Package description

What is rc-notification?

The rc-notification package is a React component library for generating and managing notifications in a web application. It allows developers to easily display notifications or alerts to users, with customizable content, styles, and behaviors.

What are rc-notification's main functionalities?

Creating and displaying a notification

This feature allows developers to create and display a notification with a title, description, and an onClick event handler. The notification appears on the screen and can be interacted with by the user.

notification.open({
  message: 'Notification Title',
  description: 'This is the content of the notification.',
  onClick: () => {
    console.log('Notification Clicked!');
  }
});

Customizing notification duration

This code sample demonstrates how to set a custom duration for a notification, in seconds. After the specified time, the notification will automatically close.

notification.open({
  message: 'Notification Title',
  description: 'This notification will close after 10 seconds.',
  duration: 10
});

Specifying the position of the notification

This feature allows setting the position of notifications globally. You can specify the placement (e.g., topRight, topLeft, bottomRight, bottomLeft) and the distance from the top or bottom of the viewport.

notification.config({
  placement: 'topRight',
  top: 50,
  bottom: 50
});

Other packages similar to rc-notification

Readme

Source

rc-notification


React Notification UI Component

NPM version build status Test coverage gemnasium deps node version npm download

Development

npm install
npm start

Example

http://localhost:8000/examples/

online example: http://react-component.github.io/notification/examples/

Feature

  • support ie9,ie9+,chrome,firefox,safari

install

rc-notification

Usage

var Notification = require('rc-notification');
Notification.newInstance({}, notification => {
  notification.notice({
    content: 'content'
  });
});

API

Notification.newInstance(props, (notification) => void) => void

props details:

nametypedefaultdescription
prefixClsStringprefix class name for notification container
styleObject{'top': 65, left: '50%'}additional style for notification container.
getContainergetContainer(): HTMLElementfunction returning html node which will act as notification container

notification.notice(props)

props details:

nametypedefaultdescription
contentReact.Elementcontent of notice
keyStringid of this notice
closableBooleanwhether show close button
onCloseFunctioncalled when notice close
durationnumber1.5after duration of time, this notice will disappear.(seconds)
styleObject { right: '50%' } additional style for single notice node.
maxCountnumbermax notices show, drop first notice if exceed limit
closeIconReactNodespecific the close icon.

notification.removeNotice(key:string)

remove single notice with specified key

notification.destroy()

destroy current notification

Test Case

npm test
npm run chrome-test

Coverage

npm run coverage

open coverage/ dir

License

rc-notification is released under the MIT license.

Keywords

FAQs

Last updated on 11 Feb 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc