TrademarkTrademark
Docs
Ctrl k
Search docs...
Components

Flex

Updated: October 18, 2026
View on GitHub
Soon
Not released yet. This is on main and is not in any published version yet. It will not install today.

Flex renders a React Native View and takes Once UI's layout, spacing, size and surface props, so a screen is built by nesting it instead of writing style objects. Row and Column are Flex with direction preset. Flex is a row by default, as on the web, even though a plain View is a column. See the web Flex page for the full reference.

Direction and alignment

horizontal and vertical name the axis you see, so they mean the same thing in a row and in a column. center centers on both.

Spacing and size

Spacing props take a token such as "16" or "m", or a number of rem, as on the web. Sizes take a token, a number of rem or a percentage. fillWidth stretches to the parent's width, and fit keeps the view at its content's size.

Surface

background, border, radius and shadow read the theme's tokens. background also takes "surface", "page", "overlay" and "transparent". A border is 1 point wide unless you set borderWidth.

radius does not clip children. Add overflow="hidden" when it should; on iOS that also hides the view's own shadow.

Responsive and safe areas

The breakpoint props xl, l, m, s and xs take an object of props that applies on screens up to that width, as on the web. safeArea adds the screen's safe areas to the padding, once they are passed to ThemeProvider. The overview shows both in detail.

Differences from the web

  • Bare text. React Native throws on text outside a Text. Flex wraps bare strings and numbers in Text for you, so <Row>Hi</Row> works.
  • Position. position takes relative, absolute or static. React Native has no fixed or sticky positioning.
  • Left out. solid, single-side borders (borderTop and the rest), the text props (onBackground, align, textVariant and the rest), transition, scrollbar, overflowX and overflowY have no native equivalent.
  • dark and light render the view only while the theme is dark or light. They change no colours.
  • pointerEvents also takes React Native's "box-none" and "box-only".
  • safeArea is native only.

Props

Flex, Row and Column take the same props. They also take the spacing props (padding, paddingX, paddingY, paddingTop and the other sides, the same set for margin, and gap) and every React Native View prop.

Prop
Type
Default
Description
direction"row" | "column" | "row-reverse" | "column-reverse""row"Main axis. Column sets "column".
horizontal"start" | "center" | "end" | "between" | "around" | "even" | "stretch"Alignment along the horizontal axis.
verticalsame as horizontalAlignment along the vertical axis.
centerbooleanCenters children on both axes.
wrapbooleanLets children wrap onto new lines.
flexnumberReact Native's flex.
backgroundColors | "surface" | "page" | "overlay" | "transparent"Background colour token.
borderColors | "surface" | "transparent"Border colour token. Adds a solid 1pt border.
borderStyle"solid" | "dashed""solid"Border style.
borderWidth1 | 2 | 4 | 81Border width in points.
radius"xs" | "s" | "m" | "l" | "xl" | "full" | "none"Corner radius token.
shadow"xs" | "s" | "m" | "l" | "xl"Shadow token.
overflow"visible" | "hidden" | "scroll"Pass "hidden" to clip children to radius.
width, heightSpacingToken | number | "<n>%"Size as a token, rem or a percentage.
minWidth, maxWidth, minHeight, maxHeightSpacingToken | number | "<n>%"Size limits. maxWidth also sets the width to 100%.
fill, fillWidth, fillHeightboolean100% width and height, or one of them.
fit, fitWidth, fitHeightbooleanKeeps the view at its content's size.
aspectRationumber | stringWidth to height ratio.
position"relative" | "absolute" | "static"Positioning.
top, right, bottom, leftSpacingToken | numberOffsets, as a token or rem.
opacity0 | 10 | 20 | … | 100Opacity in percent.
zIndex-1 to 10Stacking order.
pointerEvents"none" | "all" | "auto" | "box-none" | "box-only"Which views take touches.
hidebooleanRenders nothing.
dark, lightbooleanRenders only in the dark or light theme.
safeAreaboolean | ("top" | "right" | "bottom" | "left")[]Adds the safe-area insets to the padding on these edges, or all four.
xl, l, m, s, xsFlexBreakpointPropsProps that apply on screens up to that breakpoint.
styleStyleProp<ViewStyle>Applied after the props.
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club