0.1.0 • Published 4 years ago

xy-popover 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-popover

xy-popover

气泡卡片组件, 有可选标题和内容, 同xy-triggerxy-tooltip组件基本相同

安装

# yarn
yarn add xy-popover

使用例子

import React from "react";
import ReactDOM from "react-dom";
import Popover from "xy-popover";
ReactDOM.render(
    <Popover title="标题" content="描述内容">
        <button>按钮</button>
    </Popover>,
    container,
);

API

属性说明类型默认值
title漂浮提示标题React.ReactNode
content漂浮提示内容React.ReactNode
visible是否可视boolean
defaultVisible默认是否可视boolean
children包裹元素React.ReactNode
popupClassName弹出内容类名string
popupAlign对齐选项DomAlignOption
offsetSize偏移距离number6
destroyPopupOnHide是否隐藏时销毁booleanfalse
placement显示方向PlacementType
onChange改变是否可视事件(visible: boolean) => void
action触发方式TriggerAction[]'hover'
mouseDelay鼠标事件判定延迟number300
stretch是否宽度与目标宽度对齐boolean
popupClickHide包裹元素点击是否隐藏booleanfalse

PlacementType

"left" | "right" | "top" | "bottom" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight"

TriggerAction

"hover" | "click" | "focus" | "contextMenu"

开发

yarn run start

例子

http://localhost:6006

测试

yarn run test

开源许可

xy-popover is released under the MIT license.