BeeFlex
A flexbox container to align and space items, with an automatic switch to a column on small screens.
ts
import { BeeFlex } from "@thaisrr/beedesign";
import "@thaisrr/beedesign/style.css";Usage
Items go in the default slot. By default they are centered, spaced by lg, and wrap to the next line when there is not enough room.
First
Second
Third
Justify
The justify prop sets the distribution along the main axis.
flex-startOneTwoThree
centerOneTwoThree
flex-endOneTwoThree
space-betweenOneTwoThree
Align
The align prop sets the alignment along the cross axis.
flex-startA
B
C
centerA
B
C
flex-endA
B
C
stretchA
B
C
Gap
The gap prop accepts a keyword (none, sm, md, lg) tied to the spacing tokens, or a number in pixels.
gap="none"OneTwoThree
gap="sm"OneTwoThree
gap="md"OneTwoThree
gap="lg"OneTwoThree
:gap="48"OneTwoThree
Direction
With direction="column", items stack vertically.
Responsive
By default, below 768px wide, the container switches to a column and centers its items. Turn this off with :responsive="false".
Stacked below 768px
Resize the window
to see the difference
API
Props
| Name | Type | Default | Description |
|---|---|---|---|
justify | "flex-start" | "flex-end" | "center" | "space-between" | "center" | Distribution along the main axis. |
align | "flex-start" | "flex-end" | "center" | "stretch" | "center" | Alignment along the cross axis. |
direction | "row" | "column" | "row" | Direction of the main axis. |
gap | "none" | "sm" | "md" | "lg" | number | "lg" | Spacing. A number is in pixels. |
responsive | boolean | true | Switches to a centered column below 768px. |
Slots
| Name | Description |
|---|---|
default | Items to lay out. |
CSS variables used
--bd-space-sm, --bd-space-md, --bd-space-lg.