0.1.0 • Published 4 years ago

xy-alert v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago
IEChromeFirefoxOperaSafari
IE 10+ ✔Chrome 31.0+ ✔Firefox 31.0+ ✔Opera 30.0+ ✔Safari 7.0+ ✔

NPM version node version npm download

xy-alert

xy-alert

警告提示组件

安装

# yarn
yarn add xy-alert classnames utils-hooks @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons

使用例子

import React from "react";
import ReactDOM from "react-dom";
import Alert from "xy-alert";
ReactDOM.render(
    <Alert message="登录失败" type="error" showIcon={true}>
        账号或密码错误。
    </Alert>,
    container
);

API

属性说明类型默认值
visible是否显示booleantrue
defaultVisible默认是否显示boolean-
提示文本messageReact.ReactNode-
children提示说明React.ReactNode-
closable是否可以关闭booleanfalse
closeText自定义关闭按钮React.ReactNode-
showIcon是否显示图标booleanfalse
banner横幅模式booleanfalse
type警告提示的样式,可选值为 success info warning error 或者不设stringinfo
onClose关闭事件(visible: boolean) => void-

开发

yarn run start

例子

http://localhost:6006

测试

yarn run test

开源许可

xy-alert is released under the MIT license.