Flex

A Box with flexbox layout props — direction, alignment, wrap and gap as typed tokens.

Nova Starling

Product designer

Import#

import { Flex } from "astralis-ui";
// Flex.Item is available on the component itself

Alignment#

justifyContent distributes children along the main axis, alignItems along the cross axis — the same vocabulary as CSS, minus the flex- prefixes.

justifyContent="start"
justifyContent="center"
justifyContent="end"
justifyContent="between"
justifyContent="around"
justifyContent="evenly"

Flex items#

For per-child control, wrap children in Flex.Item — it exposes basis, grow, shrink, order and alignSelf.

basis 24

grow

order first

Responsive direction#

Every layout prop accepts a breakpoint map. The classic: stack on mobile, row on desktop.

One

Two

Three

For simple one-direction stacking, Stack is the shorter spelling.

Props#

Flex extends Box, so every style prop works here too.

PropTypeDefaultDescription
direction"row" | "column" | "row-reverse" | "column-reverse""row"Main-axis direction.
justifyContent"start" | "center" | "end" | "between" | "around" | "evenly""start"Distribution along the main axis.
alignItems"start" | "center" | "end" | "baseline" | "stretch""start"Alignment along the cross axis.
wrap"wrap" | "nowrap" | "wrap-reverse""nowrap"Whether children wrap onto new lines.
gap · rowGap · columnGap"0.5" – "96" (spacing scale)Gap between children, together or per axis.
alignContent · placeContent"start" | "center" | "end" | "between" | "around" | "evenly" | "stretch"Multi-line / shorthand content alignment.

Flex.Item#

PropTypeDefaultDescription
basisspacing scale | "3xs"–"8xl" | fractions | "auto" | "full" | "min" | "max" | "fit"flex-basis — the item's starting size.
flex"1" | "auto" | "initial" | "none"The flex shorthand.
grow · shrinkboolean | "0" | "1"Whether the item grows into / gives up free space.
order"1" – "12" | "first" | "last" | "none"Visual order, independent of source order.
alignSelf"auto" | "start" | "end" | "center" | "stretch" | "baseline"Overrides the container's alignItems for this item.