Layout
Flex
Flexbox container with gaps on the spacing scale, plus FlexItem for sizing children.
import { Flex, FlexItem } from "datui";Playground
<Flex direction="row" gap="m" />Examples
Gap, alignment and wrapping
One
Two
Three
Four
Five
Flex items
content
grow
content
Accessibility
- Purely presentational. Use
asto render a semantic element such asul,navorsection.
API
Flex
Flexbox container on datui's spacing scale.
| Prop | Type | Default | Description |
|---|---|---|---|
| align | "center" | "start" | "end" | "stretch" | "baseline" | — | |
| alignSelf | AlignSelf | — | |
| as | ElementType<any, keyof IntrinsicElements> | — | |
| className | string | — | |
| direction | "row" | "column" | — | |
| display | "none" | "flex" | "inline-flex" | — | |
| flexBasis | Length | — | |
| flexGrow | number | — | |
| flexShrink | number | — | |
| gap | Gap | — | Token, px number or `[row, column]` tuple. |
| height | Length | — | |
| justify | "center" | "start" | "end" | "space-around" | "space-between" | "space-evenly" | — | |
| margin | Space | — | |
| marginBlock | Space | — | |
| marginInline | Space | — | |
| maxHeight | Length | — | |
| maxWidth | Length | — | |
| minHeight | Length | — | |
| minWidth | Length | — | |
| noWrap | boolean | — | |
| padding | Space | — | |
| paddingBlock | Space | — | |
| paddingInline | Space | — | |
| position | Position | — | |
| reverse | boolean | — | |
| width | Length | — |
FlexItem
Child of `Flex` with sizing helpers.
| Prop | Type | Default | Description |
|---|---|---|---|
| alignSelf | AlignSelf | — | |
| as | ElementType<any, keyof IntrinsicElements> | — | |
| className | string | — | |
| flex | "content" | "grow" | "shrink" | — | Shorthand: `grow` fills free space, `shrink` gives way, `content` sizes to content. |
| flexBasis | Length | — | |
| flexGrow | number | — | |
| flexShrink | number | — | |
| height | Length | — | |
| margin | Space | — | |
| marginBlock | Space | — | |
| marginInline | Space | — | |
| maxHeight | Length | — | |
| maxWidth | Length | — | |
| minHeight | Length | — | |
| minWidth | Length | — | |
| padding | Space | — | |
| paddingBlock | Space | — | |
| paddingInline | Space | — | |
| position | Position | — | |
| width | Length | — |