# Alert An inline alert component for communicating status, warnings, or contextual information within a page. Supports leading icon, title, body content with progress bar and action buttons, and configurable trailing UI. **Category:** Components **Storybook:** https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-alert--introduction ## Variants documented in Storybook - ContextAlerts: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-alert--contextalerts - ToastAlerts: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-alert--toastalerts - SystemAlerts: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-alert--systemalerts ## 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 Alert. Each example shows the rendered HTML, the equivalent React JSX, and the Angular template markup. ### 1. Context Alerts — Information Alert HTML: ```html
``` React: ```jsx import React from 'react'; const AlertExample1Demo = () => ( <> > ); export default AlertExample1Demo; ``` Angular: ```html ``` ### 2. Context Alerts — Success Alert HTML: ```html ``` React: ```jsx import React from 'react'; const AlertExample2Demo = () => ( <>12:30PM
ActionAn inline alert component for communicating status, warnings, or contextual information within a page. Supports leading icon, title, body content with progress bar and action buttons, and configurable trailing UI.
Visual demonstration of the alert configurations supported by the design system.
|
Base alert container
ux4g-alert
|
|
Info variant
ux4g-alert-info
|
|
Success variant
ux4g-alert-success
|
|
Warning variant
ux4g-alert-warning
|
|
Error variant
ux4g-alert-error
|
|
Context alert
ux4g-context-alert
|
|
Alert icon
ux4g-alert-icon
|
|
Alert title
ux4g-alert-title
|
|
Alert message
ux4g-alert-message
|
|
Alert actions container
ux4g-alert-actions
|
|
Close button
ux4g-alert-close
|
An inline alert component for communicating status, warnings, or contextual information within a page. Supports leading icon, title, body content with progress bar and action buttons, and configurable trailing UI.
Visual demonstration of the alert configurations supported by the design system.
|
Base alert container
ux4g-alert
|
|
Info variant
ux4g-alert-info
|
|
Success variant
ux4g-alert-success
|
|
Warning variant
ux4g-alert-warning
|
|
Error variant
ux4g-alert-error
|
|
Context alert
ux4g-context-alert
|
|
Alert icon
ux4g-alert-icon
|
|
Alert title
ux4g-alert-title
|
|
Alert message
ux4g-alert-message
|
|
Alert actions container
ux4g-alert-actions
|
|
Close button
ux4g-alert-close
|
An inline alert component for communicating status, warnings, or contextual information within a page. Supports leading icon, title, body content with progress bar and action buttons, and configurable trailing UI.
Visual demonstration of the alert configurations supported by the design system.
|
Base alert container
ux4g-alert
|
|
Info variant
ux4g-alert-info
|
|
Success variant
ux4g-alert-success
|
|
Warning variant
ux4g-alert-warning
|
|
Error variant
ux4g-alert-error
|
|
Context alert
ux4g-context-alert
|
|
Alert icon
ux4g-alert-icon
|
|
Alert title
ux4g-alert-title
|
|
Alert message
ux4g-alert-message
|
|
Alert actions container
ux4g-alert-actions
|
|
Close button
ux4g-alert-close
|