Basic

Default

Most basic sample


Large modal

.modal-lgapplies to .modal-dialog


Small modal

.modal-smapplies to .modal-dialog

Modal width

Feel free to add any desire width to .modal-dialogusing inline style or .w-*pxutility classes.

Modal types

Top

.modal-topapplies to .modal


Center

.modal-centerapplies to .modal


Bottom

.modal-bottomapplies to .modal


Left

.modal-leftapplies to .modal


Fill

.modal-fillapplies to .modal


Right

.modal-rightapplies to .modal

Modaler

Modaler is a shorthand utility to create modals for a specified content. You can create any type of modals using modaler plugin. The content can be load from a specific URL, direct HTML or HTML of targeted element.

Examples using Javascript

Basic


Some options


Events



Examples using data attributes

Basic


Some options


Events


Usage

Trigger the modaler via JavaScript:

app.modaler(options)

Trigger the modaler via data-attribute when user click on the element:

<button data-provide="modaler" data-url="path/to/modal.html">Launch modaler</button>

Options

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-url="value"or data-is-modal="value".

NameTypeDefaultDescription
urlStringnullProvide a URL that content should come from. It could be a content to insert inside .modal-bodyor a whole modal component (see isModal).
isModalBooleanfalseIf you are loading a modal component instead of a content, you should set this option to true.
Please note that if it's true, the rest of options doesn't work anymore.
htmlStringnullThe HTML content to be inserted inside .modal-body.
targetStringnullA selector to retrive HTML from and insert inside .modal-body.
typeStringnullAny modal type from: top, bottom, left, right, center, fill,
sizeStringnullsm, lgor any .w-*utility clasess.
titleStringnullTitle of the modal.
backdropBooleantrueIncludes a modal-backdrop element.
headerVisibleBooleantrueModal should have .modal-headerwhich contains title and close button.
footerVisibleBooleantrueModal should have .modal-footerwhich contains action buttons.
confirmVisibleBooleantrueInclude a confirm button in the footer.
confirmTextString'Ok'Use this to change the text on the confirm button.
confirmClassString'btn btn-w-sm btn-flat btn-primary'Use this option to change appearance of confirm button.
cancelVisibleBooleanfalseInclude a cancel button in the footer.
cancelTextString'Cancel'Use this to change the text on the cancel button.
cancelClassString'btn btn-w-sm btn-flat btn-secondary'Use this option to change appearance of cancel button.
bodyExtraClassStringnullAdd extra classes to .modal-body.
spinnerStringSee descriptionA HTML content to place inside .modal-bodywhile the main content fetch from the URL. Default is:
<div class="h-200px center-vh">  <svg class="spinner-circle-material-svg" viewBox="0 0 50 50">    <circle class="circle" cx="25" cy="25" r="20">  </svg></div>
onShowFunctionnullFunction to run when the show.bs.modalevent fires on the modal.
onShownFunctionnullFunction to run when the shown.bs.modalevent fires on the modal.
onHideFunctionnullFunction to run when the hide.bs.modalevent fires on the modal.
onHiddenFunctionnullFunction to run when the hidden.bs.modalevent fires on the modal.
onConfirmFunctionnullFunction to run when confirm button clicks, provides modal DOM element as the first argument.
onCancelFunctionnullFunction to run when cancel button clicks, provides modal DOM element as the first argument.