Skip to content

Accessibility: Work in progress

Translations: Not Needed

Popover

A floating card popping up when hovering, clicking, or focusing on a trigger element.

Basic Usage

html
<template>
  <HLPopover content-class="!p-2" trigger="hover">
    <template #trigger>
      <HLButton>Hover Me</HLButton>
    </template>
    <span>Hover popover content</span>
  </HLPopover>
</template>
<script setup>
  import { HLPopover, HLButton } from '@platform-ui/highrise'
</script>
html
<template>
  <HLPopover content-class="!p-2" trigger="click">
    <template #trigger>
      <HLButton>Click Me</HLButton>
    </template>
    <span>Click popover content</span>
  </HLPopover>
</template>
<script setup>
  import { HLPopover, HLButton } from '@platform-ui/highrise'
</script>
html
<template>
  <HLPopover content-class="!p-2" trigger="focus">
    <template #trigger>
      <HLButton>Focus Me</HLButton>
    </template>
    <span>Focus popover content</span>
  </HLPopover>
</template>
<script setup>
  import { HLPopover, HLButton } from '@platform-ui/highrise'
</script>

Placement

Vue
html
<template>
  <HLPopover content-class="!p-2" trigger="hover" placement="right">
    <template #trigger>
      <HLButton>Hover Me</HLButton>
    </template>
    <span>Hover popover content</span>
  </HLPopover>
</template>
<script setup>
  import { HLPopover, HLButton } from '@platform-ui/highrise'
</script>
Vue
html
<template>
  <HLPopover content-class="!p-2" header-class="!p-2" footer-class="!p-2" trigger="click">
    <template #trigger>
      <HLButton>With Header & Footer</HLButton>
    </template>
    <template #header> Header Text </template>
    <span>Main content</span>
    <template #footer> Footer Text </template>
  </HLPopover>
</template>
<script setup>
  import { HLPopover, HLButton } from '@platform-ui/highrise'
</script>

Imports

ts
import { HLPopover } from '@platform-ui/highrise'

Code

Vue
html
<HLPopover trigger="hover">
  <template #trigger>
    <HLButton>Hover Me</HLButton>
  </template>
  <span>Popover content</span>
</HLPopover>

Props

NameTypeDefaultDescription
animatedbooleantrueUse animation when popping up.
arrow-point-to-centerbooleanfalseWhether the arrow points to center of the trigger element.
arrow-classstring | undefinedundefinedArrow class of the popover.
arrow-stylestring | Object | undefinedundefinedArrow style of the popover.
arrow-wrapper-classstring | undefinedundefinedArrow class of the popover wrapper.
arrow-wrapper-stylestring | Object | undefinedundefinedArrow style of the popover wrapper.
content-classstring | undefinedundefinedContent class of the popover.
content-stylestring | Object | undefinedundefinedContent style of the popover.
delaynumber100Popover showing delay when trigger is hover.
disabledbooleanfalseWhether the popover can't be activated.
display-directive'if' | 'show''if'The conditionally render directive to show popover content. if means using v-if to render content, show means using v-show to render content.
durationnumber100Popover vanish delay when trigger is hover.
flipbooleantrueWhether to flip the popover when there is no space for current placement.
footer-classstring | undefinedundefinedFooter class of the popover.
footer-stylestring | Object | undefinedundefinedFooter style of the popover.
header-classstring | undefinedundefinedHeader class of the popover.
header-stylestring | Object | undefinedundefinedHeader style of the popover.
keep-alive-on-hoverbooleantrueWhether to keep popover shown when hover on popover itself with trigger="hover".
overlapbooleanfalseOverlap trigger element.
placement'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-start' | 'bottom' | 'bottom-end' | 'left-start' | 'left' | 'left-end' | 'top'Popover placement.
rawbooleanfalseWhether to use no default styles.
scrollablebooleanfalseWhether the popover's content is scrollable.
show-arrowbooleantrueWhether to show arrow if set.
showboolean | undefinedundefinedWhether to show popover.
tostring | HTMLElement | false'body'Container node of the popover content. false will keep it at trigger container.
trigger'hover' | 'click' | 'focus' | 'manual''hover'The popover trigger type.
widthnumber | 'trigger' | undefinedundefined'trigger' means popover's width will follow its trigger's width.
xnumber | undefinedundefinedThe CSS left pixel value when popover manually positioned (x, y need to be set together).
ynumber | undefinedundefinedThe CSS top pixel value when popover manually positioned (x, y need to be set together).
z-indexnumber | undefinedundefinedThe z-index of the popover.
on-clickoutside(e: MouseEvent) => voidundefinedCallback function triggered when clickoutside.
on-update:show(value: boolean) => voidundefinedCallback on show status changes.

Slots

NameParametersDescription
trigger()The trigger element
header()Header content
default()Main content
footer()Footer content

Methods

NameParametersDescription
setShow(show: boolean)Programmatically show/hide popover
syncPosition()Manually sync popover position