What's new Report an issue
GIG Cymru NHS Wales, Digital Health and Care Wales

Spacing

How we size padding, margins, gaps and layout rhythm so screens feel consistent and dense clinical data stays readable.


When to use

When not to use

How it works

Options

TokenpxTypical use
space-14Icon padding, micro gaps
space-28Tight component internals, table cells
space-312Compact form elements
space-416Default internal padding
space-624Section spacing within panels
space-832Component separation
space-1248Section breaks
space-1664Major layout sections

Do and don't

DoDon't
Use --space-* for all spacingHardcode pixel values
Keep to the 4px gridIntroduce off-grid one-offs
Use smaller steps for dense tablesPad clinical tables so loosely they need scrolling
Let spacing scale with the layoutFix gaps that break at small viewports

Accessibility

Frameworks

FrameworkStatusWhere
Web (HTML/CSS)Reference baseline--space-* custom properties from @dhcw/sr-tokens
ReactCurrentsame token CSS
Blazor /.NETCurrentsame token CSS via the RCL
.NET MAUICurrentXAML Space* keys from the token build
Legacy (.NET 4.8 / Delphi)Tokens only / best-effortCSS custom properties

Clinical / DHCW notes

We carry that grouping-by-proximity intent forward (CARRIED disposition): choose adjacent --space-* steps for label-to-value and a larger step for the gap to the next group, rather than fixed legacy pixel values.


The spacing scale

Bar widths are set with the built spacing custom properties.

--space-0 · 0px
--space-1 · 4px
--space-2 · 8px
--space-3 · 12px
--space-4 · 16px
--space-5 · 20px
--space-6 · 24px
--space-8 · 32px
--space-10 · 40px
--space-12 · 48px
--space-16 · 64px
--space-20 · 80px
--space-24 · 96px

Radius

--radius-00px
--radius-22px
--radius-44px
--radius-88px
--radius-99999999px

Elevation

Shadow separates surfaces that sit above the page. Single Record uses two steps and no more, both tinted from Navy 900 rather than black so they stay subdued on clinical displays. Buttons carry no shadow: they show affordance through fill, border and colour.

--elevation-raised 0 1px 4px rgba(27, 41, 74, 0.12) Cards and panels. Use only where a border alone will not separate a surface from its background.
--elevation-overlay 0 4px 16px rgba(27, 41, 74, 0.18) Anything that floats above the page: modals, drawers, dropdown menus, tooltips.

Do not stack elevations, and do not use shadow to signal that something is interactive. Focus is handled by the focus ring, not by elevation.