Skip to content

Vue SummonSummon components from anywhere

Imperatively render dialogs, toasts and modals in Vue 3 — no template clutter, results delivered as Promises.

Vue Summon

30 seconds to your first summon

vue
<script setup lang="ts">
import { useSummoned } from 'vue-summon'

const { resolve } = useSummoned<boolean>()
</script>

<template>
  <div class="overlay">
    <div class="dialog">
      <p>Delete this file?</p>
      <button @click="resolve(false)">Cancel</button>
      <button @click="resolve(true)">Delete</button>
    </div>
  </div>
</template>
ts
import { summon } from 'vue-summon'
import ConfirmDialog from './ConfirmDialog.vue'

const confirmed = await summon(ConfirmDialog)
if (confirmed) {
  await deleteFile()
}

That is the whole mental model: summon a component, await its answer. No v-model:visible, no teleport targets to manage, no event plumbing through three layers of parents.

Released under the MIT License.