Flex
A layout container based on CSS Flexbox; attributes control direction, main/cross-axis alignment, gap and wrapping.
Basic usage
Horizontal and gap
Direction
The vertical shorthand equals direction="vertical" (stacked vertically).
Vertical direction
Equivalent direction syntax
Main-axis alignment
justify — full enumeration
justify="start" (default)1 2 3 justify="center"1 2 3 justify="end"1 2 3 justify="between"1 2 3 justify="around"1 2 3
Cross-axis alignment
align — full enumeration
align="stretch" (default)Button Tag align="start"Button Tag align="center"Button Tag align="end"Button Tag align="baseline"Button Tag
A fixed 80px-height container with items of different heights (button 32px / tag 20px) shows the cross-axis difference of each
alignvariant;stretchstretches items to the container height.
Wrapping
wrap is a boolean attribute: when present, flex-wrap: wrap; otherwise nowrap.
Wrap
Empty container
With no children the height is 0 — no error, no placeholder.
Empty container
API
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
align | Cross-axis alignment | string | stretch |
direction | Main-axis direction | string | row |
gap | Gap between items | string | — |
justify | Main-axis alignment | string | start |
vertical | Vertical shorthand | boolean | — |
wrap | Wrapping (boolean; present means wrap) | boolean | — |
Slots
| Name | Description |
|---|---|
| default | — |