Skip to content

xueyou2000/xy-popover

Repository files navigation

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-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 偏移距离 number 6
destroyPopupOnHide 是否隐藏时销毁 boolean false
placement 显示方向 PlacementType
onChange 改变是否可视事件 (visible: boolean) => void
action 触发方式 TriggerAction[] ['hover']
mouseDelay 鼠标事件判定延迟 number 300
stretch 是否宽度与目标宽度对齐 boolean
popupClickHide 包裹元素点击是否隐藏 boolean false

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.

About

基于 React Hooks 的气泡卡片组件

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published