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.

Confirmation Modal — Delete Action

A destructive confirmation modal with a loading state on the primary action button. ESC key, backdrop click, and the close button all close it.

Form Modal — Add Project

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.

1. Opening a 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.





8. Mobile







Before Marking Done
Modal open, close, focus trap, Escape behavior, scroll lock, loading state, error state, accessibility, and mobile behavior must all be tested.