Modal
Classic modal overlay to include any content you may need
Examples
Base
Show code
Component Prop
Show code
Teleport
Show code
Programmatically
Show code
Programmatically (with promises and async/await)
Show code
Class props
Modal component
Classic modal overlay to include any content you may need
html
<o-modal></o-modal>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
active | Whether modal is active or not, use v-model:active to make it two-way binding | boolean | - | false |
animation | Custom animation (transition name) | string | - | From config: modal: { |
ariaLabel | Accessibility aria-label to be passed to the div wrapper element | string | - | From config: modal: { |
ariaRole | Role attribute to be passed to the div wrapper for better accessibility. | "alertdialog" | "dialog" | dialog , alertdialog | From config: modal: { |
autoFocus | Automatically focus modal when active | boolean | - | From config: modal: { |
cancelable | Is Modal cancleable by clicking 'X', pressing escape or clicking outside | boolean | string[] | escape , x , outside , button , true , false | From config: modal: { |
closeIcon | Close icon name | string | - | From config: modal: { |
closeIconSize | Size of close icon | string | small , medium , large | From config: modal: { |
component | Component to be injected. Close the component by emitting a 'close' event — $emit('close') | Component | - | |
content | Text content, unnecessary when default slot is used | string | - | |
events | Events to be binded to the injected component | {} | - | |
fullScreen | Display modal as full screen | boolean | - | false |
mobileBreakpoint | Mobile breakpoint as max-width value | string | - | From config: modal: { |
overlay | Show an overlay | boolean | - | From config: modal: { |
override | Override existing theme classes completely | boolean | - | |
props | Props to be binded to the injected component | any | - | |
scroll | Use clip 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 layouts. | "clip" | "keep" | keep , clip | From config: modal: { |
teleport | Append the component to another part of the DOM. Set true to append the component to the body.In addition, any CSS selector string or an actual DOM node can be used. | boolean | object | string | - | From config: modal: { |
trapFocus | Trap focus inside the modal | boolean | - | From config: modal: { |
width | Width of the Modal | number | string | - | From config: modal: { |
Events
Event name | Properties | Description |
---|---|---|
update:active | value boolean - updated active prop | active prop two-way binding |
close | value unknown - close event data | on component close event |
Slots
Name | Description | Bindings |
---|---|---|
default | Modal default content, default is content prop | close (...args): void - function to close the component |
Sass variables
Current theme ➜ Oruga
SASS Variable | Default |
---|---|
$modal-content-background-color | var(--#{$prefix}white) |
$modal-content-border-radius | var(--#{$prefix}base-border-radius) |
$modal-overlay-background-color | hsla(0, 0%, 4%, 0.86) |
$modal-close-border-radius | var( --#{$prefix}base-border-radius-rounded) |
$modal-close-right | 20px |
$modal-close-top | 20px |
$modal-close-size | 32px |
$modal-close-color | var(--#{$prefix}white) |
$modal-content-fullscreen-background-color | #f5f5f5 |
$modal-content-max-height | calc(100vh - 160px) |
$modal-content-margin | 0 auto |
$modal-zindex | 40 |
See ➜ 📄 Full scss file
Current theme ➜ Bulma
The theme does not have any custom variables for this component.
Current theme ➜ Bootstrap
The theme does not have any custom variables for this component.