Modal Dialog Component
The Modal Dialog component provides a powerful alternative to standard Vuetify dialogs with additional features like dialog stacking, Promise-based API, and integration with DynamicForms.
Basic Usage
A message dialog, a yes/no confirmation, a validated form dialog, and sized dialogs, all driven from code via the modal service. Requires a single <modal-view /> mounted in your app root - see Installation.
Modal Dialog Examples
The modal system provides several types of dialogs that can be triggered programmatically:
Message Dialog
Simple dialog with information message and a close button.
Confirmation Dialog
Dialog with Yes/No options for confirmation.
Form Dialog
Dialog with a form including validation.
Dialog Sizes
Dialogs with different sizes (small, medium, large, x-large).
Features
- One dialog at a time - a nested
modal.*call suspends the dialog that opened it (kept open but hidden) and shows the new one on top; the suspended dialog reappears once the new one closes. - Message dialogs -
modal.message('Title', 'Text')shows an info dialog with a singlecloseaction. The demo's message also shows Markdown content (viaMdString) with a custom CSS class attached throughRenderableValue. - Confirmations -
modal.yesNo('Title', 'Text')showsyes/noactions and resolves to whichever was clicked. - Form dialogs - pass a
@dynamicforms/vue-formsGroup(with validation) asoptions.form; itsActionfields (e.g.submit,cancel) become the dialog's buttons - the dialog adds its owncloseonly where none of them is drawn - and the returned promise resolves to whichever one was clicked. An action of either class is drawn: the@dynamicforms/vuetify-inputsActionadds the responsive render options, not the ability to be drawn. EachFieldis laid out as the component it names infield.extra.component- a
<df-input>where it names none - carrying the field's own label, and a nestedGrouporListmember is not laid out at all - see<modal-view>.
- a
- Custom components -
modal.custom('Title', componentName, componentProps)renders any registered component as the dialog body instead of a message/form. - Sizing -
options.sizepicksDialogSize.SMALL/MEDIUM/LARGE/X_LARGE, each of which goes fullscreen below its own breakpoint. The default sizes itself to its content.
Full method signatures, ModalOptions, and DialogSize are documented in the modal service API reference.
See also
- Template Dialog - declaring a dialog directly in an SFC template with
<df-modal>, instead of opening it from code. - API Reference - full prop/method/option tables for the
modalservice,<df-modal>,<modal-view>andDialogSize.
