

Photo: Rachel Hannah Photo
Modal
Introduction
Present actionable content to visitors with dismissable modal dialog overlays.
Default Behavior
Use the button below to launch the modal component with default behavior. Modals center horizontally and vertically. Content within the .modal__content__body selector scrolls (vertically) when its content’s height exceeds the height of the viewport.
<!-- Modal button -->
<button class="button" data-modal="open" aria-controls="modal-example-01" type="button" > Open Modal </button>
<!-- Modal dialog -->
<div class="modal" id="modal-example-01" aria-hidden="true"> <div class="modal__content narrow border-radius-2 box-shadow-3" aria-labelledby="modal-example-01-title" role="dialog" aria-modal="true" > <header class="modal__content__head border-bottom"> <h2 class="h6" id="modal-example-01-title"> Modal Title One </h2> <button class="button button--icon-only" data-modal-close type="button"> <span class="icon icon-close" aria-hidden="true"></span> </button> </header>
<main class="modal__content__body" id="modal-example-01-content"> <p>...</p> </main>
<footer class="modal__content__foot border-top text-color-link"> <ul class="nav nav--horizontal justify-content-between"> <li> <a href="#1">Secondary Action</a> </li> <li> <a class="button border-radius-pill" href="#1">Primary Action</a> </li> </ul> </footer>
</div>
</div>| Lines | Details |
|---|---|
| 3-10 | A button with the The |
| 14-18 | The The |
| 19-24 | The It centers the modal and holds the modal’s header, body, and footer selectors. The The The Use The |
| 25-32 | The It holds the modal’s header and close icon button. The The |
| 34-36 | The It holds the modal’s main content. |
| 38-47 | The It holds the modal’s actionable buttons and links. The |
Scroll Entire Modal
If you wish for the entire modal to scroll, add the .modal--scroll-all modifier class to the .modal selector (Figure 2, line 1).
<div class="modal modal--scroll-all" id="..."> ...</div>Close Outside
With the data-modal-close-outside="true" attribute present, the modal closes when the user clicks outside of the modal content (Figure 3, line 1).
<div class="modal" id="..." data-modal-close-outside="true">...</div>













































