This module provides a way to create tabs using a render array theme. It utilizes the lightweight and accessible Tabby.js library, which is also used by Webform. An optional field formatter can be added for Viewfield to display views within tabs.
The Tabby JS library was chosen as it is lightweight, accessible,
just vanilla JS, and is already being used by Webform so many Drupal installs will already have the library present.
Features
Create a default set of tabs:
$build['tabs'] = [
'#theme' => 'tabby_tabs',
'#labels' => ['Label One', 'Label Two'],
'#content' => [
['#markup' => 'Content One'],
['#markup' => 'Content Two'],
],
];
Additional Requirements
This module requires the tabby js library.
See the readme file for instructions on installing this via composer.
Recommended modules/libraries
Tabby viewfield creates a field formatter for fields of type viewfield.
This means if you have a multi-cardinality view field you can place each view in a different tab.
Similar projects
Quick Tabs
- Not possible to create tabs with a render array.
- Not accessible unless you use quicktabs-accessible library which currently has some issues with D11.
Block Tabs
- Not possible to create tabs with a render array.
- No Drupal 11 version
- Is based on jQuery
Bootstrap Horizontal Tabs
- Not possible to create tabs with a render array.
- Does not come with a JS library - you have to install Bootstrap yourself.
Ask your assistant about Tabby
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
1 tracked project depends on this one