UI Patterns

Modal confirmationStatusrelease

Ask for confirmation from the user before executing an action.

Guidance

Use this pattern to add friction to severe actions to help prevent user errors.

Example

Open in a new tab

Dependencies and installation

PackageInstallation
@stormid/modal
npm i -S @stormid/modal

Code

<button type="button" class="modal-confirmation__btn js-modal-confirmation__btn" aria-haspopup="dialog">Delete</button><div id="modal-confirmation" aria-labelledby="modal-label" role="region" class="js-modal-confirmation modal-confirmation modal-container" data-modal-toggle="js-modal-confirmation__btn"><div class="modal" role="dialog" aria-labelledby="modal-label" aria-describedby="modal-description"><h1 class="modal-confirmation__title" id="modal-label">Are you sure?</h1><form class="modal__form modal-confirmation__form" action="#"><p id="modal-description">This will permanently remove this item</p><div class="modal-confirmation__row"><button type="button" class="modal-confirmation__confirm">Delete</button><button type="button" class="modal-confirmation__cancel js-modal-confirmation__btn">Cancel</button></div></form></div></div>
import modal from '@stormid/modal';

modal('.js-modal-confirmation);

Acceptance criteria

The following is a list of example acceptance criteria to test against when using this pattern. These critera should test that the specific markup requirements are met, and that the confirmation behaves visually and functionally as expected.

For validation in developer tools / web inspector

For visual validation

For functional validation

References