offcanvas(), offcanvas_button() html()
A side panel that slides in (filters, a mobile menu) and the button that opens it.
html()->offcanvas($extra = [])
html()->offcanvas_button($text = '', $id = '', $extra = [])Options
| Option | Meaning |
|---|---|
offcanvas($extra) | id, title (escaped), body (developer HTML), placement (start, end, top, bottom), backdrop (false, static), scroll, show, no_close, class_add. |
offcanvas_button($text, $id, $extra) | A button() that opens the panel $id. |
Example
Code
return html()->offcanvas([
'id' => 'docs-ref-panel',
'title' => 'Filters',
'body' => '<p>Side panel content: filters, a mobile menu...</p>',
'placement' => 'end',
])
. html()->offcanvas_button('Open the panel', 'docs-ref-panel', ['type' => 'primary']);Bootstrap 3 and 5
Bootstrap 3 and 4 render a modal() with the same id, opened by the same button.
See also: html/modal, demo:html/bs5_components