collapse() html()

A block shown and hidden by a button (more filters, details).

html()->collapse($body = '', $extra = [])

Options

OptionMeaning
$bodyDeveloper HTML.
buttonToggle text, default More; false for no button (your own toggle).
button_extra, show, id, class_addbutton() options of the toggle; open on load; attributes.

Example

Hidden filters: shown and hidden by the button.

Code

return html()->collapse('<div class="well card card-body">Hidden filters: shown and hidden by the button.</div>', ['button' => 'More filters']);

Bootstrap 3 and 5

Bootstrap 3 data-toggle="collapse" and in; Bootstrap 5 data-bs-toggle and show.

See also: html/accordion