Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-simple-toasts

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simple-toasts

Simple toast popup for React

  • 3.2.0-alpha.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-51.45%
Maintainers
1
Weekly downloads
 
Created
Source

react-simple-toasts

Simple toast message popup for React ⚛️

NPM JavaScript Style Guide

Install

npm install --save react-simple-toasts

Usage

a very simple use

toast(message);
// or
toast(message, (millisecond = 3000));
// or
toast(message, { time: 3000, ...options });
import React from 'react';
import toast from 'react-simple-toasts';

const Example = () => (
  <div className="example">
    <button onClick={() => toast('Hello toast!')}>Toast</button>
    <button onClick={() => toast('Message', 1000)}>One-second</button>
  </div>
);

Live Demo

Options

NameTypeDefaultDescription
timenumber3000The millisecond time that the message is displayed
classNamestring''Can be used to customize styles
clickablestringfalseCan click the message
clickClosablebooleanfalseWhether to close the toast when is clicked
positionbottom-left bottom-center bottom-right top-left top-center top-rightbottom-centerPosition of toast popup
render(message: string) => ReactNodenullRenderer of the toast. The return value should be a ReactNode
onClick(event) => voidSet the handler to handle click event
Must be used with clickable: true

Config Defaults

You can specify config defaults.

index.js

import { toastConfig } from 'react-simple-toasts';

toastConfig({
  time: 5000,
  className: 'my-toast-message',
});
NameTypeDefaultDescription
timenumber3000The millisecond time that the message is displayed.
classNamestring''Can be used to customize styles.
positionbottom-left bottom-center bottom-right top-left top-center top-rightbottom-centerPosition of toast popup
clickClosablebooleanfalseWhether to close the toast when is clicked
render(message: string) => ReactNodenullRenderer of the toast. The return value should be a ReactNode

Thanks

Support it by joining stargazers for this repository. :star:

Stargazers repo roster for @almond-bongbong/react-simple-toasts


License

MIT © almond-bongbong

Keywords

FAQs

Package last updated on 20 Jan 2023

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc