Skip to content
Theme:

Ui3nDialog ​

Ui3nDialog acts as a structural layout skeleton for building modal windows. Developers define the body content and specific modal logic within an independent component file using the framework slots, and then imperatively open it from anywhere in the codebase using the queue manager $openDialog.

Props

NameTypeDefaultDescription
idstring | undefined —

Dialog id

titlestring | undefined —

Dialog title

iconstring | Ui3nIconField | undefined —

Dialog icon

widthstring | number | undefined —

Dialog width

draggableboolean | undefined —

Whether dialog is draggable

hideCloseButtonboolean | undefined —

Whether to hide close button

cssClassstring[] | undefined[]

CSS classes for dialog

cssStyleRecord<string, string> | undefined{}

CSS styles for dialog

contentCssClassstring[] | undefined[]

CSS classes for content

contentCssStyleRecord<string, string> | undefined{}

CSS styles for content

confirmButtonboolean | undefinedtrue

Whether to show confirm button

cancelButtonboolean | undefinedtrue

Whether to show cancel button

confirmButtonTextstring | undefined"Done"

Confirm button text

cancelButtonTextstring | undefined"Cancel"

Cancel button text

confirmButtonColorstring | undefined"var(--color-text-button-primary-default)"

Confirm button color

cancelButtonColorstring | undefined"var(--color-text-button-secondary-default)"

Cancel button color

confirmButtonBackgroundstring | undefined"var(--color-bg-button-primary-default)"

Confirm button background

cancelButtonBackgroundstring | undefined"var(--color-bg-button-secondary-default)"

Cancel button background

closeOnClickOverlayboolean | undefined —

Whether to close on click overlay

closeOnEscboolean | undefined —

Whether to close on ESC key

dataV | undefined —

Dialog data

isValidboolean | undefinedtrue

Whether dialog is valid

Events

Event NameArguments / Value TypeDescription
action{ event: Ui3nDialogEvent<E>; data?: V | undefined; }

Called when dialog action is performed

Slots

Slot NameScope Props (v-slot)Description
#header —

Header slot

#body —

Body slot

#actions —

Actions slot

#loading —

Loading slot

CSS Variables

Set any of these where you need it — on :root, on a container, or on the element itself through [data-ui3n] — and the component follows. Leave them alone and it uses the defaults below.

NameDefault
--ui3n-dialog-actions-height64px
--ui3n-dialog-actions-padding16px
--ui3n-dialog-border-radius12px
--ui3n-dialog-cancel-background-colorvar(--color-bg-button-secondary-default)
--ui3n-dialog-cancel-button-colorvar(--color-text-button-secondary-default)
--ui3n-dialog-confirm-background-colorvar(--color-bg-button-primary-default)
--ui3n-dialog-confirm-button-colorvar(--color-text-button-primary-default)
--ui3n-dialog-title-font-size14px
--ui3n-dialog-title-height48px
--ui3n-dialog-title-padding0 32px 0 16px

Core Concepts ​

To successfully use dialog windows in your application, ensure that:

  1. The dialogs plugin is registered during application initialization (app.use(dialogs)).
  2. The <ui3n-dialog-provider /> component is embedded into the root Layout of your application structure.

Usage Examples ​

1. Simple Dialog ​

To build a dialog, create a component using the <ui3n-dialog> framework wrapper.

Dialog Template (Example01.vue):

vue
<template>
  <ui3n-dialog
    v-bind="dialogProps"
    @action="emits('action', $event)"
  >
    <template #body>
      <div class="dialog-body">{{ text }}</div>
    </template>
  </ui3n-dialog>
</template>

Live Demo & Calling Code:

Opening a Simple Dialog

How to open the configured dialog component using the imperial plugin


2. Button Customization & Behavior ​

You can completely control button text, styling, and structural states (like draggable) from your calling environment configuration without touching the dialog file template.

Dialog Template (Example02.vue):

vue
<template>
  <ui3n-dialog
    v-bind="dialogProps"
    @action="emits('action', $event)"
  >
    <template #body>
      <div class="dialog-body">{{ message }}</div>
    </template>
  </ui3n-dialog>
</template>

Live Demo & Calling Code:

Opening a Customized Dialog

Passing color overrides, header icons, and enabling draggable features


3. Custom Slots Override ​

Components can completely replace the predefined sections of the layout structure by using internal template slots.

Dialog Template (Example03.vue):

vue
<template>
  <ui3n-dialog
    v-bind="dialogProps"
    @action="emits('action', $event)"
  >
    <template #header>
      <h3>Custom Title Status</h3>
    </template>
    
    <template #body>
      <p>Custom body text area...</p>
    </template>
    
    <template #actions>
      <ui3n-button
        @click="emits('action', { event: 'confirm' })"
      >
        Apply
      </ui3n-button>
    </template>
  </ui3n-dialog>
</template>

Live Demo & Calling Code:

Opening a Custom Slots Dialog

Rendering advanced slot workflows from an imperatively mounted template


4. Form Data & Promise Exchange ​

You can supply initial form values into the container and receive the modified entity state straight back into your reactive state once the user clicks submit.

Dialog Template (Example04.vue):

vue
<template>
  <ui3n-dialog
    v-bind="dialogProps"
    :is-valid="isValid"
    @action="handleAction"
  >
    <template #body>
      <ui3n-input
        v-model="localForm.name"
        @input="onInput"
      />
    </template>
  </ui3n-dialog>
</template>

Live Demo & Calling Code:

Opening an Interactive Form Dialog

Handling two-way form synchronization and fetching data via Promise returns