Use direction="horizontal" for horizontal layouts. Stacked items are vertically centered
by default and only take up their necessary width. Use the gap prop to add space between
items.
<Stackdirection="horizontal"gap={3}>
<divclassName="bg-light border">First item</div>
<divclassName="bg-light border">Second item</div>
<divclassName="bg-light border">Third item</div>
</Stack>
Using horizontal margin utilities like .ms-auto as spacers:
import Stack from 'react-bootstrap/Stack'Copy import code for the Stack component
Name
Type
Default
Description
gap
responsivePropType(PropTypes.number)
Sets the spacing between each item. Valid values are 0-5.
bsPrefix
string
'hstack | vstack'
Change the underlying component CSS base class name and modifier class names prefix.
This is an escape hatch for working with heavily customized bootstrap css.
Defaults to hstack if direction is horizontal or vstack if direction
is vertical.