Spacing and sizing
The spacing scale, the control height on the controls that take it, row heights and the sizes a phone uses.
Layouts line up across products because two things are fixed: the unit every gap is a multiple of, and the height every single-line control shares.
Spacing
Spacing is one base and its multiples. A class names the multiple, so p-4 is four of
the base and gap-1.5 is one and a half.
- Base
--spacing0.25rem4px- Set by
- Tailwind.
foundationleaves it as it is.
0.50.125rem2px10.25rem4px1.50.375rem6px20.5rem8px2.50.625rem10px30.75rem12px41rem16px51.25rem20px61.5rem24px82rem32px102.5rem40px123rem48px164rem64px205rem80px246rem96pxControl height
Every single-line control is 30px tall on a desktop, so a button, a field, a select and a tab line up in any row without a nudge.
- Button
- Icon button
- Input
- Select
- Input group
- Toggle
- Tab
(min-width: 768px).(min-width: 768px)(min-width: 768px)(min-width: 768px)(min-width: 768px)(min-width: 768px)Rows
Rows are a step taller than controls, and the command palette's rows a step taller again. Under a finger every row grows to a full touch target.
(pointer: fine)(pointer: coarse)On a phone
A phone has its own geometry. Rows and fields are 44px tall, and the text in a field is 16px, the size below which a phone's browser zooms in on a focused field.
(max-width: 767px)(max-width: 767px)(max-width: 767px)var(--type-body)16px(max-width: 767px)Breakpoints
The item defines no breakpoint and no container width of its own. It changes its sizes at
one width, the one Tailwind calls md.
- Phone sizes
(max-width: 767px)- Desktop control sizes
(min-width: 768px)- Tailwind's md
--breakpoint-md48rem768px