Layout

Space

A flex-based spacing utility that adds consistent gaps between inline elements. Includes Space.Compact for grouping elements without gaps — perfect for button groups and input addons.

Horizontal · size=middle

With split separator

Space.Compact — grouped buttons

Wrap + large gap

React
Next.js
Tailwind
TypeScript
Framer Motion

Installation

npx benflux-ui add space

Vertical layout

<Space direction="vertical" size="large">
  <Input placeholder="Username" />
  <Input placeholder="Password" type="password" />
  <Button className="w-full">Sign In</Button>
</Space>

Wrapping

<Space wrap size={[8, 12]}>
  {tags.map((tag) => <Badge key={tag}>{tag}</Badge>)}
</Space>

Props — Space

PropTypeDefaultDescription
size"small" | "middle" | "large" | number | [x, y]"small"Gap between items. Pass a tuple for separate horizontal/vertical gaps.
direction"horizontal" | "vertical""horizontal"Flex direction
align"start" | "end" | "center" | "baseline"Cross-axis alignment
wrapbooleanfalseAllow items to wrap to the next line
splitReactNodeSeparator element between each item

Props — Space.Compact

PropTypeDefaultDescription
direction"horizontal" | "vertical""horizontal"Group direction
blockbooleanfalseStretch to full width