Skip to content

ACV Popover

A pop-up element that can contain text, links, form elements, and any other content. Do not confuse popover and tooltip components. Popover is called by clicking, and it can contain any content, and tooltip is called by hover or focus state and contains only text. You can close the popover by clicking on the primary or secondary button, using the Esc key or clicking outside the component.

Basic usage

TIP

Sometimes designer will have style requirement for the trigger element when popover is visible. It can be easily triggered by show/hide event of Popover. Please confirm with designer for the style requirement.

Source code
vue
<script setup>
  import AcvButton from '@/components/button/button.vue';
  import AcvPopover from '@/components/popover/popover.vue';
</script>

<template>
  <AcvPopover
    placement="right"
  >
    <template #reference>
      <AcvButton>Click me</AcvButton>
    </template>
    <div class="test-popover">
      Floating content
    </div>
  </AcvPopover>
</template>

<style scoped>
.test-popover {
  /* background-color: hsl(292deg, 100%, 50%); */
  padding: 8px;
  color: var(--acv-color-black);
}
</style>

Placement

TIP

Replace the content attribute with a default slot.

Top start
Top end
Bottom start
Bottom end
Left start
Left end
Right start
Right end

Visible on first load

Loading

Default

Reference

Trigger

Width

Popover with Tooltip

You can use both a popover and a tooltip on the same element. However, it is advisable to disable the tooltip whenever the popover is opened. Achieve this by using the element's click event (to disable tooltip) & popover's hide event (to enable tooltip).

Hide Tooltip when popover is open (Button)
Hide Tooltip when popover is open (Icon)

Popover with Dialog

You can use both a popover and a dialog on the same element.

Popover with dialog
Popover with dialog

Popover with action which change height of it

Props

Prop nameDescriptionTypeValuesDefault
popperClassstring-
flipChanges the placement of the floating element to keep it in view.
Floating UI
boolean-false
arrowWhether to show the arrowboolean-false
offsetOffset of the Popper
Floating UI
number-32
middlewareWhether to use transform for positioning
Floating UI
Middleware-
strategyStrategy of the appearance of the Popper"absolute" | "fixed"-
placementPlacement of the Popper
Floating UI
PopperPlacement-'bottom-start'
disabledWhether the Popper is disabledboolean-false
teleportWhether the Popper is teleportedboolean-false
transitionTransition to add while showing/hiding PopperAcvPopperTransitions-'fade'
hideDelayDelay before hiding Poppernumber-0
delayDelay before showing Popper
in milliseconds
number-0
triggerTrigger event to open the Popper"click" | "hover"'click', 'hover''click'
persistPersistence of Popper when clicked outside of reference elementboolean | "content"-false
modelValueShow/Hide Popper base on v-model valueboolean-undefined
referenceElReference element for the Popper
By default, it is the parent element or default slot element
HTMLElement | null | undefined-
blockboolean-
contentClassstring-
loadingWhether the popover is loadingboolean-
keepAliveboolean-
colorstring-
widthThe width of the popovernumber | string-'150'

Events

Event namePropertiesDescription
update:modelValueeventName string - The name of the event
value boolean - The visibility state of the component
Triggered when the component is toggled
hideeventName string - The name of the eventTriggered when the component is hidden
showeventName string - The name of the eventTriggered when the component is shown

Slots

NameDescriptionBindings
referenceHTML element with the popover trigger
defaultThe default slot for floating content
actionsHTML element with the popover actions

MIT Licensed