BModal Migration
Migration notes for BModal from BootstrapVue to BootstrapVueNext.
BModal Migration
Summary
Migration notes for BModal from BootstrapVue to BootstrapVueNext.
Affected APIs
- BModal
- BLink
- BApp
Breaking Change
Removed Global Modal Management
Modal Event System Changes
The event system has been significantly updated in BootstrapVueNext:
BootstrapVueNext does not support listening to modal changes via $root events.
New Events: BootstrapVueNext adds several new events not present in BootstrapVue:
backdrop- Emitted when the backdrop is clickedesc- Emitted when the Esc key is pressedshow-prevented,hide-prevented,toggle-prevented- Emitted when actions are prevented
Event Object Changes: The event object structure has changed:
BvModalEventis nowBvTriggerableEventvueTargetproperty is no longer available - use template refs or thetargetproperty instead- Event properties are now more consistent across all BootstrapVueNext components
Trigger Values: The trigger property values have been simplified:
- BootstrapVue:
'headerclose'→ BootstrapVueNext:'close' - All other trigger values remain the same:
'ok','cancel','esc','backdrop'
Modal Props Changes
Renamed props:
hide-header-close→no-header-closehide-footer→no-footerhide-header→no-headerhide-backdrop→no-backdropno-enforce-focus→no-traptitle-sr-only→title-visually-hidden
Removed props (not implemented in BootstrapVueNext):
aria-label- Use standard HTML attributes directly on the component. Note: Unlike BootstrapVue, BootstrapVueNext does not automatically removearia-labelledbywhenaria-labelis present. If usingaria-label, setno-header="true"to prevent conflicts, or ensure youraria-labelis descriptive enough to work alongsidearia-labelledbyauto-focus-button- Use thefocusprop with values'ok','cancel', or'close'ignore-enforce-focus-selector- Useno-trapto disable focus trapping entirelyreturn-focus- Focus return is handled automatically by the focus trap systemstatic- All modals use teleport by default. Useteleport-disabledfor local rendering
See the v-html section for information on deprecation of the cancel-title-html, ok-title-html, and title-html props.
New props in BootstrapVueNext:
teleport-to- Specify where the modal should be teleported (default:'body')teleport-disabled- Render modal in place instead of teleportingbody-scrolling- Allow body scrolling while modal is openbackdrop-first- Control backdrop animation timingno-trap- Disable focus trapping (replacesno-enforce-focus)focus- Enhanced focus control replacingauto-focus-buttontitle-visually-hidden- Hide title visually but keep for screen readersheader-close-variant- Control close button variantheader-close-label- Accessibility label for close buttonlazy- Available in BootstrapVueNext - When set, the content will not be mounted until openedno-fade- Available in BootstrapVueNext - Disables animation (alias forno-animation)no-animation- Disables animationunmount-lazy- When set andlazyis true, content will be unmounted when closedinitial-animation- When set, enables the initial animation on mount
Changed behavior:
header-close-content- This prop is removed in BootstrapVueNext. In BootstrapVue, this prop allowed customizing the close button content (defaulted to'×'). In BootstrapVueNext, use theheader-closeslot instead, which provides more flexibility than the simple string prop:
<BModal>
<template #header-close>
<span aria-hidden="true">×</span>
</template>
</BModal><BModal>
<template #header-close>
<BIcon icon="x-lg" />
</template>
</BModal>Modal Slot changes
BootstrapVue provides different slots to configure some pieces of the modal component. These slots are slightly different in BootstrapVueNext:
| BootstrapVue | BootstrapVueNext |
|---|---|
| default | default |
| modal-backdrop | backdrop |
| modal-cancel | cancel |
| modal-footer | footer |
| modal-header | header |
| modal-header-close | header-close |
| modal-ok | ok |
| modal-title | title |
Modal Slot Scoped Variables Changes
The scoped variables available to modal slots have changed between BootstrapVue and BootstrapVueNext:
BootstrapVue slot scope:
interface BSVSlotScope {
visible: boolean
ok: () => void
cancel: () => void
close: () => void
}BootstrapVueNext slot scope (BModalSlotsData):
interface BModalSlotsData {
id: string
visible: boolean
active: boolean // Same as visible
cancel: () => void
close: () => void
ok: () => void
show: (trigger?: string, noTriggerEmit?: boolean) => void
hide: (trigger?: string, noTriggerEmit?: boolean) => void
toggle: (trigger?: string, noTriggerEmit?: boolean) => void
}Key changes:
- New properties:
id,show(),toggle()are now available - Enhanced
hide()method: Now accepts optionalnoTriggerEmitparameter - Trigger value change:
close()now emits trigger'close'instead of'headerclose' - Dual visibility properties: Both
activeandvisibleprovide the same visibility state
Modal Z-Index and Stacking Changes
BootstrapVueNext has completely rewritten modal stacking:
- Automatic z-index management: No manual z-index calculation needed
- CSS variables for stacking: Uses
--b-position,--b-inverse-position,--b-count - Stack positioning classes: Automatically applies
.stack-position-*classes - Multiple modal support: Enhanced support for multiple modals with proper layering
Replacement for Modal Message boxes
BootstrapVue provided two methods on the this.$bvModal object called msgBoxOk and msgBoxConfirm. In keeping with the Vue3 first philosophy, BootstrapVueNext provides a composable called useModal that fills the same use cases (and more).
Please read the useModal documentation and then return here for examples of replacements for msgBoxOk and msgBoxConfirm.
Example using useModal.create to replace msgBoxOk: Note: If you use <BApp>, the modal orchestrator is included by default.
<template>
<div>
<BButton @click="okBox">Show Message</BButton>
<div>Result: {{ okResult }}</div>
</div>
</template>
<script setup lang="ts">
import { useModal } from 'bootstrap-vue-next/composables/useModal'
import { ref } from 'vue'
const { create } = useModal()
const okResult = ref<boolean | null | undefined>(null)
const okBox = async () => {
await using value = await create({
body: 'This is an informational message',
title: 'Message',
okOnly: true,
}).show()
okResult.value = typeof value === 'object' && value !== null && 'ok' in value ? value.ok : null
}
</script>Example using useModal.create to replace msgBoxConfirm: Note: If you use <BApp>, the modal orchestrator is included by default.
<template>
<div>
<BButton @click="confirmBox">Show Confirm</BButton>
<div>Result: {{ confirmResult ?? 'null' }}</div>
</div>
</template>
<script setup lang="ts">
import { useModal } from 'bootstrap-vue-next/composables/useModal'
import { ref } from 'vue'
const { create } = useModal()
const confirmResult = ref<boolean | null | undefined>(null)
const confirmBox = async () => {
await using value = await create({
body: 'Are you sure you want to do this?',
title: 'Confirm',
okTitle: 'Yes',
cancelTitle: 'No',
}).show()
confirmResult.value =
typeof value === 'object' && value !== null && 'ok' in value ? value.ok : null
}
</script>The create method accepts all properties defined on BModal.
See Show and Hide shared properties.
Modal Focus Management Changes
BootstrapVueNext uses a modern focus trap system with enhanced accessibility:
Enhanced focus prop: The focus prop replaces auto-focus-button and accepts:
'ok','cancel','close'- Focus built-in buttons- Element references, selectors, or HTMLElements for custom focus targets
falseto disable initial focus (not recommended for accessibility)
Automatic focus return: Focus is automatically returned to the triggering element when the modal closes, eliminating the need for:
return-focusprop - Handled automatically by focus trap- Manual focus management in most cases
Focus trapping: Enabled by default using @vueuse/integrations/useFocusTrap:
no-trapreplacesno-enforce-focusto disable focus trappingignore-enforce-focus-selectoris not available - useno-trapif needed- Focus automatically cycles within the modal
ARIA improvements:
title-visually-hiddenreplacestitle-sr-onlywith better semantic naming- Standard HTML
aria-*attributes work directly on the component - Enhanced screen reader support with proper labeling
Migration Notes
- Extracted from the canonical BootstrapVue → BootstrapVueNext migration guide.
- Review related migrations for shared prop, event, and slot changes.
Safe Automatic Rewrite
No. This entry includes behavioral or structural changes and should be reviewed manually before applying automated transforms.