Popover

Docs to be written

Auto close popover when hidden by hide middleware

The close-on-hide prop can be used to have the popover automatically close when the target is scrolled out of view. The boundary and boundary-padding props can be used to control what's considered clipping.

HTML
vue
<template>
  <BPopover :click="true" :close-on-hide="true" :delay="{show: 0, hide: 0}">
    <template #target>
      <BButton>Click me. Popover closes when clipped</BButton>
    </template>
    Scroll me out of view
  </BPopover>
  <BPopover
    :click="true"
    :close-on-hide="true"
    :delay="{show: 0, hide: 0}"
    :boundary-padding="{top: navHeight}"
  >
    <template #title>Scroll me out of view</template>
    <template #target>
      <BButton>This popover gets hidden by the top nav</BButton>
    </template>
  </BPopover>
</template>

<script setup lang="ts">
const navRef = ref(null)
onMounted(() => {
  navRef.value = document.body.querySelector('#app > nav')
})
const navHeight = computed(() => navRef.value?.clientHeight)
</script>

Component Reference

<BPopover>
PropTypeDefaultDescription
boundaryBoundary | RootBoundary'clippingAncestors'
boundary-paddingPaddingundefined
clickbooleanfalse
close-on-hideundefined
contentstringundefined
custom-classClassValue''
delaynumber | { show: number; hide: number }'() => {show: 100, hide: 300})'
floating-middlewareMiddleware[]undefined
hide-marginnumber0 The margin to apply when hiding the popover on pointer leave (how far the pointer can move off the target before hiding the popover)
idstringundefined
initial-animationbooleanfalse When set, enables the initial animation on mount
inlinebooleanfalse
lazybooleanfalse When set, the content will not be mounted until opened
manualbooleanfalse
model-valuebooleanfalse Controls the visibility of the component
no-animationbooleanfalse When set, disables the animation
no-auto-closebooleanfalse
no-fadebooleanfalse Alias for `noAnimation`
no-flipbooleanfalse
no-hidebooleanfalse
no-shiftbooleanfalse
no-sizebooleanfalse
noninteractivebooleanfalse
offsetNumberish | nullnull
placementPopoverPlacement'top'
realtimebooleanfalse
referencestring | ComponentPublicInstance | HTMLElement | nullnull
showbooleanfalse When set, and prop 'visible' is false on mount, will animate from closed to open on initial mount. Mainly to help with template show. Use model-value for reactive show/hide
strategyStrategy'absolute'
targetstring | ComponentPublicInstance | HTMLElement | null null
teleport-disabledbooleanfalse
teleport-tostring | RendererElement | null | undefinedundefined
titlestringundefined
tooltipbooleanfalse
trans-propsTransitionPropsundefined Transition properties
unmount-lazybooleanfalse When set and `lazy` is true, the content will be unmounted when closed
variantColorVariant | nullnull
visiblebooleanfalse When 'true', open without animation
EventArgsDescription
hidden
value: BvTriggerableEvent
hide
value: BvTriggerableEvent
hide-prevented
show
value: BvTriggerableEvent
show-prevented
shown
value: BvTriggerableEvent
NameScopeDescription
default
target
show: () => void
hide: (trigger: string) => void
toggle: () => void
visible: boolean
title