Spatial Breathing: Fluid Spacing & Vertical Rhythm
Spacing is the "silent architecture" of a user interface. In the Espalier system, we reject the use of static pixel gaps in favor of Fluid Spacing. By utilizing clamp(), we allow the white space in our layouts to "breathe" proportionally, expanding and contracting in lockstep with our typography.
This ensures that a dashboard remains dense and functional on mobile while feeling "airy" and editorial on large desktop displays, all without manual breakpoint overrides.
The Philosophy of Proportional Gaps
From a Startup Strategist’s perspective, a fluid spacing system is a tool for Visual Resilience. Traditionally, developers hand-coded different padding values for mobile, tablet, and desktop. This creates "snapping" layouts that feel broken on intermediate device widths.
Espalier's spacing engine is built on two core concepts:
- Linear Interpolation: Spacing units (e.g.,
--esp-size-normal) grow linearly between a defined minimum and maximum viewport width. - Space Pairs (Attitude): Spacing "pairs" (e.g.,
--esp-size-tiny-to-small) allow for non-linear growth. This allows us to define a gap that is very tight on mobile but expands significantly more than a standard step on desktop to add "attitude" or emphasis to a section.
The Spacing Matrix
Our spacing ramps are mathematically tied to our modular type scale, ensuring that the distance between a heading and a paragraph is always proportional to the size of the text itself.
| Token | Preferred Formula | Intended Logic |
|---|---|---|
--esp-size-small |
0.66rem + 0.41vw |
Internal component padding (e.g., buttons). |
--esp-size-normal |
1rem + 0.62vw |
Standard gutter and margin between blocks. |
--esp-size-tiny-to-small |
0.16rem + 1.04vw |
Dynamic Pair: Tight on mobile, airy on desktop. |
Vertical Rhythm and Proximity
Typography and spacing must work together to establish Vertical Rhythm. We use the following defensive guidelines to maintain content clarity:
- Grouping: Use smaller fluid tokens (Tiny, Small) to group related elements, such as a label and its input field.
- Separation: Use larger fluid tokens (Medium, Big) to separate distinct sections of a page.
- Heading Proximity: Headings should always be visually closer to the text they introduce than the text that precedes them. We achieve this by applying asymmetrical fluid margins.
Challenge the Assumption: "Consistency Means Same Numbers"
A common mistake in design systems is assuming that a "consistent" experience means using the same 16px padding everywhere. We challenge this. True consistency is Perceptual. A 16px gap looks balanced on a phone but cramped on a 32-inch monitor.
For a defensible architecture, stop aiming for Same Numbers and start aiming for Proportional Relationships.
Strategic Implementation in Lit
In our Lit Element components, we map these fluid primitives to semantic layout roles.
/* Component Implementation */
:host {
/* Page padding that breathes with the screen */
padding: var(--esp-size-padding-page);
display: flex;
flex-direction: column;
/* Proportional gap between child elements */
gap: var(--esp-size-normal);
}
.card {
/* Using a 'From-To' pair for dramatic scaling */
padding: var(--esp-size-tiny-to-small);
border-radius: var(--esp-size-border-radius);
}