Introduction
The Tab Layout is a layouts structuring paradigm created in the Store Framework to allow the construction of layouts with tabs or guides.
In this paradigm, we have two containers: the tab-list and the tab-content. In each of these containers, we have the items that compose them. Within the tab-list, we have the tab-list.item. In the tab-content, we have thetab-content.item.
Below, we will see an example of implementing a tab layout.
First, it is necessary to declare the tab-layout block in the desired template:
_10{_10 "store.home": {_10 "blocks": [..."tab-layout"]_10 }_10}
Then, it is necessary to declare a tab-list and atab-content as children of the tab-layout:
_10..._10"tab-layout": {_10 "children": [_10 "tab-list",_10 "tab-content"_10 ]_10}
With that, we have these two containers as components of our tab-layout. The next step is to declare tab-list.item and tab-content.item as children of tab-list and tab-content, respectively:
_10..._10"tab-list": {_10 "children": [_10 "tab-list.item#1",_10 "tab-list.item#2"_10 ]_10}
_10..._10"tab-content": {_10 "children": [_10 "tab-content.item#1",_10 "tab-content.item#2"_10 ]_10}
In the next step, we have to declare the properties of the tab-list.item. The code below generates a tab interface like the one in this image:

The tabId property is very important, as it is the key that connects the button of a tab-list.item with a tab-content.item.
_14..._14"tab-list.item#1": {_14 "props": {_14 "tabId": "majorAppliances",_14 "label": "Major Appliances",_14 "defaultActiveTab": true_14 }_14},_14"tab-list.item#2": {_14 "props": {_14 "tabId": "electronics",_14 "label": "Electronics"_14 }_14}
Next, we will declare the children and props of tab-content.item.
In children's array, it is possible to include several blocks such as rich-text, info-card, image, flex-layout, and so.
In the tabId prop, it is necessary to include the same identifiers (ids) declared in the tab-list.item for the link between the tab and the content to work.
_17..._17"tab-content.item#1": {_17 "children": [_17 "rich-text#1"_17 ],_17 "props": {_17 "tabId": "majorAppliances"_17 }_17},_17"tab-content.item#2": {_17 "children": [_17 "rich-text#2"_17 ],_17 "props": {_17 "tabId": "electronics"_17 }_17}
Finally, you must declare the properties of your content. In our example, we put only one rich-text in each tab-content.item:
_14"rich-text#1": {_14 "props": {_14 "text": "Texto para Major Appliances",_14 "textPosition": "CENTER",_14 "font": "t-heading-3"_14 }_14},_14"rich-text#2": {_14 "props": {_14 "text": "Texto para Electronics",_14 "textPosition": "CENTER",_14 "font": "t-heading-3"_14 }_14}
Activity
In this activity, we will create the simple structure of a tab layout, as shown in the image below. Later, we will include some content to style our customized page.

-
In the
home.jsoncfile created earlier, add atab-layout#home; -
Declare the
tab-layout#homeblock and add atab-list#homeand atab-content#homeas your children; -
Declare a
tab-list#homeand add atab-list.item#home1and atab-list.item#home2as your children; -
Declare the
tab-list.item#home1props so that the interface displays the text "Major Appliances". (Hint: don't forget to include atabId = "majorAppliances"in the props and thedefaultActiveTab = trueproperty); -
Declare the props of the
tab-list.item#home2so that the interface displays the text "Electronics". (Hint: don't forget to include atabId = "electronics"in the props); -
Now, let's move on to the content part. Declare a
tab-content#homein your theme and add the childrentab-content.item#home1andtab-content.item#home2; -
In each
tab-content.item, declare only onerich-textas a child (for example,rich-text#home1andrich-text#home2); -
Then, include a prop
tabIdin eachtab-content.itemso that the link happens between thetab-listcreated previously andtab-content; -
Finally, add the
rich-textand declare your props according to the code below:_14"rich-text#home1": {_14"props": {_14"text": "Área do conteúdo da tab-list.item com tabId = majorAppliances",_14"textPosition": "CENTER",_14"font": "t-heading-3"_14}_14},_14"rich-text#home2": {_14"props": {_14"text": "Área do conteúdo da tab-list.item com tabId = electronics",_14"textPosition": "CENTER",_14"font": "t-heading-3"_14}_14}
Note: Remember to access the Tab Layout and Rich Text documentations if you have any questions during the activity.