tabs() html()
Tabs: one tab per array item, title => content.
html()->tabs($tabs = [], $extra = [])Options
| Option | Meaning |
|---|---|
$tabs | Title => content (developer HTML), or title => ['body' => ..., 'disabled' => 1]. |
selected | Title of the open tab; default the first. |
class, id, show_all, no_headers | Classes; id; show every pane (print views); no tab headers. |
type, fill, justified, vertical | Bootstrap 5: tabs, pills, underline; fill or justify the nav; vertical pills. |
Example
first text
second text
Third tab, open on load: selected names it.
44444
Code
return html()->tabs([
'first' => 'first text',
'second' => 'second text',
'third' => '<p>Third tab, open on load: <code>selected</code> names it.</p>',
'fourth' => '44444',
], ['selected' => 'third']);Notes
- Pane ids are
tab_<title>, so links to#tab_thirdopen that tab. form2 builds its tabs with this widget (tab_start()).
Bootstrap 3 and 5
Bootstrap 3 tabs; Bootstrap 5 uses nav-link + data-bs-toggle and the type / fill / vertical options.
See also: form/tab, html/accordion, demo:html/bs5_options