xy-notification

基于React的通知组件


Keywords
react, react-component, xy-notification
License
MIT
Install
npm install xy-notification@0.3.0

Documentation

IE Chrome Firefox Opera Safari
IE 10+ ✔ Chrome 31.0+ ✔ Firefox 31.0+ ✔ Opera 30.0+ ✔ Safari 7.0+ ✔

NPM version node version npm download

xy-notification

xy-notification


通知组件,从屏幕某一侧滑入通知信息。

安装

# yarn
yarn add xy-notification

使用例子

import React from "react";
import ReactDOM from "react-dom";
import { noticePopup } from "xy-notification";

const close = noticePopup({
    duration: 3000,
    closeBtn: <span className="xy-close">✖</span>,
    children: <p>弹出内容</p>,
});

API

Notice

属性 说明 类型 默认值
children 通知内容 React.ReactNode
closeBtn 关闭按钮 React.ReactNode
placement 通知滑出方向 "topLeft"/"topRight"/"bottomLeft"/"bottomRight"
visible 是否可视 boolean
defaultVisible 默认是否可视 boolean
duration 过度时间 number
onClose 通知关闭事件 Function
onUnmount 通知关闭动画结束 Function

开发

yarn run start

例子

http://localhost:6006

测试

yarn run test

开源许可

xy-notification is released under the MIT license.