Expo UI and Router for iOS
Components

Link

A SwiftUI Link component for displaying clickable links.

Expo UI Link matches the official SwiftUI Link API.

Usage

import { Host, Link } from '@expo/ui/swift-ui';

export default function BasicLinkExample() {
  return (
    <Host style={{ flex: 1 }}>
      <Link label="Visit Expo" destination="https://expo.dev" />
    </Host>
  );
}

Custom label content

You can pass custom components as children for more complex link label content.

import { Host, Link, VStack, Image, Text } from '@expo/ui/swift-ui';

export default function CustomContentExample() {
  return (
    <Host style={{ flex: 1 }}>
      <Link destination="https://expo.dev">
        <VStack spacing={4}>
          <Image systemName="link" />
          <Text>Expo</Text>
        </VStack>
      </Link>
    </Host>
  );
}

API

import { Link } from '@expo/ui/swift-ui';

Component

Type: React.Element<LinkProps>

Displays a native link component.

Example

import { Link } from '@expo/ui/swift-ui';
import { foregroundStyle, font } from '@expo/ui/swift-ui/modifiers';

<Link
  label="Open"
  destination="https://expo.dev"
  modifiers={[
    foregroundStyle('red'),
    font({ size: 24, weight: 'bold' })
  ]}
/>

LinkProps

children

Optional • Literal type: union

Custom content for the link label. Use this for custom label views. Only nested elements are supported, not plain strings.

Acceptable values are: ReactElement<unknown, string | JSXElementConstructor<any>> | ReactElement[]

destination

Type: string

The URL for the link.

label

Optional • Type: string

The text label for the Link. Use this for simple text links.

Inherited props

Modifiers

Use these modifiers in the modifiers prop of the SwiftUI version.

Modifiers for Link

Modifiers for any view

Sources

The original Expo docs for this page:

  • Link (SwiftUI) (source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/link.md)

On this page