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

react-custom-toast

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-custom-toast

基于 react 的 toast 组件。可以完全的自定义样式。并提供了内置动画与控制方法

  • 0.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-custom-toast

基于 react 的 toast 组件。可以完全的自定义样式。并提供了内置动画与控制方法demo

react-custom-toast demo

Feature

  • 添加测试
  • 上线 demo 网站
  • 更多的内置动画效果

安装

使用 npm 安装

npm install react-custom-toast --save

使用 yarn 安装

yarn add react-custom-toast

使用

添加 ToastContainer 组件至 render

import { ToastContainer } from 'react-custom-toast'

ReactDom.render(<ToastContainer />, document.body)

然后,开始使用 toast

import { Toast } from 'react-custom-toast'

Toast.open('hello,world')

参数

ToastContainer
参数类型默认值描述
componentJSX.FunctionComponentundefinded自定义组件
clickClosebooleanfalse点击 toast 即关闭
Toast

方法

Toast(msg: string, opt: ToastOption) // 打开默认提示

Toast.open(msg: string, opt: ToastOption) // 打开无状态提示

Toast.info(msg: string, opt: ToastOption) // 打开提示

Toast.info(msg: string, opt: ToastOption) // 打开成功提示

Toast.error(msg: string, opt: ToastOption) // 打开错误提示

Toast.warning(msg: string, opt: ToastOption) // 打开警告提示

Toast.remove(id: ToastId) // 移除某个 toast

ToastOption
参数类型默认值描述
idstring|number随机设置 toast id
typestring''提示类型('info' | 'success' | 'error' | 'warning')
placementstringtopLefttoast 方位('topLeft' | 'topRight' | 'topCenter' | 'bottomLeft' | 'bottomRight' | 'bottomCenter')
durationnumber2000提示持续时间
delaynumber0提示出现延时
animateDurationnumber300提示动画时间
animateNamestringslideX提示动画效果('slideX' | 'slideY')

License

MIT

Keywords

FAQs

Package last updated on 11 Jan 2019

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