---
modificationDate: June 29, 2026
title: Spacer
description: A SwiftUI Spacer component for flexible spacing.
sourceCodeUrl: 'https://github.com/expo/expo/tree/sdk-57/packages/expo-ui'
packageName: '@expo/ui'
platforms: ['ios', 'tvos', 'expo-go']
---

<AgentInstructions>

## Submitting Feedback

If this page contains errors, outdated information, or gaps that blocked you from completing a task, report it so the docs can be improved:

curl -X POST https://api.expo.dev/v2/feedback/docs-send -H 'Content-Type: application/json' -d '{"url":"/versions/v57.0.0/sdk/ui/swift-ui/spacer/","feedback":"🤖 Agent feedback for docs: <specific, actionable description> (<model>, <harness>)"}'

Only submit when you have something specific and actionable to report. Replace <model> with the model you are running as and <harness> with the tool you are running in (for example, Claude Code, Cursor, Codex CLI).

## Navigation

When answering a related or follow-up question, use llms.txt to find the relevant page as Markdown (.md) instead of guessing.

You are here: Reference (v57.0.0) > Expo UI > SwiftUI (44 pages in this section)
Full documentation tree: [llms.txt](https://docs.expo.dev/llms.txt)

</AgentInstructions>

# Spacer

A SwiftUI Spacer component for flexible spacing.
iOS, tvOS, Included in Expo Go

> For cross-platform usage, see the universal [`Spacer`](/versions/v57.0.0/sdk/ui/universal/spacer.md) — it renders the appropriate native component per platform.

Expo UI Spacer matches the official SwiftUI [Spacer API](https://developer.apple.com/documentation/swiftui/spacer) and expands to fill available space in a stack.

## Installation

```sh
# npm
npx expo install @expo/ui

# yarn
yarn expo install @expo/ui

# pnpm
pnpm expo install @expo/ui

# bun
bun expo install @expo/ui
```

If you are installing this in an [existing React Native app](/bare/overview.md), make sure to [install `expo`](/bare/installing-expo-modules.md) in your project.

## Usage

### Basic spacer in HStack

Use Spacer to push content to opposite ends of a horizontal stack.

```tsx
import { Host, HStack, Text, Spacer } from '@expo/ui/swift-ui';

export default function SpacerHStackExample() {
  return (
    <Host style={{ flex: 1 }}>
      <HStack>
        <Text>Left</Text>
        <Spacer />
        <Text>Right</Text>
      </HStack>
    </Host>
  );
}
```

### Basic spacer in VStack

Use Spacer to push content to opposite ends of a vertical stack.

```tsx
import { Host, VStack, Text, Spacer } from '@expo/ui/swift-ui';

export default function SpacerVStackExample() {
  return (
    <Host style={{ flex: 1 }}>
      <VStack>
        <Text>Top</Text>
        <Spacer />
        <Text>Bottom</Text>
      </VStack>
    </Host>
  );
}
```

## API

```tsx
import { Spacer } from '@expo/ui/swift-ui';
```

## Component

### `Spacer`

Type: React.[Element](https://www.typescriptlang.org/docs/handbook/jsx.html#function-component)<[SpacerProps](#spacerprops)\>

SpacerProps

### `minLength`

Optional • Type: `number`

The minimum length of the spacer. This is the minimum amount of space that the spacer will take up.

#### Inherited Props

-   [CommonViewModifierProps](/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)
