Similar to Tooltip, Popover is also built with BPopper. So for some duplicated attributes, please refer to the documentation of Tooltip.
The trigger attribute is used to define how popover is triggered: hover, click, focus or contextmenu . If you want to manually controll it, you can set :visible.
<template><b-spacewrap><b-popoverplacement="top-start"title="Title":width="200"trigger="hover"content="Lorem ipsum dolor sit amet"><template#reference><b-buttonsmall>Hover to activate</b-button></template></b-popover><b-popoverplacement="bottom"title="Title":width="200"trigger="click"content="Lorem ipsum dolor sit amet"><template#reference><b-buttonsmall>Click to activate</b-button></template></b-popover><b-popoverref="popover"placement="right"title="Title":width="200"trigger="focus"content="Lorem ipsum dolor sit amet"><template#reference><b-buttonsmall>Focus to activate</b-button></template></b-popover><b-popoverref="popover"title="Title":width="200"trigger="contextmenu"content="Lorem ipsum dolor sit amet"><template#reference><b-buttonsmall>contextmenu to activate</b-button></template></b-popover><b-popover:visible="visible"placement="bottom"title="Title":width="200"content="Lorem ipsum dolor sit amet"><template#reference><b-buttonsmall@click="visible = !visible">Manual to activate</b-button></template></b-popover></b-space></template><scriptlang="ts"setup>import{ ref }from'vue'const visible =ref(false)</script>
Like Tooltip, Popover can be triggered by virtual elements, if your use case includes separate the triggering element and the content element, you should definitely use the mechanism, normally we use #reference to place our triggering element, with triggering-element API you can set your triggering element anywhere you like, but notice that the triggering element should be an element that accepts mouse and keyboard event.
<template><b-buttonref="buttonRef"v-click-outside="onClickOutside"small>Click to activate</b-button><b-popoverref="popoverRef":virtual-ref="buttonRef"trigger="click"title="With title"virtual-triggering><span> Some content </span></b-popover></template><scriptsetuplang="ts">import{ ref, unref }from'vue'import{ ClickOutside as vClickOutside }from'bigin-ui'const buttonRef =ref()const popoverRef =ref()constonClickOutside=()=>{unref(popoverRef).popperRef?.delayHide?.()}</script>
Other components/elements can be nested in popover. Following is an example of nested table.
Replace the content attribute with a default slot.
<template><divclass="flex items-center"><b-popoverplacement="right":width="400"trigger="click"><template#reference><b-buttonsmallclass="mr-2">Click to activate</b-button></template><b-table:data="gridData"><b-table-columnwidth="150"property="date"label="date"/><b-table-columnwidth="100"property="name"label="name"/><b-table-columnwidth="300"property="address"label="address"/></b-table></b-popover><b-popover:width="320"popper-class="p-6"><template#reference><b-avatar:size="32"circlesrc="https://avatars.githubusercontent.com/u/101083410?s=64&v=4"/></template><template#default><divclass="flex items-center"><b-avatar:size="64"circlesrc="https://avatars.githubusercontent.com/u/101083410?s=128&v=4"class="mr-4"/><div><h4>BigIn UI</h4><pclass="c-neutral-7">@bigin</p></div></div><pclass="mt-4">
BigIn UI, a Vue 3 based component library for developers, designers
and product managers
</p></template></b-popover></div></template><scriptlang="ts"setup>const gridData =[{date:'2016-05-02',name:'Jack',address:'New York City',},{date:'2016-05-04',name:'Jack',address:'New York City',},{date:'2016-05-01',name:'Jack',address:'New York City',},{date:'2016-05-03',name:'Jack',address:'New York City',},]</script>