Introduction
Components
- Accordion
- Action Sheet
- Alert
- Audio Player
- Audio Recorder
- Audio Waveform
- Avatar
- AvoidKeyboard
- Badge
- BottomSheet
- Button
- Camera
- Camera Preview
- Card
- Carousel
- Checkbox
- Collapsible
- Color Picker
- Combobox
- Date Picker
- File Picker
- Gallery
- Hello Wave
- Icon
- Image
- Input
- Input OTP
- Link
- MediaPicker
- Mode Toggle
- Onboarding
- ParallaxScrollView
- Picker
- Popover
- Progress
- Radio
- ScrollView
- SearchBar
- Separator
- Share
- Sheet
- Skeleton
- Spinner
- Switch
- Table
- Tabs
- Text
- Toast
- Toggle
- Video
- View
Charts
Installation
pnpm dlx bna-ui add link
Usage
import { Link } from '@/components/ui/link';
<Link href='/profile'>Go to Profile</Link>
<Link href='https://example.com' browser='external'>
Open in Browser
</Link>
Examples
Default Internal Navigation
External Links
Browser Options
With Custom Children
Different Link Types
Styled Links
Button-Style Links
API Reference
Link
The main link component that handles navigation and external URL opening.
Prop | Type | Default | Description |
---|---|---|---|
href | Href | - | The destination URL or route. Can be string or route object. |
browser | 'in-app' | 'external' | 'in-app' | How external links should open (in-app browser vs system browser). |
children | ReactNode | - | The content of the link. Can be text or custom components. |
All other props from expo-router
's Link
component are also supported.
Href Types
The href
prop accepts the following formats:
- Internal routes:
"/profile"
,"/settings"
,{ pathname: "/user", params: { id: "123" } }
- External URLs:
"https://example.com"
,"http://example.com"
- Email links:
"mailto:user@example.com"
- Phone links:
"tel:+1234567890"
Browser Behavior
In-App Browser (Default)
When browser="in-app"
(default), external links open in an in-app browser:
- Mobile: Uses
expo-web-browser
for a seamless in-app experience - Web: Opens in a new tab
External Browser
When browser="external"
, external links open in the system browser:
- Mobile: Uses the device's default browser app
- Web: Opens in a new tab
Accessibility
The Link component maintains accessibility features:
- Proper semantic link structure for screen readers
- Keyboard navigation support
- Focus management
- ARIA attributes when using custom children
- Text decoration for visual link indication
Platform Considerations
React Native
- Internal navigation uses Expo Router's navigation system
- External links use either
expo-web-browser
orLinking
API - Haptic feedback can be added through custom styling
Web
- Internal navigation uses client-side routing
- External links open in new tabs
- Standard web link behavior and styling apply
Best Practices
- Use descriptive link text that clearly indicates the destination
- Choose appropriate browser behavior based on user context
- Test on both platforms to ensure consistent behavior
- Consider loading states for external links that might take time to open
- Use custom children sparingly - text links are more accessible
On This Page
InstallationUsageExamplesDefault Internal NavigationExternal LinksBrowser OptionsWith Custom ChildrenDifferent Link TypesStyled LinksButton-Style LinksAPI ReferenceLinkHref TypesBrowser BehaviorIn-App Browser (Default)External BrowserAccessibilityPlatform ConsiderationsReact NativeWebBest Practices