Alert - Web Component โ
Browser support โ
Parameters โ
The Web component uses the <z-alert>
tag:
The parametrization of the component can be done with the following custom HTML params:
Name | Type | Description |
---|---|---|
config (optional) | string | Defines the state of the alert. Possible values are:
|
content (optional) | string | The content of the alert. |
confirm-text (optional) | string | The text of the button. |
The events emitted from the component are:
Name | Payload | Description |
---|---|---|
onconfirm | Event | Fired when the user confirms the alert. |
onclose | Event | Fired when the user closes the alert. |
config
โ
The config
attribute is used to set the state of the alert. Possible values are: info
, alert
, negative
and positive
.
confirm-text
โ
The confirm-text
attribute is used to set the text of the confirm button.
Both background color and text color can be customized using the --z-alert--bg
and --z-alert--color
tokens.
Playground โ
Customization โ
HTML Examples โ
Imports
html
<link rel="stylesheet" href="/0.4.3/@zurich/web-components/styles.css" />
<script type="module" src="/0.4.3/@zurich/web-components/alert.js"></script>
Code
html
<z-alert config="info" confirm-text="Okay">Alert text</z-alert>
<z-alert config="alert" confirm-text="Okay" content="Alert text"></z-alert>
<z-alert config="negative" confirm-text="Okay" content="Alert text"></z-alert>