A low-level layout component for controlling Flexbox layouts. Use it to easily manage direction, alignment, wrapping, and spacing between elements.
The default Flex container. By default, it sets standard flexbox behavior (row, stretch, nowrap).
Usage
import { Flex } from '@console/nimbus-ui/core';Examples
Direction
The direction prop defines the main axis of the container, controlling layout flow.
Supports row (default), column, row-reverse, and column-reverse.
Alignment And Justification
Aligning elements is straightforward using the justify (main-axis) and align (cross-axis) props.
Gap Config
Use the gap prop to easily define consistent margins between items, avoiding tricky CSS margin margin selectors.
Supports string values (like 1.5rem or 10%) and numbers (which append px).
Semantics And Polymorphism
Using the as prop, you can easily alter the underlying HTML tag to keep markup semantically correct.
API
| Prop | Type | Default | Description |
|---|---|---|---|
| align | AlignItems | initial | |
| as | ElementType | — | |
| direction | enum | initial | |
| gap | Gap<string | number> | initial | |
| justify | JustifyContent | initial | |
| ref | ForwardedRef<any> | — | |
| wrap | enum | initial |