Spacing
Components: Stack, HStack, VStack, Flex, Page, PageHeader, PageToolbar, PageContent
+14 more
PageTitle, PageActions, Card, CardHeader, CardTitle, CardContent, CardFooter, Drawer, DrawerHeader, DrawerBody, DrawerFooter, Dialog, DialogBody, DialogFooter
Every numeric spacing and sizing utility counts in pixels. p-16 is 16px; p-4 is 4px.
What you use
Rules
- Read every number in a spacing or sizing class (
p-*,m-*,gap-*,w-*,h-*,size-*,inset-*,top-*) as pixels. - Never copy a Tailwind docs value as-is. Multiply it by 4: Tailwind
p-4isp-16here,mt-8ismt-32,h-8ish-32. - Stay on the scale. If a value is off it, round to the nearest step. Off-scale classes such as
p-10still compile; the rule stops you, not the build. - If children sit in a line, use
Stack,HStackorVStackwithgap. Never use per-child margins orspace-*. - Pass
gapas a scale-number prop, not agap-*class. Off-scale numbers fail type-checking. - If you omit
gaponStack,HStackorVStack, you get 4px. If you omit it onFlex, you get none. - If you want no gap on
Stack, passgap={0}.Flexhas nogap={0}; omit the prop. - If you need
classNameon the flex container, useStack.Flexdoes not acceptclassName. PageHeader,PageToolbarandPageContentown the 24px side gutter. Never wrapPagein a padded container.Cardowns its 16px padding. Never addp-*toCardor its parts.- Put drawer and dialog content straight into
DrawerBodyorDialogBody. Their 24px gutter is fixed. - Never pass
classNametoDrawerHeader,DrawerBodyorDrawerFooter. They accept onlychildrenandref. - Import
Dialogparts from@wallarm-org/design-system/Dialog.Dialogis not exported from the package root. - Never reach for a
--spacing-10token, aspace-*component prop, or apaddingprop onStack,Flex,CardorPage. None exist.
Examples
A column of sections uses VStack, not per-child margins.
Padding on your own element uses the pixel number, not the Tailwind docs number.
A page puts cards straight into PageContent, with no padding of its own.
Reference
Scale
Each step is a --spacing-N token and a utility suffix (p-N, gap-N, w-N), N in pixels. Zero is --spacing-none (p-0).
Layout components
Built into components
Do not repeat these.