Spacer
Flexible or fixed space between siblings. Pushes items apart in a Flex, or adds a gap in a Stack.
NorthwindIF
Installation
pnpm dlx nachui add spacerAnatomy
Without
size the spacer is flex-1 and takes whatever room is left, so it pushes the siblings after it to the far edge. With size it becomes a fixed block on the given axis, which reads better than a stray mt-6 in long layouts. It is hidden from assistive tech either way.Examples
Flexible
A toolbar where the actions sit at the end.
NorthwindIF
Fixed
Named gaps in a stacked layout, vertical and horizontal.
Delete workspace
Every project, deploy and member is removed. This cannot be undone.
API Reference
Spacer
| Prop | Type | Default | Description |
|---|---|---|---|
size | '1' | '2' | '3' | '4' | '5' | '6' | '8' | '10' | '12' | '16' | '20' | '24' | '32' | - | Fixed size on the spacing scale. Omit to flex |
axis | 'vertical' | 'horizontal' | 'vertical' | Direction of a fixed spacer |
as | React.ElementType | 'div' | Element to render |
className | string | - | Additional CSS classes |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.