Skip to content

Spacing

Two letters drive spacing — p for padding, m for margin — followed by an optional side and a value. Numeric values are interpreted as px. Arbitrary values pass through.

Pattern

chai-{p|m}{side?}-{value}
SideProperty
noneAll four sides
xleft + right
ytop + bottom
ttop
rright
bbottom
lleft

Padding

ClassCSS
chai-p-0padding: 0px
chai-p-2padding: 2px
chai-p-4padding: 4px
chai-px-8padding-left: 8px; padding-right: 8px
chai-py-12padding-top: 12px; padding-bottom: 12px
chai-pt-1padding-top: 1px
chai-pr-3padding-right: 3px
chai-pb-6padding-bottom: 6px
chai-pl-2padding-left: 2px
chai-p-[1.5rem]padding: 1.5rem

Margin

Same shape as padding — replace the leading p with m.

ClassCSS
chai-m-0margin: 0px
chai-m-4margin: 4px
chai-mx-automargin-left: auto; margin-right: auto
chai-mt-8margin-top: 8px
chai-mb-[2rem]margin-bottom: 2rem

Gap

Spacing for flex and grid containers is covered in Flex & Grid.

Notes

  • Numeric values are px, not Tailwind’s 0.25rem-per-step scale. chai-p-4 is 4px, not 1rem. This is intentional — it makes the value readable from the class name without consulting a chart.
  • For rem-based spacing, use arbitrary values: chai-p-[1rem].
  • Negative values aren’t supported in v1. If you need them, write chai-mt-[-12px] with brackets.

Made by Saad · @developedbysaad on X