Цю сторінку ще не перекладено українською, тому нижче англійська версія.

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.
alertColour; default error / danger.
no_close, class_add, idNo close button; classes; id.

Приклад

Oh snap! You got an error!

Change this and that and try again.

Take this action Or do this

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