Skip to content

Popover

A popover-type overlay for displaying additional information, confirmation flows, etc.

Basic Usage

<template>
  <div>
    <b-popover trigger="hover" title="Title" content="This is some contentThis is some contentThis is some content">
      <b-button>Hover</b-button>
    </b-popover>
    <b-popover
      trigger="click"
      title="Title"
      content="This is some contentThis is some contentThis is some content"
      :z-index="1000"
    >
      <b-button>Click</b-button>
    </b-popover>
    <b-popover trigger="focus" title="Title" content="This is some contentThis is some contentThis is some content">
      <b-button>Focus</b-button>
    </b-popover>
  </div>
</template>

Placement

Use placement to set the popover position.









<template>
  <div class="demo-popover">
    <div class="top">
      <b-popover title="Title" content="Top Left text" placement="top-start">
        <b-button>Top Left</b-button>
        &nbsp;&nbsp;
      </b-popover>
      <b-popover title="Title" content="Top Center text" placement="top">
        <b-button>Top</b-button>
        &nbsp;&nbsp;
      </b-popover>
      <b-popover title="Title" content="Top Right text" placement="top-end">
        <b-button>Top Right</b-button>
      </b-popover>
    </div>
    <div class="center">
      <div class="center-left">
        <b-popover title="Title" content="Left Top text" placement="left-start">
          <b-button>Left Top</b-button>
        </b-popover>
        <br />
        <br />
        <b-popover title="Title" content="Left Center text" placement="left">
          <b-button>Left</b-button>
        </b-popover>
        <br />
        <br />
        <b-popover title="Title" content="Left Bottom text" placement="left-end">
          <b-button>Left Bottom</b-button>
        </b-popover>
      </div>
      <div class="center-right">
        <b-popover title="Title" content="Right Top text" placement="right-start">
          <b-button>Right Top</b-button>
        </b-popover>
        <br />
        <br />
        <b-popover title="Title" content="Right Center text" placement="right">
          <b-button>Right</b-button>
        </b-popover>
        <br />
        <br />
        <b-popover title="Title" content="Right Bottom text" placement="right-end">
          <b-button>Right Bottom</b-button>
        </b-popover>
      </div>
    </div>
    <div class="bottom">
      <b-popover title="Title" content="Bottom Left text" placement="bottom-start">
        <b-button>Bottom Left</b-button>
        &nbsp;&nbsp;
      </b-popover>
      <b-popover title="Title" content="Bottom Center text" placement="bottom">
        <b-button>Bottom</b-button>
        &nbsp;&nbsp;
      </b-popover>
      <b-popover title="Title" content="Bottom Right text" placement="bottom-end">
        <b-button>Bottom Right</b-button>
      </b-popover>
    </div>
  </div>
</template>

<style scoped>
.demo-popover {
  .top,
  .bottom {
    text-align: center;
  }
  .center {
    width: 300px;
    margin: 10px auto;
    overflow: hidden;
    .center-left {
      float: left;
    }
    .center-right {
      float: right;
    }
  }
}
</style>

Close Inside Overlay

<template>
  <b-popover v-model:visible="visible">
    <b-button type="text" @click="close">Click me to open overlay</b-button>
    <a style="margin-left: 30px">Click</a>
    <template #content>
      <b-button type="text" @click="close">Close</b-button>
    </template>
  </b-popover>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const visible = ref(false)
function close() {
  visible.value = false
}
</script>

More Content

<template>
  <div>
    <b-popover placement="top" width="200px">
      <b-button>Long text</b-button>
      <template #content>
        <div>This is a very very very very very very very very very very very long description</div>
      </template>
    </b-popover>
    <b-popover placement="right" width="300px">
      <b-button>More content</b-button>
      <template #content>
        <div>This is custom content~This is custom content~This is custom content~This is custom content~</div>
        <div>This is custom content~This is custom content~This is custom content~This is custom content~</div>
      </template>
    </b-popover>
  </div>
</template>

Confirm Popover

Enable confirm dialog mode via the confirm prop. In confirm mode, the popover only triggers via click and only displays the title content, ignoring the content slot.

<template>
  <b-popover v-model:visible="visible" :width="240">
    <b-button type="danger" plain>Confirm popover</b-button>
    <template #content>
      <p>
        <b-icon name="question-circle" size="16" color="#f5222d"></b-icon>
        Are you sure delete this item?
      </p>
      <div style="text-align: right; margin-top: 4px">
        <b-button size="mini" type="text" @click="cancel">Cancel</b-button>
        <b-button type="primary" size="mini" @click="ok">Confirm</b-button>
      </div>
    </template>
  </b-popover>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { Message } from 'bin-ui-design'

const visible = ref(false)

function ok() {
  visible.value = false
  Message('Clicked [Confirm]')
}
function cancel() {
  visible.value = false
  Message('Clicked [Cancel]')
}
</script>

Props

ParameterDescriptionTypeOptionsDefault
triggerTrigger modestringhover / click / focusclick
titleTitlestring
contentContent to displaystring
widthWidthstring/number
placementPosition of the popoverstringtop/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end
disabledDisable the popoverBooleanfalse
v-model:visibleWhether the popover is visibleBooleanfalse
placementPosition of the popoverstringtop/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end
transitionCustom transition animationstringfade-in-linear
show-arrowWhether to show arrowBooleantrue
popper-optionspopper.js parametersObject
show-afterDelay before showing, in millisecondsnumber0
hide-afterDelay before hiding, in millisecondsnumber0
auto-closeAuto-close after showing for the specified milliseconds. 0 means no auto-closenumber0
manualManual control mode. When true, mouse enter/leave events do not applyBooleanfalse
offsetPosition offset amountNumber0
appendToBodyAppend the overlay to bodyBooleantrue
optionsCustom popper.js configuration options. See popper.js docsObject
z-indexZ-index level. Default is 2000. The dialog auto-increments. If set, it appends and then auto-incrementsNumber0

Slot

NameDescription
contentContent of the popover. When defined, overrides the content prop.