Flex

A flexbox container as a component: gap, alignment, direction and wrapping as props, with the gap sizes coming from the theme.

Basic

A Flex lays out its children in a row as they are, with no extra element around each one, and gap sets the space between them.

Gap

Set gap to a spacing step from xxs to xxl to space the children with the theme's sizes, which shrink in compact mode.

Gap presets

Set gap to small, medium or large for the three preset sizes, which also follow the theme and compact mode.

Custom gap

Pass gap a number or any CSS gap value, like "1rem 2rem" for different row and column spacing when the items wrap.

Vertical

Set orientation="vertical" to stack the children in a column, top to bottom, instead of laying them out in a row.

Wrap

Set wrap to let items flow onto the next line when the row runs out of room, or pass a flex-wrap value like wrap-reverse.

Item flex

Set flex on a nested Flex to size it inside its parent: one share, two shares, or none to keep its own width.

Custom element

Set component to render a ul, a section or any other element, so the markup matches the content and the layout stays the same.

Nesting

Nest one Flex in another to build a header with its actions on the right, over a body with a fixed-width sidebar.

Empty placeholder

A Flex with no children is hidden, so a fixed-height placeholder keeps one invisible child to hold its space.

In context

The component inside real screens, with the components it usually sits beside.

Toolbar rows

Three toolbars built from one Flex each: search with actions on the right, a centered pager, and a filter row that wraps.

API Reference

Flex
Flex's props. Rows marked antuikit in the Version column are added by the kit.