A simple Vue 3 <Transition>
wrapper around the native <dialog>
element that can take advantage of Bootstrap's .modal
CSS styles. The component exposes 4 events, show
, shown
, close
, and closed
(borrowing names from Bootstrap).
<Modal ref="$modal" @closed="doSomethingOnClosed">
<header class="modal-header">
<h2>My Modal</h2>
<button
type="button"
class="btn-close"
aria-label="Close"
@click="$modal.close"
></button>
</header>
<div class="modal-body">
<!-- ... -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" @click="$modal.close">Close</button>
<button type="button" class="btn btn-primary" @click="doSomething">Save</button>
</div>
</Modal>