Skip to content

Layout (Flex & Grid)

Caja supports multiple layout modes that map directly to CSS display values.

Display Modes

ModeCSSDescription
Flex Rowdisplay: flex; flex-direction: rowChildren flow horizontally
Flex Columndisplay: flex; flex-direction: columnChildren flow vertically
Inline Flexdisplay: inline-flexLike flex, but element shrinks to content width
Griddisplay: gridCSS Grid layout

Flexbox

The most common layout mode in Caja. Choose between Flex Row and Flex Column in the properties panel.

Direction & Wrap

  • Row — Children flow horizontally
  • Column — Children flow vertically
  • Reverse — Flip the direction
  • Wrap — Allow children to wrap to a new line

Alignment

  • Justify — Main-axis alignment: start, center, end, space-between, space-around
  • Align — Cross-axis alignment: start, center, end, stretch

Gap

Space between children, using Tailwind spacing tokens (gap-2 = 8px, gap-4 = 16px, etc.). The gap dropdown also includes a Space option (auto), which maps to justify-between.

Child Properties

Each child in a flex container can control:

  • Grow — How much extra space to absorb
  • Shrink — How much to shrink when space is tight
  • Align Self — Override the parent's cross-axis alignment

Grid

CSS Grid support with:

  • Columns — Number of grid columns (1–12)
  • Rows — Number of grid rows (1–6)
  • Gap — Space between cells

Grid children can span multiple columns or rows using Col Span and Row Span controls, including a full option to span all columns/rows.

Size Modes

Every frame has width and height controls with four modes:

ModeBehaviorTailwind
DefaultNatural sizing
HugShrink to fit contentw-fit / h-fit
FillExpand to fill parentw-full / h-full (or flex-1 in flex)
FixedSpecific pixel valuew-[300px] / h-[200px]