Flexbox & Grid Utilities
Control layout with powerful flexbox and grid utilities.
Flex Direction
Control the direction of flex items.
Available classes:
sb-flex
: Enable flexboxsb-flex-row
: Items in a rowsb-flex-col
: Items in a columnsb-flex-row-reverse
: Reversed rowsb-flex-col-reverse
: Reversed column
Responsive variants:
sb-sm:flex-row
: Row on small screens and upsb-md:flex-row
: Row on medium screens and upsb-lg:flex-row
: Row on large screens and up- (Same pattern for
-col
variants)
Justify Content
Control how items are positioned along the main axis.
Available classes:
sb-justify-start
: Items at startsb-justify-end
: Items at endsb-justify-center
: Items at centersb-justify-between
: Space between itemssb-justify-around
: Space around itemssb-justify-evenly
: Space evenly distributed
Align Items
Control how items are positioned along the cross axis.
Available classes:
sb-items-start
: Items at startsb-items-end
: Items at endsb-items-center
: Items at centersb-items-baseline
: Items along baselinesb-items-stretch
: Items stretch to fill
Gap
Control space between items.
Available classes:
sb-gap-1
: 0.25rem gapsb-gap-2
: 0.5rem gapsb-gap-3
: 1rem gapsb-gap-4
: 1.5rem gapsb-gap-6
: 2rem gap
Flex Grow/Shrink
Control how items grow and shrink.
Available classes:
sb-grow
: Allow item to growsb-grow-0
: Prevent growingsb-shrink
: Allow item to shrinksb-shrink-0
: Prevent shrinking
Grid
Create grid layouts.
Available classes:
sb-grid
: Enable gridsb-grid-cols-1
: One columnsb-grid-cols-2
: Two columnssb-grid-cols-3
: Three columnssb-grid-cols-4
: Four columns
Responsive grid:
sb-md:grid-cols-2
: Two columns on medium screenssb-md:grid-cols-3
: Three columns on medium screenssb-md:grid-cols-4
: Four columns on medium screens
Common Pattern: Making a responsive layout with a row on large screens and a column on small screens.
<div class="sb-flex sb-flex-col sb-md:flex-row sb-items-center sb-justify-between sb-gap-4">
<div>Stacks on mobile, side by side on desktop</div>
<div>With equal spacing between</div>
</div>
Continue to Spacing Utilities