Documentation
Feedback
Guides
VTEX IO Apps

VTEX IO Apps
Layout Apps
Responsive Layout
Official extension
Version: 0.1.4
Latest version: 0.x

{"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAABCAIAAAB2XpiaAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAFUlEQVR4nGPg4+Mz1Nfjl1L8f2MmAAz0A3OFonzpAAAAAElFTkSuQmCC","img":{"src":"https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square","width":110,"height":20,"type":"svg"}}

Responsive Layout allows you to declare layout structures that will only be rendered in a specific screen-size breakpoint.

{"base64":"  ","img":{"width":2840,"height":1428,"type":"gif","mime":"image/gif","wUnits":"px","hUnits":"px","length":1208072,"url":"https://cdn.jsdelivr.net/gh/vtexdocs/dev-portal-content@main/images/vtex-responsive-layout-0.gif"}}

This app defines and exports four blocks:

  • responsive-layout.desktop
  • responsive-layout.mobile
  • responsive-layout.tablet
  • responsive-layout.phone

Each block has composition: children, which means that it expects to receive an array of children blocks for rendering if the current screen-size is right for its breakpoint.

Configuration

  1. Import the Responsive Layout app to your theme dependencies in the manifest.json. For example:
"dependencies": { "vtex.responsive-layout": "0.x" }
  1. Add the responsive-layout block to your theme. For example:
"store.custom#about-us": { "blocks": [ "responsive-layout.desktop", "responsive-layout.tablet", "responsive-layout.phone" ] }, "responsive-layout.desktop": { "children": ["rich-text#desktop"] }, "responsive-layout.tablet": { "children": ["rich-text#tablet"] }, "responsive-layout.phone": { "children": ["rich-text#phone"] }, "rich-text#desktop": { "props": { "text": "# This will only show up on desktop.", "blockClass": "title" } }, "rich-text#tablet": { "props": { "text": "# This will only show up on tablet.", "blockClass": "title" } }, "rich-text#phone": { "props": { "text": "# This will only show up on phone.", "blockClass": "title" } },

Note that you could use any array of blocks as children, given that they are allowed by the block that is directly above responsive-layout.

Overlay Layout
« Previous
Slider Layout
Next »
See also
VTEX App Store
VTEX IO Apps