Skip to content

Type to search the docs, API, and blog.

↑↓ navigate↵ openesc close
Zazz 0.7 alpha
API navigation

API

Spacing

Padding and margin on the spacing scale.

A bare number is a step on the spacing scale (--p: 4 is 4 × --spacing). The named --space-* tokens map to 1, 2, 4, 6, 11, 24, and 40; use the number in style. Any length works too. Sides are t, r, b, l and set logical properties, so l is the right side in a right-to-left document. Margins also take auto.

Reference

Spacing utilities
UtilityWritesValueTiersNotes
--ppaddingscale number or lengthbreakpointsworks tier-only; --before-p / --after-p
--pxpadding-inlinescale number or lengthbreakpointsworks tier-only; --before-px / --after-px
--pypadding-blockscale number or lengthbreakpointsworks tier-only; --before-py / --after-py
--ptpadding-block-startscale number or lengthbreakpointsworks tier-only; --before-pt / --after-pt
--prpadding-inline-endscale number or lengthbreakpointsworks tier-only; --before-pr / --after-pr
--pbpadding-block-endscale number or lengthbreakpointsworks tier-only; --before-pb / --after-pb
--plpadding-inline-startscale number or lengthbreakpointsworks tier-only; --before-pl / --after-pl
--mmarginscale number or lengthbreakpointsKeywords: auto
--mxmargin-inlinescale number or lengthbreakpointsKeywords: auto
--mymargin-blockscale number or lengthbreakpointsKeywords: auto
--mtmargin-block-startscale number or lengthbreakpointsKeywords: auto
--mrmargin-inline-endscale number or lengthbreakpointsKeywords: auto
--mbmargin-block-endscale number or lengthbreakpointsKeywords: auto
--mlmargin-inline-startscale number or lengthbreakpointsKeywords: auto

Examples

--p: 2
--p: 4
--p: 6
--p: 11
<div
  style="
    --display: flex;
    --flex-wrap: wrap;
    --items: start;
    --gap: 6;
  "
>
  <div
    style="
      --p: 2;
      --bg: var(--color-muted);
      --rounded: var(--radius-md);
    "
  >
    <div
      data-ui="text-xs"
      style="
        --display: grid;
        --place-items: center;
        --p: 4;
        --aspect: 1;
        --font-weight: strong;
        --text: var(--color-primary-foreground);
        --bg: var(--color-primary);
        --rounded: var(--radius-sm);
      "
    >
      --p: 2
    </div>
  </div>
  <div
    style="
      --p: 4;
      --bg: var(--color-muted);
      --rounded: var(--radius-md);
    "
  >
    <div
      data-ui="text-xs"
      style="
        --display: grid;
        --place-items: center;
        --p: 4;
        --aspect: 1;
        --font-weight: strong;
        --text: var(--color-primary-foreground);
        --bg: var(--color-primary);
        --rounded: var(--radius-sm);
      "
    >
      --p: 4
    </div>
  </div>
  <div
    style="
      --p: 6;
      --bg: var(--color-muted);
      --rounded: var(--radius-md);
    "
  >
    <div
      data-ui="text-xs"
      style="
        --display: grid;
        --place-items: center;
        --p: 4;
        --aspect: 1;
        --font-weight: strong;
        --text: var(--color-primary-foreground);
        --bg: var(--color-primary);
        --rounded: var(--radius-sm);
      "
    >
      --p: 6
    </div>
  </div>
  <div
    style="
      --p: 11;
      --bg: var(--color-muted);
      --rounded: var(--radius-md);
    "
  >
    <div
      data-ui="text-xs"
      style="
        --display: grid;
        --place-items: center;
        --p: 4;
        --aspect: 1;
        --font-weight: strong;
        --text: var(--color-primary-foreground);
        --bg: var(--color-primary);
        --rounded: var(--radius-sm);
      "
    >
      --p: 11
    </div>
  </div>
</div>
--p: 6
--p: 6; --pl: 0
--p: 6; --py: 2
<div
  style="
    --display: flex;
    --flex-wrap: wrap;
    --items: start;
    --gap: 6;
  "
>
  <div
    style="
      --p: 6;
      --bg: var(--color-muted);
      --rounded: var(--radius-md);
    "
  >
    <div
      data-ui="text-xs"
      style="
        --display: grid;
        --place-items: center;
        --p: 4;
        --aspect: 1;
        --font-weight: strong;
        --text: var(--color-primary-foreground);
        --bg: var(--color-primary);
        --rounded: var(--radius-sm);
      "
    >
      --p: 6
    </div>
  </div>
  <div
    style="
      --p: 6;
      --pl: 0;
      --bg: var(--color-muted);
      --rounded: var(--radius-md);
    "
  >
    <div
      data-ui="text-xs"
      style="
        --display: grid;
        --place-items: center;
        --p: 4;
        --aspect: 1;
        --font-weight: strong;
        --text: var(--color-primary-foreground);
        --bg: var(--color-primary);
        --rounded: var(--radius-sm);
      "
    >
      --p: 6; --pl: 0
    </div>
  </div>
  <div
    style="
      --p: 6;
      --py: 2;
      --bg: var(--color-muted);
      --rounded: var(--radius-md);
    "
  >
    <div
      data-ui="text-xs"
      style="
        --display: grid;
        --place-items: center;
        --p: 4;
        --aspect: 1;
        --font-weight: strong;
        --text: var(--color-primary-foreground);
        --bg: var(--color-primary);
        --rounded: var(--radius-sm);
      "
    >
      --p: 6; --py: 2
    </div>
  </div>
</div>
--mx: auto
start --ml: auto
<div
  style="
    --display: flex-col;
    --gap: 6;
    --w: 100%;
    --max-w: 96;
  "
>
  <div
    style="
      --p: 4;
      --bg: var(--color-muted);
      --rounded: var(--radius-lg);
    "
  >
    <div
      data-ui="text-sm"
      style="
        --p: 4;
        --mx: auto;
        --w: fit-content;
        --font-weight: strong;
        --text-align: center;
        --text: var(--color-primary-foreground);
        --bg: var(--color-primary);
        --rounded: var(--radius-md);
      "
    >
      --mx: auto
    </div>
  </div>
  <div
    style="
      --display: flex;
      --p: 4;
      --gap: 4;
      --bg: var(--color-muted);
      --rounded: var(--radius-lg);
    "
  >
    <span data-ui="badge" data-badge-variant="muted">start</span>
    <span data-ui="badge" data-badge-variant="primary" style="--ml: auto">--ml: auto</span>
  </div>
</div>