Skip to content
On this page

Modal

Classic modal overlay to include any content you may need

Base

Show code

Programmatically

Show code

Programmatically (with promises and async/await)

Show code

Class props


Click on "Inspect" button to open the modal
How does Class props inspector work?
Class propDescriptionPropsSuffixes
closeClassClass of the close button.
contentClassClass of the modal content.
🔍 Classes applied have a higher specificity than expected when mobileClass is applied
fullScreenClassClass of the modal when fullscreen.fullScreen
mobileClassClass of modal component when on mobile.
👉 Switch to mobile view to see it in action!
noScrollClassClass of the modal when scroll is not clip.scroll
overlayClassClass of the modal overlay.
rootClassClass of the root element.
scrollClipClassClass of the modal when scroll is clip.scroll


Props

Prop nameDescriptionTypeValuesDefault
activeWhether modal is active or not, use v-model:active to make it two-way bindingboolean-
animationCustom animation (transition name)string-
From config

modal: {
  animation: 'zoom-out'
}
ariaLabelstring-
ariaModalboolean-
ariaRolestring-
autoFocusAutomatically focus modal when activeboolean-
From config

modal: {
  autoFocus: true
}
canCancelCan close Modal by clicking 'X', pressing escape or clicking outsidearray|booleanescape, x, outside, button
From config

modal: {
  canCancel: ['escape', 'x', 'outside', 'button']
}
closeIconIcon namestring-
From config

modal: {
  closeIcon: 'close'
}
closeIconSizestring-'medium'
componentComponent to be injected, used to open a component modal programmatically. Close modal within the component by emitting a 'close' event — this.$emit('close')object|func-
contentText contentstring-
destroyOnHideDestroy modal on hideboolean-
From config

modal: {
  destroyOnHide: true
}
eventsEvents to be binded to the injected componentobject-
fullScreenDisplay modal as full screenboolean-
mobileBreakpointMobile breakpoint as max-width valuestring-
onCancelCallback function to call after user canceled (clicked 'X' / pressed escape / clicked outside)func-Default function (see source code)
onCloseCallback function to call after close (programmatically close or user canceled)func-Default function (see source code)
overrideboolean-
programmaticobject-
promisePromise-
propsProps to be binded to the injected componentobject-
scrollclip to remove the body scrollbar, keep to have a non scrollable scrollbar to avoid shifting background, but will set body to position fixed, might break some layoutsstringkeep, clip
From config

modal: {
  scroll: 'keep'
}
trapFocusTrap focus inside the modal.boolean-
From config

modal: {
  trapFocus: true
}
widthWidth of the Modalstring|number-
From config

modal: {
  width: 960
}

Events

Event namePropertiesDescription
update:active
close

Slots

NameDescriptionBindings
default

Style

📄 Full scss file

CSS VariableSASS VariableDefault
--oruga-modal-content-background-color$modal-content-background-color$white
--oruga-modal-content-border-radius$modal-content-border-radius$base-border-radius
--oruga-modal-overlay-background-color$modal-overlay-background-colorhsla(0,0%,4%,.86)
--oruga-modal-close-border-radius$modal-close-border-radius$base-rounded-border-radius
--oruga-modal-close-right$modal-close-right20px
--oruga-modal-close-top$modal-close-top20px
--oruga-modal-close-size$modal-close-size32px
--oruga-modal-close-color$modal-close-color$white
--oruga-modal-content-fullscreen-background-color$modal-content-fullscreen-background-color#f5f5f5
--oruga-modal-content-max-height$modal-content-max-heightcalc(100vh - 160px)
--oruga-modal-content-margin$modal-content-margin0 auto
--oruga-modal-zindex$modal-zindex40

Released under the MIT License.