Overlay messages that display information or prompt the user to make a decision.
Modals are designed to capture the user's attention by temporarily interrupting their workflow, to prompt a decision or display relevant information. There are standard modals and alert modals.
Modals dim the background content and focus the user's attention on the modal itself, where a dialogue, or interaction between the application and user takes place. They remain on screen until the user either acknowledges the modal content, answers the modal question, or dismisses it.
When used appropriately, modals can enhance the user experience by providing a focused, contextual interaction. However, be mindful of their design and use to avoid frustrating or confusing users.
Do:
Avoid:
Nielsen Norman Group
Modal & Nonmodal Dialogs: When (& When Not) to Use Them
Are you sure you want to close without saving?
Any changes made will not be saved!
Are you sure you want to close without saving?
Any changes made will not be saved!
<turas-button button-opens-modal-id="markd3">Close without saving</turas-button>
<turas-modal modal-id="markd3" modal-title="Close without saving">
<turas-modal-body>
<p>Are you sure you want to close without saving?</p>
<p>Any changes made will not be saved!</p>
</turas-modal-body>
<turas-modal-footer>
<turas-button button-closes-modal>No, return to form</turas-button>
<turas-button button-type="Hyperlink" button-style="Primary" href="">Yes, close without saving</turas-button>
</turas-modal-footer>
</turas-modal>
<button class="btn btn-default " type="button" data-bs-toggle="modal" data-bs-target="#markd3">Close without saving</button>
<div class="modal modal-info " id="markd3" tabindex="-1" role="dialog" aria-labelledby="markd3Label" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title" id="markd3Label">Close without saving</div>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"><span class="fa-regular fa-x"></span></button>
</div>
<div class="modal-body">
<p>Are you sure you want to close without saving?</p>
<p>Any changes made will not be saved!</p>
</div>
<div class="modal-footer">
<button class="btn btn-default " type="button" data-bs-dismiss="modal">No, return to form</button>
<a href="" class="btn btn-primary ">Yes, close without saving</a>
</div>
</div>
</div></div>
Are you sure you want to delete Sandy Smith’s vaccination record?
Warning: this can not be undone!
<turas-button button-opens-modal-id="markd" button-style="Danger">Delete vaccination record</turas-button>
<turas-modal modal-id="markd" modal-title="Delete vaccination record" modal-style="Danger">
<turas-modal-body>
<p>Are you sure you want to delete Sandy Smith’s vaccination record?</p>
<p><strong>Warning: this can not be undone!</strong></p>
</turas-modal-body>
<turas-modal-footer>
<turas-button button-closes-modal>No, cancel</turas-button>
<turas-button button-type="Hyperlink" button-style="Primary" href="">Yes, delete vaccination record</turas-button>
</turas-modal-footer>
</turas-modal>
<button class="btn btn-danger " type="button" data-bs-toggle="modal" data-bs-target="#markd">Delete vaccination record</button>
<div class="modal modal-danger " id="markd" tabindex="-1" role="dialog" aria-labelledby="markdLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title" id="markdLabel">Delete vaccination record</div>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"><span class="fa-regular fa-x"></span></button>
</div>
<div class="modal-body">
<p>Are you sure you want to delete Sandy Smith’s vaccination record?</p>
<p><strong>Warning: this can not be undone!</strong></p>
</div>
<div class="modal-footer">
<button class="btn btn-default " type="button" data-bs-dismiss="modal">No, cancel</button>
<a href="" class="btn btn-primary ">Yes, delete vaccination record</a>
</div>
</div>
</div></div>
The user [emailaddress@nhs.scot] accesses Turas using their O365 details, generating a new password will only reset their Turas password. This action will not reset their NHS Scotland O365 password.
Are you sure you want to generate a new password?
<turas-button button-opens-modal-id="markd2" button-style="Primary">Generate new password</turas-button>
<turas-modal modal-id="markd2" modal-title="Generate new password" modal-style="Warning">
<turas-modal-body>
<p>The user [emailaddress@nhs.scot] accesses Turas using their O365 details, generating a new password will only reset their Turas password. This action will not reset their NHS Scotland O365 password.</p>
<p>Are you sure you want to generate a new password?</p>
</turas-modal-body>
<turas-modal-footer>
<turas-button button-closes-modal>No, close</turas-button>
<turas-button button-type="Hyperlink" button-style="Primary" href="">Yes, generate new password</turas-button>
</turas-modal-footer>
</turas-modal>
<button class="btn btn-primary " type="button" data-bs-toggle="modal" data-bs-target="#markd2">Generate new password</button>
<div class="modal modal-warning " id="markd2" tabindex="-1" role="dialog" aria-labelledby="markd2Label" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title" id="markd2Label">Generate new password</div>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"><span class="fa-regular fa-x"></span></button>
</div>
<div class="modal-body">
<p>The user [emailaddress@nhs.scot] accesses Turas using their O365 details, generating a new password will only reset their Turas password. This action will not reset their NHS Scotland O365 password.</p>
<p>Are you sure you want to generate a new password?</p>
</div>
<div class="modal-footer">
<button class="btn btn-default " type="button" data-bs-dismiss="modal">No, close</button>
<a href="" class="btn btn-primary ">Yes, generate new password</a>
</div>
</div>
</div></div>
If this is your first sign in it might take up to a minute to get everything ready.
<turas-button button-opens-modal-id="spinner1">Static loading screen</turas-button>
<turas-modal modal-id="spinner1" modal-is-static modal-title="Setting up NDP Developer Portal" modal-style="Load">
<turas-modal-body>
<p>If this is your first sign in it might take up to a minute to get everything ready.</p>
</turas-modal-body>
</turas-modal>
<button class="btn btn-default " type="button" data-bs-toggle="modal" data-bs-target="#spinner1">Static loading screen</button>
<div class="modal modal-load " id="spinner1" data-bs-backdrop="static" data-bs-keyboard="false" role="dialog" aria-labelledby="spinner1Label" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title" id="spinner1Label">Setting up NDP Developer Portal</div>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"><span class="fa-regular fa-x"></span></button>
</div>
<div class="modal-body">
<p>If this is your first sign in it might take up to a minute to get everything ready.</p>
</div>
</div>
</div></div>
This component is partially compliant with the WCAG 2.2 standard because of the following non compliances: