0.0.5 • Published 1 year ago

popover-vue v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Popover-vue

This is a Vue 3 component used to create a popover with customizable options such as placement, trigger on hover, arrow display, and control over its manual showing/hiding. It also has events for when the Popover is opened or hidden, and a slot for adding custom content to the Popover.

License npm Downloads

DOCUMENTATION

DEMO

Installation

First step is to install it using yarn or npm:

yarn add popover-vue

or

npm i popover-vue

Usage

<template>
  <Popover>
    <button>Button</button>
    <template #content>
      <div>content</div>
    </template>
  </Popover>
</template>

<script>
import Popover from "popover-vue";

export default {
  components: { Popover },
};
</script>

Props

NameTypeDefaultDescription
placementStringbottomSets the preferred placement of the Popover.
hoverBooleanfalseSets whether the Popover is triggered on hover or not.
arrowBooleanfalseSets whether to display an arrow on the Popover or not.
disabledBooleanfalseDisables the Popover and hides it if it was already open.
showBooleannullSets whether the Popover is shown or hidden manually, ignoring other events (click, hover) if set to true or false.

Events

NameDescription
open:popoverTriggered when the Popover is opened.
close:popoverTriggered when the Popover is hidden.

Slots

NameDescription
contentUsed for adding custom content to the Popover.

Slot Props

The content slot provides the following variables and functions:

NameTypeDescription
closeFunctionA function to close the Popover.
isOpenBooleanReturns the open state of the Popover.