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

modal(), modal_button() html()

A modal dialog (header, body, footer) and the button that opens it.

html()->modal($extra = [])
html()->modal_button($text = '', $id = '', $extra = [])

Опції

ОпціяЗначення
idId of the dialog; default modal_<n>.
header, body, footerDeveloper HTML (not escaped).
show_close, inline, styleClose button; draw it in the page (as here) instead of hidden; inline style.
size, fullscreen, centered, scrollable, static, fade, themeBootstrap 5 options: sm / lg / xl, true or a breakpoint, vertical centre, scrolling body, no close on backdrop clicks, animation, data-bs-theme.
modal_button($text, $id, $extra)A button() that opens the dialog $id.

Приклад

Код

return html()->modal([
        'inline' => 1,
        'show_close' => 1,
        'header' => 'Modal header',
        'body' => '<p>Some body</p>',
        'footer' => form_item()->save(),
    ])
    . html()->modal(['id' => 'docs-ref-confirm', 'header' => 'Delete?', 'body' => '<p>The item goes to the bin.</p>', 'show_close' => 1, 'centered' => 1])
    . '<p>' . html()->modal_button('Open a dialog', 'docs-ref-confirm', ['type' => 'danger']) . '</p>';

Примітки

  • The first dialog is drawn inline so the page shows it; a real one is hidden until its button opens it.

Bootstrap 3 and 5

Bootstrap 3: data-toggle="modal", .close; Bootstrap 5: data-bs-toggle, .btn-close, and the B5 options; Tailwind CSS (tw): daisyUI's modal / modal-box from the class map, opened by the yf_tw bridge (size, fullscreen, static, inline). Bootstrap 3 modals, Bootstrap 5 modal.

Див. також: html/offcanvas, html/button