Skip to the content

Layout Props

Apollion components take spacing, size, flex and color as JSX props that resolve through the theme, so a screen needs no hand-written CSS. Each component's Properties table lists only its own API; the shared props below are documented here once.
Guides

The rule

The prop set depends on what the element is:

Element
Accepts
Layout: Box, Flex, Grid
spacing, size, position and overflow; Flex/Grid add their layout props
Surface: Paper, Card
everything above plus bgColor, border, deep, color, font and motion
Leaves: Button, Text, Label
spacing, plus the props each page lists
Form controls, Image, Meter
grid placement only: area, alignSelf, justifySelf
Scrolls sideways inside the table. The page does not.

A layout container never paints. When you need a background, a border or elevation, use a Paper or Card.

How it works

Spacing. m, mt, mr, mb, ml, mx, my and the matching p* props, plus gap on flex and grid containers. Values come from the spacing scale: zero, micro, xs, small, medium, large, xl, xxl, giant — see Spacing & Dimensions.

p="small"

p="medium"

p="large"

Flex. flexDirection, alignItems, justifyContent, alignContent, wrap, flex, grow, shrink, flexBasis, order, alignSelf, justifySelf. Alignment values are semantic (start, center, between); the native names are accepted as aliases.

Size and position. width, height, min*, max* take tokens, numbers (px) or CSS strings. position, top, right, bottom, left, zIndex, transform, overflow, display, cursor, truncate and absoluteFill cover geometry.

Color. On surfaces and text, color and bgColor take theme tokens. A runtime CSS color (#hex, oklch(), var(--x)) passes through untouched but skips the theme's contrast guarantees.

Responsive. Three channels, all mobile-first — the unprefixed prop is the base:

<Flex flexDirection="column" md_flexDirection="row" gap="small" md_gap="large">…</Flex>
<Flex viewportMedias={{ md: { flexDirection: 'row' } }}>…</Flex>
<Flex cq={{ md: { flexDirection: 'row' } }}>…</Flex>

The sm_/md_/lg_/xl_ prefixes and viewportMedias respond to the viewport; cq responds to the width of the slot. See Container Queries.

Pitfalls

  • Expecting a row from a bare Flex → its flexDirection defaults to column; declare row.
  • Centering vertically with alignItems on a column → on a column the main axis is vertical; use justifyContent="center".
  • Mixed type sizes on one line looking crooked with alignItems="center" → use alignItems="baseline".

See also