13 / 18

Principle 13

Shadows share one light

A shadow tells how high something sits. When every shadow on the screen falls in the same direction and grows with height, the interface feels like one physical space instead of stickers pasted on a page.

In a real interface

✕ Avoid

✓ Do

01

Why

Josh W. Comeau puts it simply: every shadow on the page should share the same ratio, so that every element looks lit from the same light source. Mixed directions read as noise.

Refactoring UI has chapters on using shadows to convey elevation and on emulating a light source, because depth is information about what is in front.

02

How to apply it

Define a few elevation levels and their shadows as tokens. As an element rises, Comeau says three things change together: the offset grows, the blur grows and the opacity drops.

Layer at least two shadows per level, a close one and a soft one. Vercel's guidelines ask for the same, to mimic ambient and direct light.

03

Edge cases

Dark themes hide shadows, so elevation there leans on lighter surfaces. On colored backgrounds tint the shadow toward the same hue instead of using pure black, which looks dirty.

✓ Do

  • Keep one light direction everywhere
  • Grow offset and blur with elevation
  • Layer a close and a soft shadow
  • Tint shadows on colored grounds

✕ Avoid

  • Give each component its own shadow
  • Use the same shadow for every height
  • Cast shadows in two directions
  • Use pure black on colored backgrounds

For agents · PRINCIPLE.md

## Shadows share one light

 

- Every shadow falls in the same direction.

- Define elevation levels as tokens; higher means more offset, more blur, less opacity.

- Layer at least two shadows per level: a close one and a soft one.

- On colored backgrounds, tint the shadow toward the same hue.

Enforced bykero-system records elevation tokens with one lightBADESIGN shadows only on elements that float