Skip to content

@jsvision/ui / spacer

Function: spacer()

spacer(arg?): View

Defined in: ui/src/view/dsl.ts:180

Insert an empty spacer between children. With a numeric weight (default 1) it is flexible — it absorbs leftover space, pushing later children toward the far edge; with { fixed: n } it is a hard, exact n-cell gap.

Parameters

arg?

number | { fixed: number; }

A flex weight (default 1), or { fixed: n } for an exact n-cell gap.

Returns

View

A fresh invisible view with the requested size, ready to drop into a col/row.

Example

ts
import { row, spacer } from '@jsvision/ui';

// Push `help` to the right edge; keep a hard 2-cell gap before `cancel`.
const bar = row(ok, spacer({ fixed: 2 }), cancel, spacer(), help);