Skip to content

zk-alert ​

A message in the page, with a variant, a title and a close button.

Props ​

PropTypeDefaultDescription
variantstring'info'info, success, warning or error: data-variant. warning and error have role="alert", the others role="status"
titlestring|nullnullTitle
dismissibleboolfalseShows a close button (data-zk-dismiss=".alert", needs zk-scripts)
closeLabelstring'Close'Accessible name of the close button
classstring|nullnullCSS class(es) merged onto the root element

Undeclared attributes forward to the root element.

Slots ​

SlotDescription
defaultMessage
iconIcon
actionsButtons or links

Class hooks: alert, alert-icon, alert-body, alert-title, alert-content, alert-actions, alert-close. The close button needs the script of zk-scripts, which takes a CSP nonce; there is no inline handler.

Examples ​

Error ​

blade
<x-zk-alert variant="error" title="Payment failed" :dismissible="true">
    Your card was declined.
</x-zk-alert>

Documentation of 3.2.0 , built from c93e21f on 3.2.0 by pipeline #2919741884 on 2026-10-06.