Skip to content

AlertDialog

Alerts are urgent interruptions, requiring acknowledgement, that inform the user about a situation.

Usage

vue
<template>
  <Column>
    <Button @click="showDefaultDialog">Default Dialog with default actions</Button>
    <AlertDialog
      v-model:visible="defaultDialogVisible"
      :constraints="BoxConstraints({ minWidth: 400, maxWidth: 600 })"
      title="Alert with default actions"
      content="This is an alert dialog."
    >
    </AlertDialog>
  </Column>
  <Column>
    <Button @click="showDialog">Show Dialog with custom actions</Button>
    <AlertDialog
      v-model:visible="dialogVisible"
      :constraints="BoxConstraints({ minWidth: 400, maxWidth: 600 })"
      title="Alert with custom actions"
      content="This is an alert dialog with custom actions."
    >
      <template #actions>
        <Button @click="dialogVisible = false">Cancel</Button>
        <Button @click="dialogVisible = false">OK</Button>
      </template>
    </AlertDialog>
  </Column>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { Column, Button, AlertDialog, BoxConstraints } from "fluekit";

const dialogVisible = ref(false);
const defaultDialogVisible = ref(false);
const showDialog = () => {
  dialogVisible.value = true;
};
const showDefaultDialog = () => {
  defaultDialogVisible.value = true;
};
</script>

API

Props

NameTypeDefaultDescription
visiblebooleanfalseWhether the dialog is visible.
titlestring-The title of the dialog.
contentstring-The content of the dialog.
barrierDismissiblebooleantrueWhether the dialog can be dismissed by tapping outside.
alignmentAlignmentAlignment.centerThe alignment of the dialog within the screen.
barrierColorstring'rgba(0,0,0,0.54)'The background color of the barrier overlay.
constraintsBoxConstraints-Custom constraints for the dialog box.
decorationBoxDecoration-Custom decoration (background, border, shadow) for the dialog.
sizeSize-Explicit size for the dialog.
actionsAlignmentMainAxisAlignmentMainAxisAlignment.endAlignment of the action buttons.
titleAlignmentAlignment-Alignment of the title.
paddingEdgeInsets-Padding inside the dialog content area.
titleStyleTextStyle-Custom text style for the title.
titleColorstring-Color of the title text (overridden by titleStyle).
titleFontSizenumber20Font size of the title text (overridden by titleStyle).

Events

NameDescription
update:visibleEmitted when the visibility changes.
closeEmitted when the dialog is closed or cancelled.
okEmitted when the default OK button is clicked.

Slots

NameDescription
defaultThe content of the dialog (overrides content prop).
actionsThe actions at the bottom of the dialog.