vert-ui
Browse docs
All components

Spacer

Pushes siblings apart inside a flex or grid layout — either a flexible filler or a fixed gap. Always hidden from assistive tech.

Install

Install the component

Add the source straight into your project with the shadcn CLI — no package dependency to track.

npx shadcn@latest add https://vert-ui.dev/r/spacer.json

Preview

Live preview

Usage

Examples

Flexible gap between groups

ProductsAbout
<Stack direction="row">
  <span>Products</span>
  <Spacer />
  <span>About</span>
</Stack>

Fixed gap

<Stack direction="row" gap={2}>
  <Button>Save</Button>
  <Spacer size={4} axis="horizontal" />
  <Button variant="outline">Cancel</Button>
</Stack>

Reference

Props

PropTypeDefaultDescription
growbooleantrueGrows to fill the free space (flex-1). Ignored when size is set.
size0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16—Fixed gap on the token scale. Takes precedence over grow.
axis"horizontal" | "vertical" | "both""both"Which dimension the fixed size controls.
asChildbooleanfalseRender the child element instead of a div.

Accessibility

Accessibility notes

  • Rendered with aria-hidden="true": it is a pure layout device and never announced by screen readers.
  • The element carries no content and no focus, so it cannot be tabbed to.
  • Prefer the gap prop on Stack/Cluster when the spacing is uniform — a Spacer is for asymmetric spacing.