Tab Layout
Last updated
Last updated
📢 Use this project, contribute to it or open issues to help evolve it using Store Discussion.
The Tab Layout app provides you the needed structure to create different layouts within the store's main one from the use of tabs.
Example of an brazilian VTEX store with tabs (Perfumes até 40%off
, Presentes
, and Best Sellers
) displaying different content for users.
Add the Tab Layout app to your theme's dependencies in the manifest.json
file:
Now, you are able to use all the blocks exported by the tab-layout
app. Check out the full list below:
Block name | Description |
---|---|
| |
| |
| |
| Flexible alternative to |
| |
|
In the desired page tempate, such as store.home
, add the tab-layout
block:
Declare the tab-list
and the tab-content
blocks as tab-layout
's children. Do not forget to use the tab-layout
's props, for example:
Add and then declare the desired tab-list.item
blocks as tab-list
's children:
Add and then declare the desired tab-content.item
blocks as tab-content
's children:
⚠️ Do not forget to also declare the
tab-content.item
's children blocks in order to properly render the tab content.
tab-layout
propsProp name | Type | Description | Default value |
---|---|---|---|
|
| ID of the desired tab to be rendered as the default one. If no value is provided, the first tab declared in the theme will be used as default. |
|
|
| Block ID of your choosing to be used in CSS customization. |
|
tab-list
propsProp name | Type | Description | Default value |
---|---|---|---|
|
| Block ID of your choosing to be used in CSS customization. |
|
tab-list.item
propsProp name | Type | Description | Default value |
---|---|---|---|
|
| Block ID of your choosing to be used in CSS customization. |
|
|
| Tab ID of your choosing. It will be used to match the tab to its content (defined by the |
|
|
| Defines the tab's text label. |
|
|
| Defines the item as the default active tab. |
|
tab-list.item.children
propsProp name | Type | Description | Default value |
---|---|---|---|
|
| Block ID of your choosing to be used in CSS customization. |
|
|
| Tab ID of your choosing. It will be used to match the tab to a given content (defined by the |
|
tab-content
propsProp name | Type | Description | Default value |
---|---|---|---|
|
| Block ID of your choosing to be used in CSS customization. |
|
tab-content.item
propsProp name | Type | Description | Default value |
---|---|---|---|
|
| Block ID of your choosing to be used in CSS customization. |
|
|
| Tab ID of your choosing. It will be used to match the content to a given tab (defined by the |
|
⚠️ *Pay attention to the chosen tab ID declared in both
tab-list.item
andtab-content.item
blocks, once it is the key to link a given tab to its content.
In order to apply CSS customizations in this and other blocks, follow the instructions given in the recipe on Using CSS Handles for store customization.
CSS Handle |
---|
|
|
|
|
|
|
|
|
Thanks goes to these wonderful people:
This project follows the all-contributors specification. Contributions of any kind welcome!
Parent block that merely defines the logic (via its children blocks) for the layout structure, declaring the desired list of tabs and its content.
Defines the list of tabs to be rendered. It only accepts the tab-list.item
block as child.
Defines the rendering for a given tab. Notice that it does not define the tab content, which is handled by the tab-content.item
block.
Defines the list of content to be rendered in each tab. It only accepts the tab-content.item
block as child.
Defines the content for a given tab.