RamosLabs DS

Foundations / Spacing

Nobody notices spacing. Everybody feels it.

Space is the quietest choice in an interface and the one people feel first. RamosLabs picks it once: a 4px base, an 8px rhythm, and 14 fixed steps. Every gap in the product is one of those steps. No 13px here, no 15px there. Fewer choices, one rhythm, every screen calm.

01

One base, an 8pt rhythm

The scale rests on a 4px base with an 8px primary beat. Four gives fine control for tight gaps; eight is the workhorse, because it divides cleanly across screen densities and renders crisp from a 1x phone to a 3x display, never landing on a half pixel. Spacing, component sizes, and line boxes all snap to the same beat.

each wash column = 8pxblocks: 8 / 16 / 24 / 32
02

The scale you can see

Fourteen steps, from a hairline gap to a hero break. Every value is a multiple of 4px. Past --space-6 the steps widen (skipping 7, 9, 11) because at larger sizes the eye needs a bigger jump to read a real difference. Tokens ship in rem, so spacing scales with the user's root font size.

--space-14px
--space-28px
--space-312px
--space-416px
--space-520px
--space-624px
--space-832px
--space-1040px
--space-1248px
--space-1664px
--space-2080px
--space-2496px
--space-32128px
TokenrempxTypical use
--space-000Reset, collapse a gap
--space-10.25rem4pxHairline gaps, icon-to-label
--space-20.5rem8pxTight inline spacing, chip padding
--space-30.75rem12pxCompact input padding
--space-41rem16pxDefault padding, card interior
--space-51.25rem20pxRoomy control padding
--space-61.5rem24pxGap between related components
--space-82rem32pxBlock separation, generous padding
--space-102.5rem40pxGroup separation
--space-123rem48pxSection padding on mobile
--space-164rem64pxBetween-section rhythm
--space-205rem80pxLarge section breaks
--space-246rem96pxDesktop section padding
--space-328rem128pxHero spacing, the grand entrance
03

Touch targets are non-negotiable

Spacing is also an accessibility contract. On touch, an element is only usable if the finger can hit it reliably. Three floors anchor the system, each shown here at 2x scale for legibility.

24
24 × 24px
WCAG 2.2 floor (AA)
44
44 × 44pt
Apple HIG target
48
48 × 48dp
Material target

WCAG 2.2 sets 24 by 24px as the AA minimum. Apple asks 44 by 44pt, Material 48 by 48dp. On phones, add safe-area insets to edge-anchored bars so a sticky CTA never sits under the home indicator: padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom)).

Recommended

Size primary actions to the 44 to 48px range, and keep 24px as the hard floor for dense, secondary controls.

Avoid

Letting a tap target shrink to its visual glyph. A 20px icon with no added padding misses the floor; expand the hit area with padding or a pseudo-element so it reaches 44 to 48px while the glyph stays small.

04

Density lowers whitespace, never the floor

Density is how tightly the same components pack. A comfortable default suits touch and reading; a compact mode fits more on screen for pointer-driven, data-dense views. You get there by stepping the interior spacing down the scale, never by inventing off-scale values.

ModeInterior stepWhen to apply
Comfortable (default)--space-4 / --space-6Touch-first screens, marketing, reading, onboarding.
Compact--space-2 / --space-3Data tables, dashboards, admin tools, power-user views.
i
Rule: keep the 24px hit-area floor in every density mode, compact included. Why: density trims padding, not accessibility.

Sources

Touch-target floors: WCAG 2.2 SC 2.5.8 Target Size Minimum, 24px AA (w3.org); Apple HIG 44pt (developer.apple.com); Material 48dp (m3.material.io). The 8pt grid and density model after Material layout and density (m3.material.io) and Refactoring UI numbered scales. Safe-area insets via CSS env() (developer.mozilla.org).