Dimension variables

Dimension variables let you create re-usable units that can be made responsive across viewport sizes. Dimension variables are definable in Theme tab -> Variables -> Dimensions. Each dimension variable lets you input a CSS Length Unit for the three major platforms users will view your content in: mobile, tablet and desktop. When you use the dimension variables anywhere in the studio (setting content widths, max image widths, etc.), you will the ability to control the dimensions of a component for each specific viewport.

Using dimension variables provides consistent spacing across your design system and enables responsive design.

Creating the dimension variable

Creating a dimension variable is simple: click add dimension, give the the variable a name that makes sense, click save, and then add in the dimensions for the different viewport sizes.

In the below example, we are creating a padding variable that will have a value of 16px on mobile and tablet, and a value of 24px when viewed on desktop.

Accessing the dimension variable

At some point you're going to want to apply these variables to different properties. Following the above example, we are adding the padding dimensional variable to the left and right padding values of our Content box by clicking the drop-down menu in the Content Padding section. This will ensure that the padding applied is responsive to the viewport our users are viewing the flow from.

The dimension variables can be re-used in as many places as you need, based on what makes sense with the length values they will apply.

Last updated