Skip to content

KConfirmDialog

示例

Confirm Dialog

A confirmation dialog with confirm and cancel buttons, supporting danger styling and loading state.

Props

NameTypeDefaultDescription
openbooleanfalseWhether the dialog is visible.
titlestring'Confirm'Dialog title text.
messagestring''Dialog description message.
confirmTextstring'Confirm'Text for the confirm button.
cancelTextstring'Cancel'Text for the cancel button.
variant'danger' | 'default''default'Visual variant. 'danger' styles the confirm button as destructive.
loadingbooleanfalseWhether the confirm button is in a loading state.
disabledbooleanfalseWhether the confirm button is disabled.

Emits

NameParametersDescription
confirmFired when the confirm button is clicked.
cancelFired when the cancel button is clicked or the dialog is closed.
update:openbooleanEmitted to control dialog visibility.

Slots

NameDescription
This component does not provide slots.

Basic Usage

vue
<script setup>
import { ref } from 'vue'
import { KConfirmDialog } from '@kK-2004/ui-component'

const showConfirm = ref(false)

function handleConfirm() {
  // perform destructive action
  showConfirm.value = false
}
</script>

<template>
  <KConfirmDialog
    v-model:open="showConfirm"
    title="Delete item?"
    message="This action cannot be undone."
    variant="danger"
    confirm-text="Delete"
    @confirm="handleConfirm"
  />
</template>