Command Palette

Search for a command to run...

Components · Complex component

Flex

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

TSX
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

PropTypeDefaultDescription
alignAlignItemsinitial
asElementType—
directionenuminitial
gapGap<string | number>initial
justifyJustifyContentinitial
refForwardedRef<any>—
wrapenuminitial