Skip to content

PopOver API Reference ​

Component Props ​

The OPopOver component itself doesn't accept any props directly. Instead, it uses the usePopup composable for state management.

Composable API ​

The usePopup composable provides the main API for controlling popups.

State ​

PropertyTypeDescription
popupObject | nullCurrent popup configuration object or null if no popup is open
configObjectGlobal configuration object
isPopupOpenBooleanComputed property indicating if a popup is currently open

Methods ​

Core Methods ​

MethodParametersDescription
showPopup(options)options: PopupOptionsShows a popup with the specified configuration
closePopup(reason?)reason?: stringCloses the current popup with optional reason

Convenience Methods ​

MethodParametersDescription
confirm(title, content, options?)title: string, content: string, options?: ConfirmOptionsShows a confirmation dialog
alert(title, content, options?)title: string, content: string, options?: AlertOptionsShows an alert dialog
prompt(title, content, options?)title: string, content: string, options?: PromptOptionsShows a prompt dialog
custom(component, props?, options?)component: Component, props?: object, options?: CustomOptionsShows a custom component popup

Configuration Methods ​

MethodParametersDescription
setCloseOnOverlayClick(value)value: booleanSets whether clicking overlay closes popup
setShowCloseIcon(value)value: booleanSets whether to show close icon by default
setEnableAnimation(value)value: booleanSets whether to enable animations

The showPopup method accepts a configuration object with the following properties:

PropertyTypeDefaultDescription
titleString''Title text for the popup header
contentString''Static content text
componentComponentnullDynamic component to render
componentPropsObject{}Props to pass to the dynamic component
buttonConfigArray[]Array of button configuration objects
showCloseIconBooleantrueWhether to show close icon
closeOnOverlayClickBooleantrueWhether clicking overlay closes popup
showMandatoryFieldsErrorBooleanfalseShows validation error message
showMandatoryFieldsErrorMsgString'Please fill mandatory fields'Custom error message
customClassString''Additional CSS class for popup body
onCloseFunctionnullCallback when popup closes
onFooterClickFunctionnullCallback when footer is clicked

Button Configuration ​

Each button object in buttonConfig can have the following properties:

PropertyTypeDescription
buttonTextStringText to display on the button
actionFunctionFunction to execute when button is clicked
classNamesArrayArray of CSS class names
isDisabledBooleanWhether the button is disabled
iconStringIcon URL or path
showSpinningLoaderBooleanWhether to show loading spinner

Pre-defined Button Classes ​

  • primary-button - Yellow primary button with hover effect
  • primary-button-v2 - Alternative primary button style
  • secondary-button-v2 - Secondary button with gray border
  • secondary-button-v3 - Text-only secondary button

Component Slots ​

SlotPropsDescription
header-Custom content for the popup header
main-Main content area of the popup
footer-Custom footer content

Events ​

The component handles these events internally:

EventDescription
overlayClickTriggered when clicking the backdrop
closeIconClickTriggered when clicking the close icon
buttonClickTriggered when clicking any button

Example Usage ​

vue
<template>
  <OPopOver />
</template>

<script setup>
import { usePopup } from '../composables/usePopupComposable';

const { showPopup, closePopup } = usePopup();

const showBasicPopup = () => {
  showPopup({
    title: 'Hello World',
    content: 'This is a basic popup message.',
    buttonConfig: [
      {
        buttonText: 'OK',
        classNames: ['primary-button'],
        action: () => closePopup()
      }
    ]
  });
};
</script>