Gestalt Principles — UI/UX

The Gestalt principles explain how the eye groups what it sees before it reads. There are five main principles. Proximity: what is close reads as one group…

You open an online shop you've never seen before. Within a second you know which part is the menu, which is the product list, and which product each "Buy" button belongs to. You haven't read a single word yet. How?

Your brain groups what it sees, following rules called the Gestalt principles. Picture the buffet table at a wedding. Dishes set close together you take as one set (proximity). Plates of the same shape you take as one kind (similarity). Cakes on one tray you take as one group (common region). The line of guests follows one path (continuity). And the white tablecloth makes the food stand out from the table underneath (figure/ground). Nobody explains any of this to you. Your eyes reach these conclusions by themselves. A web page is read the same way.

Where these principles come from

"Gestalt" is German for a whole form. The psychologist Max Wertheimer wrote these grouping rules down in 1923: proximity, similarity, continuity and closure. Edgar Rubin wrote about figure/ground in 1915. These five are what people usually call the five main Gestalt principles.

One more is very useful in UI: common region, from Stephen Palmer in 1992. Elements inside one box read as one group.

Mrs. Sri's booking card, taken apart by principle

This is the code for the Terrace Room card: the HTML first, then its CSS inside <style>. Each CSS rule uses one principle. The principle's name is written in a comment (a note between /* and */ that doesn't show on the page) above the rule:

<main class="mist">
  <div class="photo" role="img" aria-label="Photo of the Terrace Room"></div>
  <h1>Mist Homestay</h1>
  <p class="room">Terrace Room · 2 guests</p>
  <p class="price">$35 / night</p>
  <div class="stay">
    <p class="checkin">Check-in 12 Dec</p>
    <div class="nights">
      <button aria-pressed="false">1 night</button>
      <button aria-pressed="true">2 nights</button>
      <button aria-pressed="false">3 nights</button>
    </div>
    <p class="total">2 nights × $35 = <b>$70</b></p>
  </div>
  <button class="book">Book the room, pay on arrival</button>
  <p class="note">Free cancellation up to 3 days before check-in.</p>
</main>

<style>
  /* figure/ground: a white card on a grey ground */
  body { background: #f1f5f9; }
  .mist { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; }
  /* proximity: tight inside a group, loose between groups */
  .room, .price { margin: 2px 0 0; }
  .stay, .book { margin-top: 16px; }
  /* common region: one box for the stay details */
  .stay { padding: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; }
  /* continuity: three choices on one straight row */
  .nights { display: flex; gap: 8px; }
  /* similarity: three choices with the same shape */
  .nights button { padding: 0.5rem 0.875rem; color: #1f2937; background: #fff; border: 1px solid #475569; border-radius: 0.375rem; }
  .nights button[aria-pressed="true"] { color: white; background: #15803d; border-color: #15803d; }
</style>

Proximity: what is close reads as one group

The rule: the gap inside a group is smaller than the gap between groups. You used it in the negative space lesson already: room name to price 4px, price to buttons 16px.

A common mistake: three room cards (Terrace Room, Attic Room, Garden Room) are 8px apart, and inside each card the price is also 8px from the button. The eye can't find where a card ends, so it isn't clear whether the "Choose" button belongs to the price above it or to the card below. The fix: 24px between cards, 8px inside them.

Similarity: what looks alike reads as one kind

Elements with the same colour, shape or size read as one kind. The three night choices must look alike, so they read as "pick one of these".

Now picture another version: "1 night" and "3 nights" are outlined boxes, but "2 nights" is only green underlined text. Do guests still read the three as one set of choices? No. Underlined text is the shape of a link. So guests read them as two different things: two choice buttons, plus a link to some unknown place. The principle works the other way too: people will tap a check-in date made to look like a button, as in the affordance lesson.

Common region: what shares a box reads as one group

A border, a different background or a card makes everything inside it read as one group. Palmer showed that a shared box is strong enough to beat distance: two dots far apart but inside one box read as a pair. On Mrs. Sri's card, the .stay box ties together check-in, the night choices and the total.

Use it sparingly. A box inside a box inside a box fills the page with lines, and the lines stop meaning anything. Try grouping with spacing first, then with a box.

Continuity: the eye follows a line

The eye follows a smooth straight or curved line. Card content aligned to one left edge reads top to bottom without stumbling. Three night choices on one row read as the sequence 1, 2, 3. If the left edges of the text jump around, or one button drops 14px below its row, the eye stops and looks for a new direction.

Figure/ground: the thing in front and its ground

The brain always separates the figure (the thing you're looking at) from the ground behind it. A white outlined card on a #f1f5f9 page is a figure. Give the card the same colour as the page and remove its border, and its content mixes with the other text on the page. A modal (a window that appears over the page) with a dark backdrop uses the same principle: the bright thing comes forward, the rest moves back.

🎯 Closure: the eye completes what is cut off

The brain completes shapes that aren't whole. A dashed circle still reads as a circle. In UI, closure tells people there is more. For example, a strip of room photos (a row of photos you swipe sideways) shows three whole photos and a fourth one cut off at the edge. That cut-off photo tells guests the strip can be swiped. If the third photo stops exactly at the edge, guests assume there are only three photos.

How to check: switch them off one at a time

These principles support each other. A quick way to see what each one does is to switch them off one at a time, as in the Lab:

Switched off What happens on the card
Proximity (every gap 12px) The price floats: does it belong to the room name or to the stay box?
Similarity (three choices in different styles) The night choices no longer read as one set
Common region (no .stay box) Check-in, nights and total come apart from each other
Continuity (ragged edges and row) The eye stumbles, the 1, 2, 3 order is no longer clear
Figure/ground (card the colour of the page) The card melts into the page, its content mixes with the text around it

⚠️ Groups nobody can see

TL;DR: The Gestalt principles explain how the eye groups what it sees before it reads. There are five main principles. Proximity: what is close reads as one group, so the gap inside a group is smaller than the gap between groups. Similarity: what looks alike reads as one kind. Closure: the eye completes a cut-off shape. Continuity: the eye follows a line. Figure/ground: an object is separated from its ground (the background behind it). Common region (Palmer, 1992) adds: what shares a box reads as one group. Check your design by switching the principles off one at a time, for example by making every gap the same. If the groups still read, another principle is supporting them.

⚡ The eye groups before it reads

Meaning: The Gestalt principles are the rules the eye uses to group what it sees, before it reads. The five main ones: proximity (closeness), similarity (looking alike), closure (completing a shape), continuity (following a line) and figure/ground (an object and the background behind it). Common region (Palmer, 1992) adds one more: what shares a box reads as one group.

⚡ Proximity: what is close is one group

Guess first: three room cards are 8px apart, and inside each card the price is also 8px from the "Choose" button. Which principle breaks?

Proximity (closeness). The eye can't find where one card ends, so it isn't clear whether the button belongs to the price above it or to the card below. The fix: 24px between cards, 8px inside them.

Meaning: The gap inside a group must be smaller than the gap between groups.

⚡ Similarity: what looks alike reads as one kind

Write:

/* similarity: three choices with the same shape */
.nights button { padding: 0.5rem 0.875rem; color: #1f2937; background: #fff; border: 1px solid #475569; border-radius: 0.375rem; }
.nights button[aria-pressed="true"] { color: white; background: #15803d; border-color: #15803d; }

Meaning: .nights button is the three night choice buttons, and the chosen one (aria-pressed="true") is filled green. All three share one shape, so they read as "pick one of these". If "2 nights" becomes green underlined text, guests read it as a link.

⚡ Common region: what shares a box is one group

Write:

/* common region: one box for the stay details */
.stay { padding: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; }

Meaning: .stay is the box that holds check-in, the night choices and the total. Its padding, background and border make the three one "stay details" group. Use it sparingly: try grouping with spacing first, then with a box.

What you will learn