ShtukbaseStandard
page/design/scales.md

Scales

Spacing, font sizes, radii, shadows and line length come from short sets. What is counted, where the idea comes from, check settings.

Page fields (10)
icon📏
spacingBase4
spacingFine2
spacingFineBelow16
typeScale11, 12, 14, 16, 18, 20, 22, 24, 28, 30, 32, 36, 45, 48, 57, 60, 72, 96, 128
maxFontSizes10
radii0, 2, 4, 6, 8, 10, 12, 16, 20, 24, 32
maxRadii6
maxShadows6
measure45, 75

An interface looks put together when sizes are taken not "by eye" but from short lists. Then neighboring values differ noticeably, and there is no need to decide each time between 13 and 14 px.

NormWhatWho holds it
SCL-R01Spacing is a multiple of 4 px (2 px below 16 px)the spacing check
SCL-R02Font sizes from the scale, no more than 10 different onesthe type check
SCL-R03Radii from the set, shadows from the themethe shape check
SCL-R04A line of text is 45–75 charactersjudge and the measure sensor

Where the ideas come from (in our own words)

  • Refactoring UI (Adam Wathan and Steve Schoger, refactoringui.com). A system is worth setting in advance: spacing, font sizes, shadows as short lists in which neighboring values differ by at least a quarter. Choosing from five options is faster and more even than inventing a number. Five shadows are enough, from barely noticeable to the highest; each means "how far the element is above the page".
  • The Material 3 type scale (m3.material.io). Fifteen text roles (display, headlines, titles, body, labels) in three sizes; each role has its own size, line height and weight. A role is named by purpose, not by number.
  • Every Layout (Heydon Pickering and Andy Bell, every-layout.dev). Text width is set in ch, the width of a character, and kept at about 60 characters; this rule is declared at the level of the whole project, not of each block. Spacing is derived from one step by multiplying it.
  • A line length of 45–75 characters is a rule of book typesetting (Robert Bringhurst, "The Elements of Typographic Style").

Settings

  • spacingBase is the spacing step, px (4). spacingFine and spacingFineBelow are the fine step (2) for values below 16 px.
  • typeScale is the allowed font sizes, px. maxFontSizes is how many different sizes a project may have.
  • radii is the allowed radii, px; a "pill" (999 px and more) and percentages are always allowed. maxRadii is how many different radii.
  • maxShadows is how many shadows a theme may have.
  • measure is the limits of line length in characters.

Which files the checks look at is on the page Which files the design checks look at.

The package Design scales puts this page at /design/scales.md.Source text