Skip to main content
Version: 1.0.3

Spacer

The Spacer component adds consistent spacing between elements, without writing custom CSS or margin classes.

Installation

ignix add component spacer

Usage

Import the component:

import { Spacer } from '@ignix-ui/spacer';

Basic Usage

function BasicSpacer() {
return (
<>
<div className="bg-blue-500 w-16 h-8" />
<Spacer size="lg" direction="vertical" />
<div className="bg-red-500 w-16 h-8" />
</>
);
}

Props

PropTypeDefaultDescription
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | number | string'md'Size of the spacer. Accepts a design token, a raw number (treated as px), or any valid CSS length string (e.g. "2rem", "20px")
direction'vertical' | 'horizontal' | 'both''vertical'Axis along which space is applied. vertical collapses width to 0, horizontal collapses height to 0
responsive{ mobile?: Size; tablet?: Size; desktop?: Size }undefinedApplies different token sizes at each breakpoint. Only design tokens (xsxl) are supported; custom sizes are ignored
classNamestringundefinedAdditional Tailwind classes applied to the spacer container
All HTMLDivElement propsReact.HTMLAttributes<HTMLDivElement>Supports all standard div attributes (e.g. style, id)