File: spacer.md | Updated: 11/16/2025
<Spacer>A flexible space that expands along the major axis of its containing layout. It's useful as a shortcut for filling all the available space between elements.
Using <Spacer> in a <Box> with default flex direction (row) will position "Left" on the left side and will push "Right" to the right side.
import {render, Box, Text, Spacer} from 'ink';
const Example = () => (
<Box>
<Text>Left</Text>
<Spacer />
<Text>Right</Text>
</Box>
);
render(<Example />);
In a vertical flex direction (column), it will position "Top" at the top of the container and push "Bottom" to the bottom.
Note that the container needs to be tall enough to see this in effect.
import {render, Box, Text, Spacer} from 'ink';
const Example = () => (
<Box flexDirection="column" height={10}>
<Text>Top</Text>
<Spacer />
<Text>Bottom</Text>
</Box>
);
render(<Example />);