Skip to content

Dialog

Simple modal dialog with close support, size and variant options.

vue
<script setup lang="ts">
import { ref } from 'vue'
import { Dialog } from '@/components/kuro/dialog'

const open = ref(false)
</script>

<template>
  <Button @click="open = true">Open Dialog</Button>

  <Dialog v-model:open="open" variant="primary" size="md" @confirm="onConfirm">
    <template #title>
      <h2 class="text-lg font-semibold">Are you sure?</h2>
    </template>

    <p>This action is irreversible. Do you wish to proceed?</p>

    <template #footer>
      <div class="flex justify-end gap-2 mt-4">
        <Button variant="ghost" @click="open = false">Cancel</Button>
        <Button @click="onConfirm">Confirm</Button>
      </div>
    </template>
  </Dialog>
</template>

Installation

bash
npx kuro-ui add dialog
bash
npx github:Bartek-Nowak/Kuro add dialog

Props

NameTypeDescription
variant"default" | "primary" | "secondary" | "muted" | "destructive" | "success" | "warning" | "info"Color style variant of the dialog
size"sm" | "md" | "lg"Dialog size (md by default)
classstringOptional custom classes
v-model:openbooleanControls dialog visibility

Events

EventDescription
confirmEmitted when confirm button is clicked

Variants

VariantDescription
defaultGray background
primaryBlue background
secondaryDark gray background
mutedLight gray background
destructiveRed background
successGreen background
warningYellow background
infoCyan background

Sizes

SizeDescription
smSmall dialog
mdMedium (default)
lgLarge dialog

Requirements

This component depends on the following components:

  • Button

When using the CLI (kuro add dialog), all required dependencies will be installed automatically.

Dependencies