This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 55).
Link
A SwiftUI Link component for displaying clickable links.
iOS
tvOS
Expo UI Link matches the official SwiftUI Link API.
Installation
Terminal
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
Usage
Basic link
BasicLinkExample.tsx
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.
CustomContentExample.tsx
import { Host, Link, VStack, Image, Text } from '@expo/ui/swift-ui'; export default function CustomContentExample() { return ( <Host matchContents> <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' }) ]} />