alert() html()
An alert box with a heading and a body, closable.
html()->alert($data = [], $extra = [])Опції
| Опція | Значення |
|---|---|
$data | ['head', 'body', 'alert' => 'danger|warning|info|success'], or a body string with the options second. |
alert | Colour; default error / danger. |
no_close, class_add, id | No close button; classes; id. |
Приклад
Heads up
An info alert.
A plain success line, no close button.
Код
return html()->alert([
'head' => 'Oh snap! You got an error!',
'body' => '<p>Change this and that and try again.</p><p><a class="btn btn-danger" href="#">Take this action</a> <a class="btn btn-default btn-outline-secondary" href="#">Or do this</a></p>',
])
. html()->alert(['alert' => 'info', 'head' => 'Heads up', 'body' => 'An info alert.'])
. html()->alert('A plain success line, no close button.', ['alert' => 'success', 'no_close' => 1]);Bootstrap 3 and 5
Bootstrap 3 alerts; Bootstrap 5 alert-dismissible with btn-close.
Див. також: html/toast, html/badge