Modals & Dialogs Checklist
A modal must be openable, closeable, and accessible. It must trap focus inside, respond to the Escape key, block background scroll, and handle loading/error states for any async action inside it.
Live Demo
Interact with the examples below to see the correct modal behavior in action — focus trapping, loading states, validation, error display, ESC key, and backdrop click.
A destructive confirmation modal with a loading state on the primary action button. ESC key, backdrop click, and the close button all close it.
A form modal with field validation, inline error handling, a loading Save button, and a "Trigger Error" button to simulate a server error inside the modal.
2. Closing a Modal
3. Modal Content Structure
4. Confirmation Modals
Used before destructive or irreversible actions like delete, archive, or remove member.
5. Form Modals
6. Accessibility
7. Stacking & Nested Modals
Avoid nesting modals whenever possible — re-think the UX first.