0.0.6 • Published 5 months ago

next-popover-react v0.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Next-Popover-React

React wrapper for next-popover library

Demo

Install

npm i next-popover-react

or

yarn add next-popover-react

or

pnpm add next-popover-react

Usage

import Popover, { PlacementType, EmitType } from 'next-popover-react';

export default () => (
  <Popover 
    content="next-popver-react"
    placement="top-start"
    emit="hover"
  >
    <button>Trigger</button>
  </Popover>
);

API

Config

NameTypeDefaultDescription
contentReactNode \| () => ReactNodeRequired. The content element to be popped up
appendToHTMLElementdocument.bodyThe element to append the popover to.
placementtop left right bottom top-left top-right bottom-left bottom-right left-top left-bottom right-top right-bottomtopThe placement of the popover.
showArrowBooleantrueWhether to show arrow
emitclick or hoverclickTrigger emit type
openbooleanWhether to open the popover box by default
openDelaynumber100Open delay
closeDelaynumber100Close delay
enterablebooleantrueWhen emit is set to hover, can the mouse enter the popover
disabledbooleanDisabled
clickOutsideClosebooleantrueAutomatically close the popover when clicking outside
closeOnScrollbooleanWhether to automatically close the popover when the trigger element is scrolled.
triggerOpenClassstringThe class added to the trigger when the popover is opened.
wrapperClassstringThe class added to the popoverWrapper.
animationClassstringThe CSS animation class name.
onBeforeEnter() => voidCalled before the CSS enter animation starts.
onEntered() => voidCalled when the CSS enter animation ends.
onBeforeExit() => voidCalled before the CSS exit animation starts.
onExited() => voidCalled when the CSS exit animation ends.
onOpen() => voidCalled when the popover is opened.
onClose() => voidCalled when the popover is closed.