Utilities

Spacing

Control margin, padding and gap with a consistent spacing scale so layouts stay rhythmic across the whole product.

The spacing scale

Spacing utilities share a single numeric scale. The suffix is a step on the scale — not a pixel value — which keeps spacing proportional and predictable. The scale is non-linear: it tightens at the low end for fine control and widens at the top for section-level breathing room.

Step rem px (at 16px root)
000px
10.25rem4px
20.5rem8px
30.75rem12px
41rem16px
51.25rem20px
61.5rem24px
82rem32px
102.5rem40px
123rem48px
164rem64px

Notation

Every spacing class follows the pattern .bima-{property}{side}-{step}. The property is m for margin or p for padding. The optional side narrows the effect to specific edges.

Side Edges affected
(none)All four edges.
tTop.
bBottom.
sStart — left in LTR, right in RTL.
eEnd — right in LTR, left in RTL.
xHorizontal (start and end).
yVertical (top and bottom).

The s (start) and e (end) sides are logical properties: they automatically flip for right-to-left languages, so use them in preference to physical left/right wherever possible.

Padding

Padding adds space inside an element, between its border and its content. Use .bima-p-* for all sides, or scope it with .bima-pt-*, .bima-pb-*, .bima-ps-*, .bima-pe-*, .bima-px-* and .bima-py-*. The coloured boxes below have a tinted background so the padding shows up as inner whitespace.

p-2
p-4
p-6
px-8 py-2
<div class="bima-p-2">…</div>
<div class="bima-p-4">…</div>
<div class="bima-p-6">…</div>
<div class="bima-px-8 bima-py-2">…</div>

Margin

Margin adds space outside an element, pushing neighbours away. Use .bima-m-* for all sides, or the side-scoped variants .bima-mt-*, .bima-mb-*, .bima-ms-*, .bima-me-*, .bima-mx-* and .bima-my-*. Below, each blue box carries a start margin, so the gap before it grows with the step.

ms-0
ms-4
ms-8
ms-12
<div class="bima-ms-0">…</div>
<div class="bima-ms-4">…</div>
<div class="bima-ms-8">…</div>
<div class="bima-ms-12">…</div>

Horizontal centring

Use .bima-mx-auto to centre a block-level element of a fixed or constrained width inside its parent by distributing the leftover horizontal space evenly.

.bima-mx-auto
<div class="bima-w-50 bima-mx-auto">Centred block</div>

Gap

The .bima-gap-* utilities set the gap between children of a flex or grid container. Because gap only applies to spacing between items (never the outer edges), it is the cleanest way to space rows and columns. Pair it with .bima-d-flex or .bima-d-grid.

gap-4
gap-4
gap-4
gap-8
gap-8
gap-8
<div class="bima-d-flex bima-gap-4">
  <div>…</div>
  <div>…</div>
</div>

Gap is available in steps 1, 2, 3, 4, 5, 6 and 8.

Class reference

Pattern Property Example
.bima-m-{step}margin (all).bima-m-4
.bima-mt-{step}margin-top.bima-mt-2
.bima-mb-{step}margin-bottom.bima-mb-6
.bima-ms-{step}margin-inline-start.bima-ms-3
.bima-me-{step}margin-inline-end.bima-me-3
.bima-mx-{step}margin-inline.bima-mx-8
.bima-my-{step}margin-block.bima-my-8
.bima-mx-automargin-inline: auto.bima-mx-auto
.bima-p-{step}padding (all).bima-p-4
.bima-pt-{step}padding-top.bima-pt-2
.bima-pb-{step}padding-bottom.bima-pb-6
.bima-ps-{step}padding-inline-start.bima-ps-3
.bima-pe-{step}padding-inline-end.bima-pe-3
.bima-px-{step}padding-inline.bima-px-8
.bima-py-{step}padding-block.bima-py-8
.bima-gap-{step}gap (1–6, 8).bima-gap-4