Skip to content

Alert - Web Component

The Alert component can be used imported from:

Playground

Parameters

The Web component uses the <z-alert> tag:

By default, all the parameters are optional or can be set in different, except for the ones marked as required

The parametrization of the component can be done with the following custom HTML params:

NameTypeDescriptionSlotA11y
configstring

Defines the state of the alert. Possible values are:

info, alert, negative and positive

contentstringThe content of the alert.default
confirm-textstringThe text of the button.confirm-text
hide-closebooleanHides the close button

Events

This component has events. Check the documentation about how to use the events.

NamePayloadDescription
confirmvoidFired when the user confirms the alert.
closevoidFired when the user closes the alert.

Slots

This component has slots. Check the documentation about how to use the slots.

NameTagsDescription
defaultspan
confirm-textspan

Parameters use

content

The thing to be assigned to the alert. It uses the default slot too.

Alert content

config

The config attribute is used to set the state of the alert. Possible values are: info, alert, negative and positive.

This is an info alertThis is an alert alertThis is a negative alertThis is a positive alert

confirm-text

The confirm-text attribute is used to set the text of the confirm button.

This is an info alert

Both background color and text color can be customized using the --z-alert--bg and --z-alert--color tokens.

Custom alert

Browser support

Detected engine:  

  • Chromium

  • Webkit

  • Gecko

HTML Examples

CodeSandbox example