An overview of the Tab component
The tab component allows you to create highly responsive user experiences. Content can be layered inside of tabs, so that users can quickly flip between different views within your website or web app.
In this tutorial we will cover:
- Adding tabs
- Common tab layouts
- Editing tab names
- Adding new tabs
- Adding content to your tabs
- Styling tabs
To add a tab component to the canvas, first find the Tab component in the components panel.
It is possible to add the link block either through (1) by selecting the list component & dragging & dropping it onto the canvas or (2) using the arrow buttons at the top of the components panel.
The two most common tab layouts are:
- 1.Horizontal tab layouts across the top of the screen
- 2.Vertical tab layouts down the left hand side of the screen
Check out some examples of these tab layouts in action.
Horizontal tab layout: Data, Analytics, Pulse & Admin
Vertical tab layout: Overview, Keywords, Groups etc.
Horizontal tab layout example: Tour, Features, Pricing
Vertical tab layout example: Home, Search, Your songs etc.
To build a horizontal tab layout, simply pull the tab layout onto the page.
To build a vertical tab layout, first select the TabList component, that makes up part of the overall tab component. Next, set the TabList Layout to vertical.
Second, select the Tabs component & set the Tab Layout to Horizontal.
Next, you can select the Tabs component & set its height to 100%. This has the effect of setting the Tab List component to the height of the page.
You can now select the tab list & add colors to that list.
Next, select the individual Tabs & head over to the Properties Panel. From inside here, you can remove the Tabs default background color.
Ditto Tip: If you want to multi select components on the page, hold down Ctrl on Windows & Command on Mac while clicking on different components.
Next, we create a Tab class, set the typography Lato, the font weight to extra bold & the font color to #edebe9.
To edit a tab name, double click on the "span" element that is in the center of the tab, select the text & start to edit it.
To add a new tab (A) select the Tabs component > (B) use the settings either on the page or under properties panel to add a new tab > (C) make sure that the tab is styled consistently.
Notice, adding a tab this way adds more than just the tabs component. It also adds the Tab Content, Tab Panel & Div Block components.
An alternative way to add tabs is to use the clone or copy & paste feature. This is NOT RECOMMENDED, because it will only copy & paste or clone the individual tab component.
When you add a new tab to the page, you can see that the Tab is comprised of Tab Content, a Tab Panel & a Div Block. All of these components are stacked on top of each other.
To add content to the tab, you can place it inside either the Tab Panel or any children elements to the Tab Panel. For example, the Div Block.
Ditto tip: you can control the height of your tab content from inside the styles panel. Set height to 100vh, where vh stands for vertical height. This will make your tab content component take up the entire vertical height of the device.
To style your tabs, you need to first select the Tab component. These come with default styling as below.
You are able to remove the default styles using the properties panel on the right hand side of the screen.
Next, you can add a background color to your tabs. The best way to do this is to select the Tab List component that your Tabs are inside of & to change this color.
Finally, you can pick your typography, color of the text inside the tabs, add classes & other items like hover effects.