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
| Class prop | Description | Props | Suffixes | |
|---|---|---|---|---|
| closeClass | Class of the close button. | |||
| contentClass | Class of the modal content. ð Classes applied have a higher specificity than expected when mobileClass is applied | |||
| fullScreenClass | Class of the modal when fullscreen. | fullScreen | ||
| mobileClass | Class of modal component when on mobile. ð Switch to mobile view to see it in action! | |||
| noScrollClass | Class of the modal when scroll is not clip. | scroll | ||
| overlayClass | Class of the modal overlay. | |||
| rootClass | Class of the root element. | |||
| scrollClipClass | Class of the modal when scroll is clip. | scroll |
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 | - | |
| animation | Custom animation (transition name) | string | - | From config modal: { |
| ariaLabel | string | - | ||
| ariaModal | boolean | - | ||
| ariaRole | string | - | ||
| autoFocus | Automatically focus modal when active | boolean | - | From config modal: { |
| canCancel | Can close Modal by clicking 'X', pressing escape or clicking outside | array|boolean | escape, x, outside, button | From config modal: { |
| closeIcon | Icon name | string | - | From config modal: { |
| closeIconSize | string | - | 'medium' | |
| component | Component 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 | - | |
| content | Text content | string | - | |
| destroyOnHide | Destroy modal on hide | boolean | - | From config modal: { |
| events | Events to be binded to the injected component | object | - | |
| fullScreen | Display modal as full screen | boolean | - | |
| mobileBreakpoint | Mobile breakpoint as max-width value | string | - | |
| onCancel | Callback function to call after user canceled (clicked 'X' / pressed escape / clicked outside) | func | - | Default function (see source code) |
| onClose | Callback function to call after close (programmatically close or user canceled) | func | - | Default function (see source code) |
| override | boolean | - | ||
| programmatic | object | - | ||
| promise | Promise | - | ||
| props | Props to be binded to the injected component | object | - | |
| scroll | 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 | string | keep, clip | From config modal: { |
| trapFocus | Trap focus inside the modal. | boolean | - | From config modal: { |
| width | Width of the Modal | string|number | - | From config modal: { |
Events
| Event name | Properties | Description |
|---|---|---|
| update:active | ||
| close |
Slots
| Name | Description | Bindings |
|---|---|---|
| default |
Style
ð Full scss file
| CSS Variable | SASS Variable | Default |
|---|---|---|
| --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-color | hsla(0,0%,4%,.86) |
| --oruga-modal-close-border-radius | $modal-close-border-radius | $base-rounded-border-radius |
| --oruga-modal-close-right | $modal-close-right | 20px |
| --oruga-modal-close-top | $modal-close-top | 20px |
| --oruga-modal-close-size | $modal-close-size | 32px |
| --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-height | calc(100vh - 160px) |
| --oruga-modal-content-margin | $modal-content-margin | 0 auto |
| --oruga-modal-zindex | $modal-zindex | 40 |
Oruga