Skip to content

Popover ​

KPop is a popover component that comes in handy when you need to display more content than can fit in a tooltip.

html
<KPop
  button-text="Open popover"
  title="Communications settings"
  width="350"
>
  <template #content>
    <KInputSwitch label="Receive marketing communications" />
    <KInputSwitch label="Receive important updates" />
  </template>
  <template #footer>
    <KButton>Apply</KButton>
  </template>
</KPop>

NOTE

Check out KTooltip if you're looking for a component for showing tooltips. KPop is ideal for displaying more complex popover dialogs that might need to have interactive elements.

Props ​

buttonText ​

Popover trigger button text. If you want to use your custom element as a popover trigger, check out the default slot.

html
<KPop button-text="Open popover">
  <template #content>
    Popover content.
  </template>
</KPop>

title ​

Popover container title. Can also be slotted.

html
<KPop
  title="Popover title"
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

placement ​

Placement of the popover.

Accepted values are:

  • auto(default)
  • top
  • top-start
  • top-end
  • left
  • left-start
  • left-end
  • right
  • right-start
  • right-end
  • bottom
  • bottom-start
  • bottom-end
html
<KPop
  placement="bottom-end"
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

trigger ​

Whether popover should be opened on trigger element click or mouseover.

Accepted values are:

  • click (default)
  • hover
html
<KPop
  trigger="hover"
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

popoverTimeout ​

When trigger prop is hover, you can provide a timeout for popover to wait before it closes. Default value is 300 milliseconds.

html
<KPop
  :popover-timeout="3000"
  trigger="hover"
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

disabled ​

Boolean to control whether popover should be disabled. Defaults to false.

html
<KPop
  disabled
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

hideCaret ​

Boolean to control whether the popover caret should be visible. Defaults to false.

html
<KPop
  hide-caret
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

closeOnPopoverClick ​

Boolean to control whether or not the popover should close when a user clicks within the popover content. Default to false.

html
<KPop
  close-on-popover-click
  button-text="Open popover"
>
  <template #content>
    <KButton size="small">
      Click here
    </KButton>
  </template>
</KPop>

hideCloseIcon ​

Boolean to hide close button in popover content.

html
<KPop
  hide-close-icon
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

width ​

Width of the popover container. Default value is 200px.

html
<KPop
  width="500"
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

maxWidth ​

Maximum width of the popover container. Default value is auto.

html
<KPop
  max-width="120"
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

tag ​

KPop wrapper element type. Default value is div.

popoverClasses ​

List of class names you want to assign to .k-popover element.

html
<KPop
  popover-classes="foo bar"
  button-text="Open popover"
>
  <template #content>
    Popover content.
  </template>
</KPop>

zIndex ​

Pass a number to use for the z-index property. Default value is 1000.

Slots ​

content ​

Slot for passing popover content.

html
<KPop button-text="Open popover">
  <template #content>
    Popover content.
  </template>
</KPop>

default ​

Slot for passing custom popover trigger element.

NOTE

When providing your custom element as popover trigger, make sure to set appropriate tabindex attribute in order to make popover accessible for assistive technology users.

html
<KPop hide-close-icon>
  <KInput
    label="Password"
    type="password"
    placeholder="Enter a strong password"
  />
  <template #content>
    Must contain at least one special character: *!&#.
  </template>
</KPop>

DANGER

KPop logic is built on the presumption that trigger element is going to be in the DOM when the component is mounted. If you need to render the element conditionally, avoid setting v-if directive on the trigger element directly and render the entire KPop component conditionally instead.

Correct:
html
<KPop v-if="!loading">
  <KButton>Open popover</KButton>
  <template #content>
    ...
  </template>
</KPop>
Incorrect:
html
<KPop>
  <KButton v-if="!loading">Open popover</KButton>
  <template #content>
    ...
  </template>
</KPop>
Incorrect:
html
<KPop>
  <template
    #default
    v-if="!loading"
  >
    <KButton>Open popover</KButton>
  </template>
  <template #content>
    ...
  </template>
</KPop>

title ​

Slot for passing custom popover title.

html
<KPop button-text="Open popover">
  <template #title>
    Popover title
  </template>
  <template #content>
    Popover content.
  </template>
</KPop>

Slot for passing footer content that goes directly underneath main popover content.

html
<KPop button-text="Open popover">
  <template #content>
    Popover content.
  </template>
  <template #footer>
    <KBadge>Footer</KBadge>
  </template>
</KPop>

Events ​

open ​

Fires when the popover is opened.

close ​

Fires when the popover is closed.

popover-click ​

Fires when the popover content is clicked.

Released under the Apache-2.0 License.