Gestion des modals
Corentin Nelhomme mengedit halaman ini 1 tahun lalu

Modal

The all you need Modal — powerful and pluggable.

When should I use this ?

There could be many reasons why you may want to use the Modal, but some could be:

  • You need to display additional information or context without navigating away from the current page.

  • You want to confirm a user action, such as deleting a record or submitting a form.

  • You're building a multi-step flow or wizard, and each step should stay in the same context.

Use

Javascript structure :

const modal = new Modal("modalTranslate");

moodalTranslate is just an exemple of id (string) you could put in the modal instance.

HTML Structure :

<div id="modalTranslate" class="nseBgModal">
    <div class="nseModal" style="width: 50rem;">
        <button class="closeBtn">x</button>

        <div class="nseModalContent">
            <h1>Title</h1>

            <div class="nseHeader" id="translateHeader">
                <div class="alert danger"></div>
            </div>

            <p>Your content</p>
        </div>

        <div class="nseModalFooter">
            <div class="nseModalFooterItem">
                <div class="nseFlex">
                    <button class="nseButton cancelBtn">
                        Cancel
                    </button>
                    <button class="nseButton validateBtn">
                        Validate
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>

Methods

open()

Show the modal. Use it like this:

modal.open()