The Dialog component can be used in two ways: as a standard Vue component in your templates or via a programmatic API for imperative dialog control (like alert, confirm, or prompt).
1. Declarative Usage (Component)
Import BDialog to use it directly in your Vue templates. It accepts standard DialogProps.
2. Programmatic Usage (Imperative)
Use the DialogProgrammatic class to trigger dialogs from your logic. This is useful for quick alerts or confirmation flows without managing component state in your templates.
alert(params): Displays a simple message with no cancel option.confirm(params): Displays a dialog with confirm/cancel actions.prompt(params): Displays a dialog with an input field.
If config.defaultProgrammaticPromise is enabled, these methods return a Promise that resolves when the dialog is closed.
import { BDialog, DialogProgrammatic } from '@ntohq/buefy-next'
// Declarative
<template>
<BDialog v-model="showDialog" message="Hello!" />
</template>
// Programmatic
const dialog = new DialogProgrammatic()
// Alert
dialog.alert('This is an alert')
// Confirm
dialog.confirm({ message: 'Are you sure?' }).then(result => {
console.log('User confirmed:', result.result)
})
// Prompt
dialog.prompt({ message: 'Enter your name' }).then(result => {
console.log('Input:', result.result)
})