# Modal Modal component displays important information, confirmations, or actions in a focused overlay above the main interface. It requires user interaction before returning to the underlying content. **Category:** Components **Storybook:** https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-modal--introduction ## Variants documented in Storybook - StandardModals: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-modal--standardmodals - ModalCenter: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-modal--modalcenter - ModalBackdrops: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-modal--modalbackdrops ## Framework setup ### HTML / CDN ```html ``` ### React ```bash npm install ux4g-web-components ``` ```jsx import 'ux4g-web-components/styles.css'; import 'ux4g-web-components/design-system'; ``` ### Angular Update `angular.json`: ```json { "styles": [ "node_modules/ux4g-web-components/styles/ux4g.css", "src/styles.css" ], "scripts": [ "node_modules/ux4g-web-components/dist/runtime/design-system.js" ] } ``` ## Code examples The snippets below are extracted from the Storybook canvas for Modal. Each example shows the rendered HTML, the equivalent React JSX, and the Angular template markup. ### 1. Introduction — Introduction HTML: ```html
Modal component displays important information, confirmations, or actions in a focused overlay above the main interface. It requires user interaction before returning to the underlying content.
A modal demands the user’s attention by temporarily disabling interaction with the rest of the page.
A visually engaging modal variant with hero imagery.
A modal is a design element that pops up over the main content of a webpage.
A danger modal variant with hero imagery.
The content within this modal is horizontally centered for maximum focus.
Centered content variant with hero imagery.
Quickly copy modal size, layout, and backdrop utilities.
ux4g-modal-s |
ux4g-modal-m |
ux4g-modal-l |
Centered content ux4g-modal-center-content |
Danger border ux4g-border-error |
Danger action ux4g-btn-danger |
|
25% Opacity Background
ux4g-modal-backdrop-25
|
|
50% Opacity Background
ux4g-modal-backdrop-50
|
|
75% Opacity Background
ux4g-modal-backdrop-75
|
|
8px Backdrop Blur
ux4g-modal-backdrop-blur
|
Modal component displays important information, confirmations, or actions in a focused overlay above the main interface. It requires user interaction before returning to the underlying content.
A modal demands the user’s attention by temporarily disabling interaction with the rest of the page.
A visually engaging modal variant with hero imagery.
A modal is a design element that pops up over the main content of a webpage.
A danger modal variant with hero imagery.
The content within this modal is horizontally centered for maximum focus.
Centered content variant with hero imagery.
Quickly copy modal size, layout, and backdrop utilities.
ux4g-modal-s
|
ux4g-modal-m
|
ux4g-modal-l
|
|
Centered content
ux4g-modal-center-content
|
|
Danger border
ux4g-border-error
|
|
Danger action
ux4g-btn-danger
|
|
25% Opacity Background
ux4g-modal-backdrop-25
|
|
50% Opacity Background
ux4g-modal-backdrop-50
|
|
75% Opacity Background
ux4g-modal-backdrop-75
|
|
8px Backdrop Blur
ux4g-modal-backdrop-blur
|
Modal component displays important information, confirmations, or actions in a focused overlay above the main interface. It requires user interaction before returning to the underlying content.
A modal demands the user’s attention by temporarily disabling interaction with the rest of the page.
A visually engaging modal variant with hero imagery.
A modal is a design element that pops up over the main content of a webpage.
A danger modal variant with hero imagery.
The content within this modal is horizontally centered for maximum focus.
Centered content variant with hero imagery.
Quickly copy modal size, layout, and backdrop utilities.
ux4g-modal-s |
ux4g-modal-m |
ux4g-modal-l |
Centered content ux4g-modal-center-content |
Danger border ux4g-border-error |
Danger action ux4g-btn-danger |
|
25% Opacity Background
ux4g-modal-backdrop-25
|
|
50% Opacity Background
ux4g-modal-backdrop-50
|
|
75% Opacity Background
ux4g-modal-backdrop-75
|
|
8px Backdrop Blur
ux4g-modal-backdrop-blur
|
Standard system overlay with 25% opacity.
Standard system overlay with 25% opacity.
Standard system overlay with 25% opacity.
Increased contrast for higher focus.
Increased contrast for higher focus.
Increased contrast for higher focus.
Strongest focus level with near-black backdrop.
Strongest focus level with near-black backdrop.
Strongest focus level with near-black backdrop.
Gaussian blur effect applied to the content underneath.
Gaussian blur effect applied to the content underneath.
Gaussian blur effect applied to the content underneath.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.
A modal is a design element that pops up over the main content of a webpage. It demands the user’s attention by temporarily disabling interaction with the rest of the page until the user addresses the content within the modal.