Tabs Custom Block
Tabs is a custom block component that allows for tabbed content that can be displayed either vertically or horizontally. Tabs serve as a way of grouping content together, presenting it in easily digestible pieces. These tabs load content during initial page load and not after a tab has been clicked and therefore should not present issues with SEO.
The image below is an example of three tabs presented horizontally.
Things to note:
- Tabs can be displayed vertically or horizontally.
- There isn't a limit for the number of tabs but do keep in mind that tabs will begin to wrap (and they are stacked in mobile). It is recommended to keep the number minimal (5 at most).
- You can select one tab to be open by default and it doesn't have to be the first tab listed.
To create Tabs
Editors and Site builders are able to create tab custom blocks. It is an option in the Custom Block Library. Once a Tab block has been created, it will be added to the custom block library. They can also be created using the Panelizer (for sites still using the Panels Dashboard) or in Layout as inline blocks as non reusable content (which means these will not be found in the custom block library!).
Custom Block Library Method (recommended)
If you create a Tab block using this method, it will be considered reusable content and can be placed on multiple pages if necessary.
- From the admin toolbar panel, navigate to Structure ->Block Layout -> Custom Block Library
- Click on the +Add custom block button.
- From the list of available blocks, click on Tabs.
- Give the Tabs custom block a unique block description
- Optionally add in an "Introduction". This will allow you to add in content above the listed tabs.
- Under "Tabs Info", select whether you want this Tabs block to display vertically. If the check box is left unmarked, the tabs will display horizontally.
- Tab Items will display all tab content. The "Tab Title" will be the title for the tab. Keep these as brief as possible. Tab body content will display once the tab is clicked.
- Notice the "Open by Default" option, this is optionally but if selected, please only select one to be open by default.
- To add more tabs, click "Add Tab".
- To remove a tab, click "Remove" next to the tab you want removed.
- Tabs can be reordered by clicking and holding down the arrow cross hair.
- By default, the block is in draft and will not display to those viewing the site, only to authenticated (logged in) users. Once you are ready for the updates to publish, change the state to "Published".
- When done, click "Save".
Add Tabs to a Basic Page
- Open a Basic Page previously created by clicking on the content's title that you want to display the basic block.
- If your site uses the Panels Dashboard: In the view where Panelizer is displayed, click on "Manage Content, then Select "Custom"
If your site uses Layout: In the Layout tab, click on +Add block where you want the tabs block to be placed. In the right panel, filter for or search for your block under the Custom label.
- Find the block description of the tab block created and click on the block.
- Optionally display the title when placed on the page. You can also update the text of the displayed title.
- If your site uses the Panels Dashboard: Select the region of the page to display the block (by default, it will be added to "Content")
- Click Add
- Make sure you "Save" your page.
The tab block has now been added to the selected region of your page. This block can be placed on multiple pages. Follow the instructions above for each page. Additionally, site builders can use block placement to add a tab block to multiple nodes at once.