Skip to content

Type to search the docs, API, and blog.

↑↓ navigate↵ openesc close
Zazz 0.7 alpha
API navigation

API

Layout

Display, position, overflow, and stacking.

Where an element sits and how it clips. --display also carries the flex shorthands (flex-col, inline-flex-row) that set the direction with the display, so there is no separate direction utility.

--anchor-name and --position-anchor take states and breakpoints, so the anchor can move with interaction: put --anchor-name--hover: --block on every block of an editor, and a toolbar with --position: absolute; --position-anchor: --block follows the hovered one. --position-area places it: --position-area: block-start span-inline-end puts the toolbar above the block, aligned to its start. For finer placement write anchor() in plain CSS. The inset utilities take numbers and lengths only, so --top: anchor(bottom) computes to 0.

Reference

Layout utilities
UtilityWritesValueTiersNotes
--aspectaspect-ratioany CSS valuebreakpointsworks tier-only; --before-aspect / --after-aspect
--displaydisplaykeyword, plus flex shorthands that set the direction: flex-row, flex-row-reverse, flex-col, flex-col-reverse, inline-flex-row, inline-flex-row-reverse, inline-flex-col, inline-flex-col-reversebreakpoints--before-display / --after-display
--object-fitobject-fitkeyword—
--object-positionobject-positionany CSS value—
--overflowoverflowkeyword—
--overflow-xoverflow-xkeyword—
--overflow-yoverflow-ykeyword—
--positionpositionkeywordbreakpointsworks tier-only; --before-position / --after-position
--anchor-nameanchor-namedashed ident (--toolbar), a list of them, or nonebreakpoints, statesworks tier-only
--position-anchorposition-anchordashed ident naming an anchor, auto, none, or normalbreakpoints, statesworks tier-only
--position-areaposition-areaone or two area keywords (block-start span-inline-end), or nonebreakpoints, statesworks tier-only
--insetinsetscale number or lengthbreakpoints--before-inset / --after-inset
--inset-xinset-inlinescale number or lengthbreakpoints--before-inset-x / --after-inset-x
--inset-yinset-blockscale number or lengthbreakpoints--before-inset-y / --after-inset-y
--topinset-block-startscale number or lengthbreakpoints--before-top / --after-top
--rightinset-inline-endscale number or lengthbreakpoints--before-right / --after-right
--bottominset-block-endscale number or lengthbreakpoints--before-bottom / --after-bottom
--leftinset-inline-startscale number or lengthbreakpoints--before-left / --after-left
--visibilityvisibilitykeyword—--before-visibility / --after-visibility
--zz-indexany CSS value—--before-z / --after-z

Examples

--top: 4; --left: 4 --top: 4; --right: 4 --bottom: 4; --left: 4 --bottom: 4; --right: 4
--position: absolute; --inset: 6
<div
  style="
    --position: relative;
    --p: 6;
    --w: 100%;
    --h: 40;
    --max-w: 96;
    --bg: var(--color-muted);
    --rounded: var(--radius-lg);
  "
>
  <span
    data-ui="badge"
    data-badge-variant="primary"
    style="
      --position: absolute;
      --top: 4;
      --left: 4;
    "
    >--top: 4; --left: 4</span
  >
  <span
    data-ui="badge"
    data-badge-variant="muted"
    style="
      --position: absolute;
      --top: 4;
      --right: 4;
    "
    >--top: 4; --right: 4</span
  >
  <span
    data-ui="badge"
    data-badge-variant="muted"
    style="
      --position: absolute;
      --bottom: 4;
      --left: 4;
    "
    >--bottom: 4; --left: 4</span
  >
  <span
    data-ui="badge"
    data-badge-variant="primary"
    style="
      --position: absolute;
      --bottom: 4;
      --right: 4;
    "
    >--bottom: 4; --right: 4</span
  >
  <div
    data-ui="text-xs"
    style="
      --display: flex;
      --position: absolute;
      --items: center;
      --justify: center;
      --inset: 6;
      --font-weight: strong;
      --text: var(--color-muted-foreground);
      --border-color: var(--color-border);
      --border-width: 1px;
      --border-style: dashed;
      --rounded: var(--radius-md);
    "
  >
    --position: absolute; --inset: 6
  </div>
</div>

Scrollable region one

Scrollable region two

Scrollable region three

Scrollable region four

Scrollable region five

Scrollable region six

--overflow-y: auto

Scrollable region one

Scrollable region two

Scrollable region three

Scrollable region four

Scrollable region five

Scrollable region six

--overflow: hidden
<div
  style="
    --display: grid;
    --grid-cols: 2;
    --gap: 6;
    --w: 100%;
    --max-w: 96;
  "
>
  <div
    style="
      --display: flex-col;
      --gap: 2;
    "
  >
    <div
      style="
        --display: flex-col;
        --p: 4;
        --gap: 2;
        --h: 24;
        --bg: var(--color-muted);
        --rounded: var(--radius-md);
        --overflow-x: clip;
        --overflow-y: auto;
      "
    >
      <p data-ui="text-sm">Scrollable region one</p>
      <p data-ui="text-sm">Scrollable region two</p>
      <p data-ui="text-sm">Scrollable region three</p>
      <p data-ui="text-sm">Scrollable region four</p>
      <p data-ui="text-sm">Scrollable region five</p>
      <p data-ui="text-sm">Scrollable region six</p>
    </div>
    <span
      data-ui="text-xs"
      style="
        --font-weight: strong;
        --text-align: center;
        --text: var(--color-muted-foreground);
      "
      >--overflow-y: auto</span
    >
  </div>
  <div
    style="
      --display: flex-col;
      --gap: 2;
    "
  >
    <div
      style="
        --display: flex-col;
        --p: 4;
        --gap: 2;
        --h: 24;
        --bg: var(--color-muted);
        --rounded: var(--radius-md);
        --overflow: hidden;
      "
    >
      <p data-ui="text-sm">Scrollable region one</p>
      <p data-ui="text-sm">Scrollable region two</p>
      <p data-ui="text-sm">Scrollable region three</p>
      <p data-ui="text-sm">Scrollable region four</p>
      <p data-ui="text-sm">Scrollable region five</p>
      <p data-ui="text-sm">Scrollable region six</p>
    </div>
    <span
      data-ui="text-xs"
      style="
        --font-weight: strong;
        --text-align: center;
        --text: var(--color-muted-foreground);
      "
      >--overflow: hidden</span
    >
  </div>
</div>
--aspect: 1 · 1:1
--aspect: 16 / 9 · 16:9
--aspect: 2 / 3 · 2:3
<div
  style="
    --display: grid;
    --items: start;
    --grid-cols: 3;
    --gap: 6;
    --w: 100%;
    --max-w: 96;
  "
>
  <div
    data-ui="text-xs"
    style="
      --display: flex;
      --items: center;
      --justify: center;
      --p: 2;
      --aspect: 1;
      --font-weight: strong;
      --text-align: center;
      --text: var(--color-primary-foreground);
      --bg: var(--color-primary);
      --rounded: var(--radius-md);
    "
  >
    --aspect: 1 · 1:1
  </div>
  <div
    data-ui="text-xs"
    style="
      --display: flex;
      --items: center;
      --justify: center;
      --p: 2;
      --aspect: 16 / 9;
      --font-weight: strong;
      --text-align: center;
      --text: var(--color-secondary-foreground);
      --bg: var(--color-secondary);
      --rounded: var(--radius-md);
    "
  >
    --aspect: 16 / 9 · 16:9
  </div>
  <div
    data-ui="text-xs"
    style="
      --display: flex;
      --items: center;
      --justify: center;
      --p: 2;
      --aspect: 2 / 3;
      --font-weight: strong;
      --text-align: center;
      --text: var(--color-tertiary-foreground);
      --bg: var(--color-tertiary);
      --rounded: var(--radius-md);
    "
  >
    --aspect: 2 / 3 · 2:3
  </div>
</div>
Savanna grass at dawn
--object-fit: cover
Savanna grass at dawn
--object-fit: contain
Savanna grass at dawn
--object-fit: fill
<div
  style="
    --display: grid;
    --grid-cols: 3;
    --gap: 6;
    --w: 100%;
    --max-w: 96;
  "
>
  <figure
    style="
      --display: flex-col;
      --gap: 2;
    "
  >
    <img
      src="https://images.unsplash.com/photo-1500382017468-9049fed747ef?auto=format&fit=crop&w=320&h=200&q=60"
      width="320"
      height="200"
      loading="lazy"
      alt="Savanna grass at dawn"
      style="
        --w: 100%;
        --aspect: 1;
        --bg: var(--color-muted);
        --rounded: var(--radius-md);
        --object-fit: cover;
      "
    />
    <figcaption
      data-ui="text-xs"
      style="
        --font-weight: strong;
        --text-align: center;
        --text: var(--color-muted-foreground);
      "
    >
      --object-fit: cover
    </figcaption>
  </figure>
  <figure
    style="
      --display: flex-col;
      --gap: 2;
    "
  >
    <img
      src="https://images.unsplash.com/photo-1500382017468-9049fed747ef?auto=format&fit=crop&w=320&h=200&q=60"
      width="320"
      height="200"
      loading="lazy"
      alt="Savanna grass at dawn"
      style="
        --w: 100%;
        --aspect: 1;
        --bg: var(--color-muted);
        --rounded: var(--radius-md);
        --object-fit: contain;
      "
    />
    <figcaption
      data-ui="text-xs"
      style="
        --font-weight: strong;
        --text-align: center;
        --text: var(--color-muted-foreground);
      "
    >
      --object-fit: contain
    </figcaption>
  </figure>
  <figure
    style="
      --display: flex-col;
      --gap: 2;
    "
  >
    <img
      src="https://images.unsplash.com/photo-1500382017468-9049fed747ef?auto=format&fit=crop&w=320&h=200&q=60"
      width="320"
      height="200"
      loading="lazy"
      alt="Savanna grass at dawn"
      style="
        --w: 100%;
        --aspect: 1;
        --bg: var(--color-muted);
        --rounded: var(--radius-md);
        --object-fit: fill;
      "
    />
    <figcaption
      data-ui="text-xs"
      style="
        --font-weight: strong;
        --text-align: center;
        --text: var(--color-muted-foreground);
      "
    >
      --object-fit: fill
    </figcaption>
  </figure>
</div>