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

accordion() html()

An accordion: one collapsible item per array entry, title => body.

html()->accordion($data = [], $extra = [])

Опції

ОпціяЗначення
$dataTitle => body (developer HTML), or title => ['body', 'class_group', 'class_head'].
selectedTitle of the open item.
class, class_head, idClasses of the whole and of the headers; id.
flush, always_open, themeBootstrap 5: no borders; items open independently (no data-parent); data-bs-theme.

Приклад

first accordion item body
second accordion item body
Open on load: selected names it.
fourth accordion item body

Код

return html()->accordion([
    'first' => ['body' => 'first accordion item body', 'class_group' => 'panel-info', 'class_head' => 'alert-info'],
    'second' => ['body' => 'second accordion item body', 'class_group' => 'panel-danger', 'class_head' => 'alert-error'],
    'third' => 'Open on load: <code>selected</code> names it.',
    'fourth' => 'fourth accordion item body',
], ['selected' => 'third', 'class' => 'span4 col-md-4']);

Примітки

  • Item bodies have ids accordion_item_<title>; opening one closes the others unless always_open.

Bootstrap 3 and 5

Bootstrap 3 collapse panels; Bootstrap 5 accordion-item markup.

Див. також: html/collapse, html/tabs