Components
Modal
Show dialogs and confirmations with UiModal and UiConfirmModal.
UiModal presents content in an overlay; UiConfirmModal adds confirm / cancel actions. Open and close them through their exposed handle (showDialog / closeDialog).
Open a modal
<script setup lang="ts">
import { ref } from 'vue'
const modal = ref()
</script>
<template>
<UiButton variant="filled" text="Open" @click="modal.showDialog()" />
<UiModal ref="modal" title="Profile" size="md">
<template #body>
<p>Modal content…</p>
</template>
</UiModal>
</template>
Pick a mode and size
<template>
<UiModal ref="sheet" mode="side-sheet" size="lg" title="Filters" />
</template>
Confirm a destructive action
<script setup lang="ts">
import { ref } from 'vue'
const confirm = ref()
function remove() {
// delete, then close
confirm.value.closeDialog()
}
</script>
<template>
<UiConfirmModal
ref="confirm"
variant="danger"
title="Delete item?"
message="This can't be undone."
confirm-label="Delete"
cancel-label="Cancel"
@confirm="remove"
/>
</template>
UiModal props
| Prop | Type | Default | Description |
|---|---|---|---|
mode | 'modal' | 'side-sheet' | 'headless' | — | Dialog shape (preferred over legacy flags). |
size | 'sm' | 'md' | 'lg' | 'fullscreen' | — | Dialog size. |
title | string | null | — | Header title. |
message | string | null | — | Body message. |
variant | 'danger' | 'warning' | 'success' | 'primary' | 'danger' | Visual intent. |
closeOnClickOutside | boolean | true | Dismiss when clicking the backdrop. |
showAsModal | boolean | null | true | Legacy modal toggle. |
customClass / bodyDialogClass | string | string[] | Record<string, boolean> | null | — | Extra classes. |
Exposed: showDialog(), closeDialog().
Emits: onCloseDialog.
UiConfirmModal
Extends UiModal with:
| Prop | Type | Default | Description |
|---|---|---|---|
confirmLabel | string | null | 'Delete' | Confirm button label. |
cancelLabel | string | 'Cancel' | Cancel button label. |
isLoading | boolean | false | Loading state on the confirm button. |
loadingLabel | string | 'Deleting...' | Text while loading. |
Emits: confirm, onCloseDialog.