# popper-next

> 是一款轻量的 Tooltip 插件

Latest version **1.1.0** (published 2022-05-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install popper-next
pnpm add popper-next
yarn add popper-next
bun add popper-next
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-05-30 |
| First published | 2022-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 158.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | east-wzd |
| Maintainers | east-wzd |
| Keywords | tooltip, popover, dropdown, popup, popper, popper-next |

## Links

- npm: https://www.npmjs.com/package/popper-next
- Repository: https://github.com/east-wzd/popper-next
- Homepage: https://github.com/east-wzd/popper-next#readme
- Issues: https://github.com/east-wzd/popper-next/issues
- npm.io page: https://npm.io/package/popper-next

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [post-robot](https://npm.io/package/post-robot.md) — 93.7K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2022-05-30
- 1.0.1-alpha.58 — 2022-05-21
- 1.0.1-alpha.57 — 2022-05-21
- 1.0.1-alpha.56 — 2022-05-21
- 1.0.1-alpha.55 — 2022-05-20
- 1.0.1-alpha.54 — 2022-05-20
- 1.0.1-alpha.53 — 2022-05-20
- 1.0.1-alpha.52 — 2022-05-20
- 1.0.1-alpha.51 — 2022-05-20
- 1.0.1-alpha.50 — 2022-05-20
- 1.0.1-alpha.49 — 2022-05-20
- 1.0.1-alpha.48 — 2022-05-19
- 1.0.1-alpha.47 — 2022-05-19
- 1.0.1-alpha.46 — 2022-05-18
- 1.0.1-alpha.45 — 2022-05-18
- … 51 more at https://npm.io/package/popper-next/versions

## README

# popper-next
是一款轻量的 Tooltip 插件

## vue、react安装使用 推荐yarn
``` bash
yarn add popper-next
或者
cnpm install popper-next -S
```  


## 在html页面中如何使用
``` bash
<script src="https://unpkg.com/popper-next"></script>
<script>
const btn = document.querySelector('.btn');
const tip = document.querySelector('.tip');
const Popper = createPopper(btn, tip);
</script>

<div class="btn">按钮</div>
<div class="tip">提示信息</div>
```  


## 在VUE3 + ts中如何使用
``` bash
<script setup lang="ts">
import { ref } from 'vue'
import createPopper, { PopperConfig } from 'popper-next'

const btn = ref<HTMLElement>();
const tip = ref<HTMLElement>();
const Popper: PopperConfig = createPopper(btn.value as HTMLElement, tip.value as HTMLElement);
</script>

<div ref="btn">按钮</div>
<div ref="tip">提示信息</div>
```

## 属性配置
### 全局配置属性
例如：所有tooltip位置默认初始化右边
``` bash
import createPopper from 'popper-next'

createPopper.defaults.placement = 'right';
```  

### 单个配置属性
例如：以下这个tooltip默认没有动画效果
``` bash
import createPopper from 'popper-next'

const Popper = createPopper(referene, popper, {
  placement: 'top'
});
Popper.defaults.animate = false;
```  

## 所有属性

| 属性 | 说明 | 类型 | 可选值 | 默认值 | 必填 |
| ---- | ---- | ---- | ---- | ---- | ---- |
| placement | 出现的位置 | string | top/bottom/left/right | bottom | 否 |
| trigger | 触发行为 | string | hover/click/contextmenu | hover | 否 |
| offset | 出现位置的偏移量 | number | — | 10 | 否 |
| animate | 添加动画 | boolean | true / false | true | 否 |
| speed | 动画速度，单位毫秒 | number | — | 400 | 否 |
| zIndex | 设置元素的堆叠顺序 | number | — | 2000 | 否 |  

## 所有事件

| 事件 | 说明 | 类型 | 返回值
| ---- | ---- | ---- | ---- |
| show | 显示tooltip | function | void |
| hide | 隐藏tooltip | function | void |

## umd版本

https://unpkg.com/popper-next

---
_Source: https://npm.io/package/popper-next · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
