Skip to content

Commit a5e6560

Browse files
adrianefongzecarlostorrealex-page
authored
[WIP] [Layout foundations] Updated documentation and guidance (Shopify#6640)
* Update spacing.md * updated spacing documentation * updated change log * uploaded spacing image * Delete spacing-principles.png * Add files via upload * updated spacing documentation * updated spacing documentation * Updated name from "Spacing" to "Space" * Updated file name * updated table font bold * updated optical adjustment section * updated images * removed comments * updated spacing documentation * updated gifs * updated common fate gif and images * updated polaris unit img size * typo update * remove old img * update img * remove comments * updated page and nav title * added principles illustration and breaks * adding breaks * updated spacing * update spacing * update spacing * Update foundations.json * Add back index.md Co-Authored-By: adrianefong <[email protected]> * update image and add changeset * move images to space directory and clean up duplicate md files Co-authored-by: Jose Torre <[email protected]> Co-authored-by: Alex Page <[email protected]>
1 parent d34e8e8 commit a5e6560

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+491
-167
lines changed

.changeset/wild-onions-draw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'polaris.shopify.com': patch
3+
---
4+
5+
updated spacing documentation

.changeset/witty-schools-burn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'polaris.shopify.com': minor
3+
---
4+
5+
updated documentation and guidance for layout foundations
Lines changed: 286 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
---
2+
title: Space
3+
icon: Columns3Major
4+
keywords:
5+
- spacing
6+
- space
7+
- layout
8+
- grid
9+
- position
10+
- margin
11+
- padding
12+
description: Consistent spacing creates visual balance that makes the user interface (UI) easier for merchants to scan. Apply consistent spacing to improve the quality of the UI.
13+
---
14+
15+
<!-- inline css styling for html video and images -->
16+
<style>
17+
.space-hero {
18+
margin: 40px -30px 40px -30px;
19+
}
20+
21+
.punit-img {
22+
display: block;
23+
margin: 40px auto 40px auto;
24+
width: 75%;
25+
}
26+
</style>
27+
28+
---
29+
30+
Space is the distance between objects in your design. It should be used to organize information in a way that is familiar and easy to scan, while helping reinforce its purpose.
31+
32+
<div class="space-hero">
33+
<img src="/images/foundations/design/space/spacing-polaris-size-units.svg" alt="A visual example of a polaris unit">
34+
</div>
35+
36+
---
37+
38+
## Principles
39+
40+
![Illustrations of blocks representing each principle](/images/foundations/design/space/[email protected])
41+
42+
### 1. Make content easy to understand.
43+
44+
Guides merchants' eyes, rather than expecting them to decipher all the information.
45+
46+
### 2. Augment the purpose of a page.
47+
48+
Make sure the information is organized in a way that makes clear its function.
49+
50+
### 3. Make it feel integrated.
51+
52+
Merchants experience pages, space should feel like a small part of a bigger system. Only introduce uniqueness when the benefits massively outweigh the cost of inconsistency.
53+
54+
---
55+
56+
## Spacing tools
57+
58+
### Polaris size units
59+
60+
All measurements used across the experience (space, width, height, etc) must reference Polaris size units to guarantee visual consistency and balance.
61+
62+
<div class="punit-img">
63+
<img src="/images/foundations/design/space/spacing-polaris-units.svg" alt="A visual example of a polaris unit">
64+
</div>
65+
66+
### Size scale
67+
68+
| Value | Size | px value | rem value |
69+
| -------- | ------------ | -------- | --------- |
70+
| 0 | --p-size-0 | 0 | 0 |
71+
| 0.25 | --p-size-025 | 1 | 0.0625 |
72+
| 0.5 | --p-size-05 | 2 | 0.03125 |
73+
| **1 (base)** | --p-size-1 | 4 | 0.25 |
74+
| 2 | --p-size-2 | 8 | 0.5 |
75+
| 3 | --p-size-3 | 12 | 0.75 |
76+
| 4 | --p-size-4 | 16 | 1 |
77+
| 5 | --p-size-5 | 20 | 1.25 |
78+
| 6 | --p-size-6 | 24 | 1.5 |
79+
| 8 | --p-size-8 | 32 | 2 |
80+
| 10 | --p-size-10 | 40 | 2.5 |
81+
| 12 | --p-size-12 | 48 | 3 |
82+
| 16 | --p-size-16 | 64 | 4 |
83+
| 24 | --p-size-24 | 96 | 6 |
84+
| 32 | --p-size-32 | 128 | 8 |
85+
86+
Polaris units are more dense at a small scale, and less so as dimensions increase.
87+
This is intentional to provide a good range to work with, but you must be deliberate in the units you decide to pair. We encourage designing with rhythm and contrast to achieve clear visual hierarchy. This often means skipping at least one unit in the scale when you’re pairing different sizes.
88+
89+
![Examples of different variations of spacing](/images/foundations/design/space/[email protected])
90+
91+
Repeating the same amount of spacing (left) and using more variation (right).
92+
93+
<br/>
94+
95+
### Column grid
96+
97+
The column grid is meant to give teams agency for page layouts, while still providing low level constraints that ensure consistent pages across the experience. This means teams should feel empowered to experiment with layout, as long as they use the column grid as a grounding element.
98+
99+
<video width="100%" height="auto" controls autoplay muted loop>
100+
<source src="/images/foundations/design/space/column.mp4" type="video/mp4">
101+
</video>
102+
103+
<br/>
104+
105+
### Breakpoints
106+
107+
<video width="100%" height="auto" controls autoplay muted loop>
108+
<source src="/images/foundations/design/space/breakpoints.mp4" type="video/mp4">
109+
</video>
110+
111+
The grid adapts to the viewport width. The amount of columns will change depending on how much space there is. This is a recommendation for how much should be displayed horizontally. Less columns means less content.
112+
113+
<br/>
114+
115+
| Screen size | Columns | Margin | Gutter | Navigation |
116+
| -------------------------------------- | ------- | ------ | ------ | ---------- |
117+
| **XS** <br/> 0-489 <br/> Phones | 6 | 16 | 16 | Collapsed |
118+
| **SM** <br/> 490-767 <br/> Small tablets | 6 | 16 | 16 | Collapsed |
119+
| **MD** <br/> 768-1039 <br/> Tablets | 6 | 24 | 16 | Collapsed |
120+
| **LG** <br/> 1040-1399 <br/> Laptops | 12 | 24 | 16 | Visible |
121+
| **XL** <br/> 1440+ <br/> Desktops | 12 | 32 | 16 | Visible |
122+
123+
The grid is meant to serve as a point of reference for page level design and alignment, but this doesn’t need to apply to component level layouts.
124+
125+
---
126+
127+
## Essentials for designing with space
128+
129+
### Gestalt principles
130+
131+
The perception of any given page goes beyond the individual elements presented, and the space between them. People’s perception is heavily influenced by their own expectations and motivations.
132+
When designing, it’s key to consider that people look for patterns, and will always perceive things in their simplest form. For instance, a bunch of similar items stacked on top of each other will likely read as a list.
133+
134+
![Different types of list items, such as menus, popovers, and dropdowns](/images/foundations/design/space/[email protected])
135+
136+
<br/>
137+
138+
People look for patterns instinctively, and they lean of visual cues like:
139+
140+
#### Similarity
141+
142+
Grouping things based on physical appearance (shape, color, size, orientation).
143+
144+
![Index table](/images/foundations/design/space/[email protected])
145+
146+
<br/>
147+
148+
#### Proximity
149+
150+
Grouping things based on distance between objects.
151+
152+
![Customers and orders page](/images/foundations/design/space/[email protected])
153+
154+
<br/>
155+
156+
#### Continuity
157+
158+
Grouping things based on the way they are arranged.
159+
160+
![Tag multiselect popover and media card](/images/foundations/design/space/[email protected])
161+
162+
Shadows inside popovers act as visual cues to indicate additional content when scrolled (left). Cards placed horizontally in a media carousel communicates related topics (right).
163+
164+
<br/>
165+
166+
#### Closure
167+
168+
Grouping things that are implicitly enclosed by a larger object.
169+
170+
![Order details page](/images/foundations/design/space/[email protected])
171+
172+
<br/>
173+
174+
#### Common fate
175+
176+
Grouping things based on how they move.
177+
178+
<video width="100%" height="auto" controls autoplay muted loop>
179+
<source src="/images/foundations/design/space/common-fate.mp4" type="video/mp4">
180+
</video>
181+
182+
<br/>
183+
184+
#### Common Region
185+
186+
Grouping things that are explicitly enclosed by a larger object.
187+
188+
![Customer details card](/images/foundations/design/space/[email protected])
189+
190+
Because people perceive these instinctively, we can use them as tools to create hierarchy, visual rhythm, and guide the user's eye to what’s important.
191+
192+
---
193+
194+
<br/>
195+
196+
### Rhythm
197+
198+
Alternating between objects and space creates a pattern. Repeated patterns create visual rhythm, which can be used to effectively direct the viewer’s attention.
199+
Anything can establish rhythm: space, typography, icons, color, shape, and size.
200+
201+
Like in music, different types of rhythm serve a different purpose, in design there’s three worth highlighting:
202+
203+
<br/>
204+
205+
![Example of data table](/images/foundations/design/space/[email protected])
206+
207+
**Regular rhythm** is predictable, which makes it a useful way to organize large sets of objects that have the same level of importance.
208+
209+
<br/>
210+
211+
![Location profile page](/images/foundations/design/space/[email protected])
212+
213+
**Flowing rhythm** is organic, and it can bring a high level of scannability to something that would be otherwise a random collection of objects.
214+
215+
<br/>
216+
217+
![Home page with progressive disclosure card](/images/foundations/design/space/[email protected])
218+
219+
**Progressive rhythm** is a gradual progression, and is very effective in giving the eye a path to follow, along the progression. This is great to establish hierarchy and aid the user through a series of steps.
220+
221+
Rhythm plays another job in designs, it’s the norm that enables the introduction of variation and points of attention, otherwise known as contrast.
222+
223+
---
224+
225+
<br/>
226+
227+
### Density
228+
229+
The overall perception people get from the space between information as a whole is density. It can range from tight to loose, and there is a very different purpose for each end of the spectrum.
230+
231+
![Examples showign tigher versus looser spacing](/images/foundations/design/space/[email protected])
232+
233+
Tighter spacing (left) makes it easier to scan and comprehend large sets of data, like lists and tables. It also naturally enables one to fit more elements in a given page.
234+
Looser space (right) can help attract the user attention and make a layout feel more user-friendly.
235+
236+
---
237+
238+
<br/>
239+
240+
### Contrast
241+
242+
Contrast is meant to create sticking points that help make content easy to scan, highlight important pieces of information, or just to give viewers a moment to breathe.
243+
244+
![Marketing page and empty state](/images/foundations/design/space/[email protected])
245+
246+
**Highlights (left)**: Callout cards are used to encourage merchants to take an action related to a new feature or opportunity.
247+
248+
**Breather moment (right)**: Empty states provide explanation or guidance to help merchants progress.
249+
250+
Contrast can play a role at very different levels, but it must be used sparingly, otherwise its effect gets diluted.
251+
252+
![Examples on the analytics page to show contrast](/images/foundations/design/space/[email protected])
253+
254+
Home feed overview (left) and location profile analytics (right).
255+
256+
---
257+
258+
<br/>
259+
260+
### Optical adjustment
261+
262+
Sometimes software will say two objects are aligned, or that they have the same size, but visually they don’t feel like that. This happens because computers aren’t great at perceiving visual weight or simultaneous color contrast, so we can’t fully rely on them to create balanced compositions.
263+
264+
That means designers must make optical corrections, using Polaris units until the space feels balanced. Some things to keep an eye out for:
265+
266+
<br/>
267+
268+
#### Visual weight ≠ Size
269+
270+
Two things can have the same size, but feel unbalanced.
271+
272+
![Before and after comparison of optical adjustment applied to a button](/images/foundations/design/space/[email protected])
273+
274+
Without optical adjustment, the disclosure icon appears too far from the right edge of the button. After optical correction, the perceived spacing is more balanced.
275+
276+
![Before and after comparison of optical adjustment applied to an icon](/images/foundations/design/space/[email protected])
277+
278+
The square icon seems larger compared to the circle icon without optical adjustment, however, they in fact have the same size and diameter. The shapes look visually closer to each other after decreasing the size of the square.
279+
280+
<br/>
281+
282+
#### Colors affect each other
283+
284+
Two things can have the same colour, but feel unbalanced.
285+
286+
![Before and after comparison of applying the same colour versus slightly different colours to a banner component](/images/foundations/design/space/[email protected])

0 commit comments

Comments
 (0)