Modal
Use modals to show something full screen to the user.
File to include
@import "components/modal";
Script to include
<script src="/lib/modal.js"></script>
Without close button
<div class="modal-container">
<button class="btn open-modal">Open modal</button>
<div class="modal">
<img src="/assets/images/modal-landscape.jpg" alt="Modal">
</div>
</div>
With close button
<div class="modal-container" data-close>
<button class="btn open-modal">Open modal</button>
<div class="modal">
<img src="/assets/images/modal-landscape.jpg" alt="Modal">
</div>
</div>
With an alert
Alert
<div class="modal-container">
<button class="btn open-modal">Open modal</button>
<div class="modal">
<div class="alert" data-color="danger">
<p>Alert</p>
<div class="flexbox">
<button class="btn" data-button-style="plain" data-color="danger">Button</button>
<button class="btn btn-close" data-button-style="text">Close</button>
</div>
</div>
</div>
</div>
Attributes
Name | Example value | Possible values | Default | Required |
---|---|---|---|---|
data-close | - | - | None | No, but you do not have to add it if you add a custom icon |
data-close-icon | close-regular | - | close-solid | No |