Skip to content

Modal โ€‹

A centered overlay dialog with title / body / footer slots, four sizes, six theme colours, and a modelValue binding contract that matches drawer / popover / toast. Renders into a body portal to escape transformed ancestors and stays fully invisible while closed (no shadow halo bleed). Toggle Vue / CSS to switch the live demo and source together.

Basic โ€‹

Simple modal with title, body, and close button.

Vue SFC

Sizes โ€‹

sm, md, lg and xl.

Vue SFC

Width & height โ€‹

For full control, set width, height, min-width, max-width, min-height or max-height directly. Each accepts a CSS string ("760px", "12rem", "80%") or a number โ€” numbers are treated as px (so :width="480" โ†’ 480px). Both kebab-case (min-width) and camelCase (minWidth) work. Set both width and height to "100%" for true full screen.

Vue SFC

Stacked โ€‹

Set stackable to let modals stack โ€” open a modal from inside another, any depth. Each new modal sits above the previous, only one backdrop dims the screen, and Esc / overlay-click affect only the topmost. Without stackable a modal is exclusive: opening one closes any other open modal.

Vue SFC

Draggable โ€‹

Set draggable to let users move the modal by its header โ€” handy with stacked modals to slide the top one aside and see what's behind. The panel follows the pointer freely while dragging, but snaps back fully inside the viewport when you drop it.

Vue SFC

Colors โ€‹

All built-in color variants.

Vue SFC

Confirmation โ€‹

Cancel + Confirm footer that triggers a status update.

Vue SFC

Form โ€‹

Modal containing an input + submit button.

Vue SFC

Persistent โ€‹

Overlay-click and Escape do not close โ€” only the buttons or the โœ• work.

Vue SFC

No overlay โ€‹

Page behind stays interactive.

Vue SFC

Event log โ€‹

The modal emits mno-click on every state change, plus mno-open (on open) and mno-close (on close) โ€” matching the drawer. Each event's detail.source (overlay / close / escape / manual) says what triggered it. The log below shows the close events and their source.

Vue SFC

Customized โ€‹

Override per-element styling with cssClass (Vue) or utility classes (CSS).

Vue SFC

Types โ€‹

Importimport { ModalProps } from 'mono-helper'
PropValueDefaultDescription
modelValuebooleanfalseOpen state, two-way bound for v-model-style usage.
size'sm' | 'md' | 'lg' | 'xl''md'Width preset of the modal panel.
color'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info''primary'Theme color applied to accents.
titlestring''Heading text shown in the modal header.
dismissiblebooleantrueShows the close button and allows dismissal.
persistentbooleanfalsePrevents closing via overlay click or escape.
overlaybooleantrueRenders a backdrop overlay behind the panel.
closeOnEscapebooleantrueCloses the modal when the Escape key is pressed.
closeOnOverlaybooleantrueCloses the modal when the overlay is clicked.
lockScrollbooleantrueLocks body scroll while the modal is open.
draggablebooleanfalseAllow dragging the modal by its header; it snaps back inside the viewport on drop.
stackablebooleanfalseAllow this modal to stack on top of others. When false (default) it is exclusive โ€” opening it closes any other open modals.
widthstring | numberโ€”Explicit panel sizing. Each accepts a CSS length string (`"12px"`, `"12rem"`, `"80%"`) or a number / numeric string (interpreted as px). Set both `width` and `height` to `"100%"` for true full-screen.
heightstring | numberโ€”โ€”
minWidthstring | numberโ€”โ€”
maxWidthstring | numberโ€”โ€”
minHeightstring | numberโ€”โ€”
maxHeightstring | numberโ€”โ€”
cssClassModalCssClass{}Per-part class overrides for internal elements.
cssClassNamestring''Plain root class string applied to the modal.