Modal

Published on February 16, 2021, updated on June 16, 2021

Element: <ins-modal>

Defines a dynamic modal for use in the page.

Complete Example
Phasellus blandit leo ut odio. Sed cursus turpis vitae tortor. Cras dapibus.

Code Snippet

<ins-button 
  label="OPEN MODAL" 
  solid id="myButton">
</ins-button>

<ins-modal 
  id="myModal"
  with-backdrop light
  heading="Terms and Conditions"
  confirmation value="DATA"
  width="400px" height="400px"
  close-button-label="CLOSE"
  close-button-icon="icon-close-1"
  close-button-color="secondary"
  confirm-button-label="ACCEPT"
  confirm-button-icon="icon-check1"
  confirm-button-color="positive"
  prevent-click-outside>

  <div id="myModalContent">Phasellus blandit leo ut odio.

Sed cursus turpis vitae tortor.

Cras dapibus.</div>

</ins-modal>

<script>
  var myModal = document.getElementById('myModal');
  var myButton = document.getElementById('myButton');
  myButton.addEventListener('insClick', () => {
    myModal.open();
  });
</script>
Form in Modal Example

Code Snippet

<ins-button 
  label="OPEN MODAL FORM" 
  solid 
  id="modalFormBtn">
</ins-button>

<ins-modal 
  id="modalForm"
  with-backdrop no-button
  parent-render="parentModal"
  heading="Modal Form Example"
  width="420px" height="390px">

  <form>
    <ins-input 
      label="First Name">
    </ins-input>
    
    <ins-input 
      label="Last Name">
    </ins-input>

    <ins-input 
      label="Email">
     </ins-input>

    <div class="text-right">
      
    <ins-button 
      label="Submit" solid>
    </ins-button>

    </div>

  </form>

</ins-modal>

<script>
    var modalFormBtn = document.getElementById('modalFormBtn');
    var modalForm = document.getElementById('modalForm');

    modalFormBtn.addEventListener('insClick', () => {
      modalForm.open();
    });
</script>

 

Attributes

 

FIELD ATTRIBUTE TYPE DEFAULT OPTIONS DESCRIPTION
with-backdrop boolean false true, false Renders the modal with a backdrop (dark)
light boolean false true, false Renders the modal backdrop as white
heading string - - Defines the heading of the modal
confirmation boolean false true, false Renders the modal as a confirmation popup
value any - - Defines the value of the modal which will be return to the event
width string 100% CSS valid units Defines the width of the modal
height string auto CSS valid units Defines the height of the modal
close-button-label string CANCEL - Defines the label of the modal's close button
close-button-color string blue Insites Colors Defines the color of the modal's close button
close-button-icon string blue Insites Font Icons Defines the icon of the modal's close button
confirm-button-label string CANCEL - Defines the label of the modal's confirm button
confirm-button-color string blue Insites Colors Defines the color of the modal's confirm button
confirm-button-icon string blue Insites Font Icons Defines the icon of the modal's confirm button
button-alignment string center left, right, center Defines the alignment of the close and confirm buttons
prevent-click-outside boolean false true, false Defines if the modal can be close when clicking outside of it.
parent-render string "" - Defines the id of the parent modal for use when inside an iframe page
no-button boolean false true, false Defines if the modal should have buttons or not

 

Events

 

EVENT OBJECT DESCRIPTION
insClose click event Emits an event when the modal is closed, cancelled or confirmed. Event detail includes the value and the type of action done.

 

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.