Modals

Modal dialogs

Open Modal
Print

modal content ...

Basic
Basic modal.
<div class="SnBtn primary" data-modaltrigger="demoBasic">Open Modal</div>
<div class="SnModal-wrapper" data-modal="demoBasic">
    <div class="SnModal">
        <div class="SnModal-close" data-modalclose="demoBasic"><svg viewBox="64 64 896 896" class=""
                data-icon="close" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false">
                <path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z">
                </path>
            </svg></div>
        <div class="SnModal-header">Print</div>
        <div class="SnModal-body">
            <p>modal content ...</p>
        </div>
    </div>
</div>
Open Modal
Print

modal content ...

Mask close
A parameter can be added in the modal so that it does not close from the mask.
<div class="SnBtn primary" data-modaltrigger="demoBasicAutoclose">Open Modal</div>
<div class="SnModal-wrapper" data-modal="demoBasicAutoclose" data-maskclose="false">
    <div class="SnModal">
        <div class="SnModal-close" data-modalclose="demoBasicAutoclose"><svg viewBox="64 64 896 896" class=""
                data-icon="close" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false">
                <path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z">
                </path>
            </svg></div>
        <div class="SnModal-header">Print</div>
        <div class="SnModal-body">
            <p>modal content ...</p>
        </div>
    </div>
</div>
Open Modal
Print

modal content ...

Inner Open Modal
Print

modal content ...

Mondal in modal
Sub modals.
<div class="SnBtn primary" data-modaltrigger="demoSubModal">Open Modal</div>
<div class="SnModal-wrapper" data-modal="demoSubModal">
    <div class="SnModal">
        <div class="SnModal-close" data-modalclose="demoSubModal"><svg viewBox="64 64 896 896" class=""
                data-icon="close" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false">
                <path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z">
                </path>
            </svg></div>
        <div class="SnModal-header">Print</div>
        <div class="SnModal-body">
            <p>modal content ...</p>
            <div class="SnBtn primary" data-modaltrigger="innerModal">Inner Open Modal</div>
        </div>
    </div>
</div>
<div class="SnModal-wrapper" data-modal="innerModal">
    <div class="SnModal">
        <div class="SnModal-close" data-modalclose="innerModal"><svg viewBox="64 64 896 896"
                class="" data-icon="close" width="1em" height="1em" fill="currentColor" aria-hidden="true"
                focusable="false">
                <path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z">
                </path>
            </svg></div>
        <div class="SnModal-header">Print</div>
        <div class="SnModal-body">
            <p>modal content ...</p>
        </div>
    </div>
</div>
confirm
delete
Cancel
Confirmation modal dialog
Use confirm() to show a confirmation modal dialog.
SnModal.confirm({
    title: 'Do you Want to delete these items?',
    content: 'Some descriptions',
    onOk() {
        SnMessage.info({
            content: 'onOk'
        });
    },
    onCancel() {
        SnMessage.info({
            content: 'onCancel'
        });
    }
});

SnModal.confirm({
    title: 'Are you sure delete this task?',
    content: 'Some descriptions',
    okText: 'Yes',
    okClassNames: 'danger',
    cancelText: 'No',
    onOk() {
        SnMessage.info({
            content: 'onOk'
        });
    },
    onCancel() {
        SnMessage.info({
            content: 'onCancel'
        });
    }
});

SnModal.confirm({
    title: 'Are you sure cancel this task?',
    content: 'Some descriptions',
    input: true,
    inputValue: 'Cancel by mistake',
    okText: 'Yes',
    okClassNames: 'danger',
    cancelText: 'No',
    onOk(message) {
        SnMessage.info({
            content: 'Ok = ' + message
        });
    },
    onCancel(message) {
        SnMessage.info({
            content: 'Cancel = ' + message
        });
    }
});
info
success
danger
warning
Information modal dialog
In the various types of information modal dialog, only one button to close dialog is provided.
SnModal.info({
    title: 'This is a notification message',
    content: 'some messages...some messages... \n some messages...some messages...',
    onOk() {
        console.log('onOk')
    },
});
SnModal.success({
    content: 'some messages...some messages...',
    onOk() {
        console.log('onOk')
    },
});
SnModal.danger({
    title: 'This is an danger message',
    content: 'some messages...some messages...',
    onOk() {
        console.log('onOk')
    },
});
SnModal.warning({
    title: 'This is a warning message',
    content: 'some messages...some messages...',
    onOk() {
        console.log('onOk')
    },
});

API

Confirmation modal dialog

Properties

PropertyDescriptionTypeDefault
titleTitle modalstring-
contentContent modalstring-
inputShow input controlboleanfalse
inputValueSet input valuestring-
okTextSet ok textstringOK
okClassNamesSet ok button typestringprimary
cancelTextSet cancel textstringCancelar

Methods

PropertyDescriptionTypeDefault
onOkok handle(message) => void
onCancelcancel handle(message) => void