Bootstrap Vue Popover Component and Directive

Documentation and examples for adding Bootstrap Vue popovers, like those found in iOS, to any element on your site.

Example

Component

<CPopover title="Popover title" content="And here\’s some amazing content. It’s very engaging. Right?" placement="right">
  <template #toggler="{ on }">
    <CButton color="danger" size="lg" v-on="on">Click to toggle popover</CButton>
  </template>
</CPopover>
1
2
3
4
5

Directive

<CButton color="danger" size="lg" v-c-popover="{header: 'Popover title', content: 'And here\’s some amazing content. It’s very engaging. Right?', placement: 'right'}">Click to toggle popover</CButton>
1

Four directions

Four options are available: top, right, bottom, and left aligned. Directions are mirrored when using Bootstrap Vue in RTL.

Component

<CPopover content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus" placement="top">
  <template #toggler="{ on }">
    <CButton color="secondary" v-on="on">Popover on top</CButton>
  </template>
</CPopover>
<CPopover content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus" placement="right">
  <template #toggler="{ on }">
    <CButton color="secondary" v-on="on">Popover on right</CButton>
  </template>
</CPopover>
<CPopover content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus" placement="bottom">
  <template #toggler="{ on }">
    <CButton color="secondary" v-on="on">Popover on bottom</CButton>
  </template>
</CPopover>
<CPopover content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus" placement="left">
  <template #toggler="{ on }">
    <CButton color="secondary" v-on="on">Popover on left</CButton>
  </template>
</CPopover>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Directive

<CButton color="secondary" v-c-popover="{content: 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus.', placement: 'top'}">Popover on top</CButton>
<CButton color="secondary" v-c-popover="{content: 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus.', placement: 'right'}">Popover on right</CButton>
<CButton color="secondary" v-c-popover="{content: 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus.', placement: 'bottom'}">Popover on bottom</CButton>
<CButton color="secondary" v-c-popover="{content: 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus.', placement: 'left'}">Popover on left</CButton>
1
2
3
4

API

CPopover

import { CPopover } from '@coreui/bootstrap-vue'
// or
import CPopover from '@coreui/bootstrap-vue/src/components/popover/CPopover'
1
2
3

Props

Prop nameDescriptionTypeValuesDefault
contentContent for your component. If you want to pass non-string value please use dedicated slot <template #content>...</template>string--
offsetOffset of the popover relative to its target.array-[0, 8]
placementDescribes the placement of your component after Popper.js has applied all the modifiers that may have flipped or altered the originally provided placement property.Placement-'top'
titleTitle for your component. If you want to pass non-string value please use dedicated slot <template #title>...</template>string--
triggerSets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them.string | string[]'click', 'focus', 'hover''click'
visibleToggle the visibility of popover component.boolean-

Events

Event nameDescriptionProperties
hideCallback fired when the component requests to be hidden.
showCallback fired when the component requests to be shown.