Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
hiui-popper
Advanced tools
基础弹层组件
import Popper from "@hi-ui/hiui/es/popper"
import React, { useState, useRef } from "react"
const demo = () => {
const PopperAttachEle = useRef()
const [showPopper, setShowPopper] = useState(false)
return (
<div>
<div ref={PopperAttachEle}>popper-attachEle</div>
<Popper
// 弹出层的显示隐藏
show={showPopper}
// 依附的元素
attachEle={PopperAttachEle.current}
// 点击弹出层以及依附元素以外的区域时会触发该回调
onClickOutside={() => {
setShowPopper(false)
}}
>
<div className='popper-content'>Popper Content</div>
</Popper>
</div>
)
}
import Popper from "@hi-ui/hiui/es/popper"
import React, { useState, useRef } from react
const demo = () => {
const [showPopper, setShowPopper] = useState(false)
return (
<div>
<Popper
// 弹出层的显示隐藏
show={showPopper}
left={20}
top={20}
// 点击弹出层以及依附元素以外的区域时会触发该回调
onClickOutside={() => {
setShowPopper(false)
}}
>
<div className="popper-content">Popper Content</div>
</Popper>
</div>
)
}
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
show | 弹出层显示隐藏 | boolean | - | false |
attachEle | 依附元素,会自动显示到该元素下方,并跟随自动 | HTMLElement | - | - |
container | 弹出层依赖定位的元素,也就是弹出层参考定位的元素 | HTMLElement | - | - |
width | 弹层宽度,如果存在attachEle参数且宽度未传入的情况下,会根据attachEle的宽度进行计算,其他情况请传入宽度 | number | string | bool | - | - |
topGap | 距离依附元素的上偏移量,存在 attachEle 属性时有效, | number | 0 | 0 |
leftGap | 距离依附元素的左偏移量,存在 attachEle 属性时有效, | number | 0 | 0 |
zIndex | 堆叠顺序 | number | - | 1060 |
placement | 位于依附元素的方位 | string | bottom | bottom-start | bottom-end | top | top-start | top-end | left | left-start | left-end | right | right-start | right-end | top-bottom-start(使用该属性会自动根据依附元素距离可视区域自动翻转) | top-bottom | left-right | left-right-start | bottom-start |
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
onClickOutside | 点击该元素外的回调方法 | function | - | - |
setOverlayContainer | 如遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位 (3.0 新增) | function(triggerNode) | - | () => document.body |
FAQs
The npm package hiui-popper receives a total of 1 weekly downloads. As such, hiui-popper popularity was classified as not popular.
We found that hiui-popper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.