Skip to content

Modal - Frameworks

A modal is a focused dialog that temporarily blocks the interface to request a specific decision or input. Because it pauses the experience, use it sparingly for high-priority tasks.

AndroidreleasedElementsreleasedFigmareleasediOSreleasedReactreleasedVuereleased

Vue

Import

Use in entire app

js
import { Modal } from '@warp-ds/vue'
app.use(Modal)

Use in one component and special imports

You can import the component like so:

js
import { wModal } from '@warp-ds/vue';

or import it individually to optimize your JS bundle size by adding only the components you need:

js
import { wModal } from '@warp-ds/vue/modal'

Props

Optional Props

NameTypeDefaultDescription
v-modelbooleanWhether or not to show the modal
leftboolean |objectWhen truthy, will show the left button of the header. Object properties will be used as attributes on the button.
rightboolean |objectWhen truthy, will show the right button of the header. Object properties will be used as attributes on the button.
titlestring
titleAttrsobjectProperties will be set as attributes of the title in the header.
headerClassesstring |objectClasses here will be set on the wrapper for the header.
contentClassesstring |objectClasses here will be set on the wrapper for the content.
contentIdstringThis id is useful if you need to programmatically scroll content in the modal.

Events

NameDescription
dismissA user presses ESC or clicks outside the dialog
leftThe left title-button has been clicked
rightThe right title-button has been clicked
shownModal entrance transitions are complete and content has been mounted
hiddenModal exit transitions are complete and content has been torn down or hidden

Slots

Note that to dynamically control the left/right slots, one must use the left/right props instead of showing and hiding the slot itself.

Slots

NameDescription
defaultContent for the modal
footerFooter (button drawer) for the modal - the footer is sticky
leftOverrides the default icon (a back arrow)
rightOverrides the default icon (an X symbol)

Custom Properties

Use percentage-based units as opposed to vh for adjusting heights. This ensures correct behavior on mobile devices when toolbars show/hide and cause changes to the inner height.

namenotes
--w-modal-max-heightThe max-height of the modal dialog
--w-modal-heightThe height of the modal dialog
--w-modal-widthThe max-width of the modal dialog

Example

vue
<w-modal @dismiss="modalIsOpen = false" v-model="modalIsOpen">
  <h1>Hello I am a modal</h1>
</w-modal>

Questions?

Feel free to ask any questions on usage in the Warp DS Slack channel: #warp-design-system