Vue UI Components Documentation
The Vue Popover shows a small overlay of secondary content next to an element when the element is clicked. This guide adds the Vue Popover (jqxPopover) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxpopover.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxPopover from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxpopover.vue';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
With <script setup>, an imported component is ready to use in the template. jqx.base.css is required; the second file is a theme, selected with the theme attribute.
The Default Functionality demo as a Single-File Component:
<template>
<div>
<JqxPopover
:showCloseButton="true"
:selector="'.my-button'"
:title="'Employees'"
:arrowOffsetValue="50"
:offset="{ left: left, top: top }"
>
<div ref="employees"></div>
</JqxPopover>
<div
style="height: 33px; border-width: 1px; border-style: solid; padding: 10px"
class="jqx-widget-header"
>
<JqxButton
ref="myButton"
style="float: right"
class="my-button"
@click="updatePopoverPosition()"
:width="150"
:height="22"
:template="'inverse'"
>
View Employees
</JqxButton>
</div>
</div>
</template>
<script setup>
import { onMounted, ref } from 'vue';
import JqxPopover from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxpopover.vue';
import JqxButton from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxbuttons.vue';
const myButton = ref(null);
const employees = ref(null);
const left = ref(0);
const top = ref(0);
function updatePopoverPosition() {
left.value = myButton.value.$el.offsetLeft + 16;
top.value = myButton.value.$el.offsetTop;
}
onMounted(() => {
let data = new Array();
let firstNames = [
'Nancy',
'Andrew',
'Janet',
'Margaret',
'Steven',
'Michael',
'Robert',
'Laura',
'Anne'
];
let lastNames = [
'Davolio',
'Fuller',
'Leverling',
'Peacock',
'Buchanan',
'Suyama',
'King',
'Callahan',
'Dodsworth'
];
let titles = [
'Sales Representative',
'Vice President, Sales',
'Sales Representative',
'Sales Representative',
'Sales Manager',
'Sales Representative',
'Sales Representative',
'Inside Sales Coordinator',
'Sales Representative'
];
for (let i = 0; i < firstNames.length; i++) {
let row = {};
row['firstname'] = firstNames[i];
row['lastname'] = lastNames[i];
row['title'] = titles[i];
let imgurl = 'https://www.jqwidgets.com/vue/images/' + firstNames[i].toLowerCase() + '.png';
let img = '<img height="50" width="45" src="' + imgurl + '"/>';
let table =
'<table style="min-width: 150px;"><tr><td style="width: 55px;" rowspan="2">' +
img +
'</td><td>' +
firstNames[i] +
' ' +
lastNames[i] +
'</td></tr><tr><td>' +
titles[i] +
'</td></tr></table>';
employees.value.innerHTML += table;
}
});
</script>
<style></style>Options are attributes. Bind values from the script with :, for example :width="850".
Listen to an event with @ and its name. For example, open: This event is triggered when the popover is opened.
<script setup>
function onOpen(event) {
console.log(event.args);
}
</script>
<template>
<JqxPopover @open="onOpen" />
</template>
Call methods through a template ref. For example, open: Open the popover.
<script setup>
import { ref, onMounted } from 'vue';
const myPopover = ref(null);
onMounted(() => {
myPopover.value.open();
});
</script>
<template>
<JqxPopover ref="myPopover" />
</template>
Every component also has setOptions({ … }) and getOptions('name').