Skip to content
On this page

Popup

The HcPopup component inform users about a specific task and may contain critical information, require decisions, or involve multiple tasks. Use popup sparingly because they are interruptive.

Basic Usage

Use modelValue prop to control visibility of Popup.

<template>
  <ClientOnly>
    <HcButton @click="visible = true">
      Click to open
    </HcButton>
    <HcPopup
      v-model="visible"
      title="Basic popup"
      custom-class="w-[400px]"
    >
      <template #body>
        <div class="p-6 pb-0">
          Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
          ut labore et dolore magna aliqua.
        </div>
      </template>

      <template #footer>
        <div class="grid grid-cols-2 gap-6 p-6">
          <HcButton
            type="outlined"
            @click="visible = false"
          >
            Cancel
          </HcButton>
          <HcButton
            @click="visible = false"
          >
            Confirm
          </HcButton>
        </div>
      </template>
    </HcPopup>
  </ClientOnly>
</template>

<script lang="ts" setup>
import { HcPopup } from '@deeepvision/hope-component-kit';
import { ref } from 'vue';

const visible = ref(false);
</script>

Props

PropertyType Values Description Default
modelValueStringStringbinding value, whether popup is visiblefalse
titleStringStringpopup title
customClassStringStringpopup class
overlayClassStringStringcustom class of popup overlay
deletableBooleanBooleanwhether show delete iconfalse
closableBooleanBooleanwhether show close iconfalse
hideInnerScrollBooleanBooleanwhether hide inner scroll in popup bodyfalse

Slots

PropertyType Values Description Default
title-Customize title of the popup
body-Customize body of the popup
footer-Customize footer of the popup

Events

PropertyType Values Description Default
update:model-valueFunctionvalue - booleantriggers when the binding value changes
deleteFunction-triggers when the delete icon is clicked in a deletable Popup
closeFunction-triggers when the close icon is clicked in a closable Popup

Created by DeepVision Software.