Design scales
Spacing on a 4 px scale, font sizes from a short scale, radii and shadows from a set, line length of 45–75 characters. Checks on CSS, Tailwind classes and TSX styles; a judge looks at line length.
About the package
Norms for the sizes of an interface: spacing, font, corner radii, shadows, line length. All values come from the short lists on the page Scales; the same page says where the ideas come from (Refactoring UI, Material 3, Every Layout) and holds the settings.
What it installs
- The page Scales.
- Norms:
- SCL-R01: spacing is a multiple of 4 px, 2 px below 16 px; the
spacingcheck. - SCL-R02: font sizes from the scale, no more than 10 different ones; the
typecheck. - SCL-R03: radii from the set, no more than 6 different ones; shadows from the theme, no more than 6; the
shapecheck. - SCL-R04: a line of text is 45–75 characters; the judge
judges/measure.md, helped by themeasuresensor.
- SCL-R01: spacing is a multiple of 4 px, 2 px below 16 px; the
The checks read CSS, Tailwind classes (arbitrary values such as p-[13px]) and style={{…}} in TSX/JSX. They stand on the library of the design-base package; where they look for files is on its page Which files the design checks look at.
Where the boundary is
- Values that go through
var(),calc()orclamp()are not checked: the scale of the variables themselves checks them. - Color is not here: contrast is held by
design-a11y, colors only from the theme byshadcn. - The package does not set the grid, breakpoints or line height.
Norms 4
| ID | Norm | Level | Mode | Enforcer |
|---|---|---|---|---|
| SCL-R01 | Every spacing value (margin, padding, gap and spacing tokens) written as a length is a multiple of 4 px; below 16 px a step of 2 px is allowed; below 4 px it is fitting by eye, anything goes. |
SHOULD | blocks | check |
| SCL-R02 | Every font size written as a length is taken from the typeScale scale, and a project has no more than maxFontSizes different sizes (10 by default). |
SHOULD | blocks | check |
| SCL-R03 | Every corner radius written as a length is from the radii set (or a "pill", or a percentage), a project has no more than maxRadii (6) different radii; a shadow in a rule is taken from the theme (var(--shadow-…)), and a theme has no more than maxShadows (6) shadows. |
SHOULD | blocks | check |
| SCL-R04 | A body-text paragraph in the widest window holds 45–75 characters per line. |
SHOULD | observes | judge |
"Blocks": the enforcer stops a violation. "Observes": it only notes it. Level MUST means required; SHOULD means yes by default.
Actions 4
| Name | What it does | File | When |
|---|---|---|---|
| spacing | Spacing on a 4 px scale norm SCL-R01 | checks/spacing.ts | check |
| type | Font sizes from a short scale norm SCL-R02 | checks/type.ts | check |
| shape | Radii and shadows from a short set norm SCL-R03 | checks/shape.ts | check |
| measure | Sensor: text widths in ch outside 45–75 characters (for the judge) | checks/measure.ts | shtuk run |
shtuk check runs the checks; shtuk run design-scales <name> runs any action. "After install" actions run by themselves only if the package comes from a trusted source.
Pages 5
They go into the project at these paths.
- /design/
- Scales page
- /norms/rules/design-scales/
- Spacing on a 4 px scale SCL-R01
- Font sizes from a short scale SCL-R02
- Radii and shadows from a short set SCL-R03
- Text line length is 45–75 characters SCL-R04
Package files 7
They go into .shtukbase/packages/design-scales/; actions run from there.