VDialog ​

VDialog is a lightweight wrapper around Element Plus ElDialog with a smaller API surface. It enables centered layout by default, adds a built-in base-dialog class, defaults destroy-on-close to true, and keeps close-on-click-modal disabled unless you opt in.

Basic Usage ​

Basic dialog with v-model control.

Behavior Notes ​

  • VDialog only exposes model-value, title, width, class, destroy-on-close, and close-on-click-modal from the wrapper, and forwards any extra ElDialog props through dialog-props.
  • The underlying dialog always renders with align-center enabled.
  • The rendered dialog class always includes base-dialog. The class prop appends extra class names to it.
  • close-call-back is emitted whenever the dialog visibility changes to false, whether the dialog closes itself or the parent sets v-model to false.

API ​

VDialog Attributes ​

NameDescriptionTypeDefault
model-value / v-modeldialog visibilitybooleanfalse
titledialog titlestring''
widthdialog widthstring / number'50%'
classextra CSS class appended after the built-in base-dialogstring''
destroy-on-closedestroy dialog content when closedbooleantrue
close-on-click-modalclose dialog when clicking the modal overlaybooleanfalse
dialog-propsextra props object forwarded to the underlying ElDialog, spread onto the dialogobject{}

VDialog Events ​

NameDescriptionType
update:model-valuetriggered when visibility changesfunction
close-call-backtriggered whenever the dialog visibility becomes falsefunction

VDialog Slots ​

All named slots are forwarded to ElDialog. Commonly used slots are listed below.

NameDescription
defaultdialog body content
headercustom dialog header
footercustom dialog footer

Source ​

Docs