This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 55).

Spacer

A layout spacer that produces empty space between siblings.

Android
iOS
Web
Included in Expo Go

For the complete documentation index, see llms.txt. Use this file to discover all available pages.

A layout spacer that produces empty space between siblings inside a Row or Column. Use size for a fixed gap, or flexible to fill the remaining main-axis space.

Installation

Terminal
npx expo install @expo/ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

Usage

Fixed-size spacer

FixedSpacerExample.tsx
import { Host, Column, Text, Spacer } from '@expo/ui'; export default function FixedSpacerExample() { return ( <Host matchContents> <Column> <Text>Top</Text> <Spacer size={32} /> <Text>Bottom</Text> </Column> </Host> ); }

Flexible spacer

A flexible spacer fills the remaining space along its parent's main axis, pushing the surrounding content to opposite ends.

FlexibleSpacerExample.tsx
import { Host, Row, Text, Spacer } from '@expo/ui'; export default function FlexibleSpacerExample() { return ( <Host style={{ flex: 1 }}> <Row> <Text>Leading</Text> <Spacer flexible /> <Text>Trailing</Text> </Row> </Host> ); }

API

import { Spacer } from '@expo/ui';

No API data file found, sorry!