Installation
The bridge API is included in the@mentra/react package:
Quick Start
Environment Detection
isInMentraOS()
Check if your app is running inside the MentraOS webview.
getMentraOSPlatform()
Get the host platform.
hasCapability(capability)
Check if a specific bridge capability is available.
'share', 'open_url', 'copy_clipboard', 'download'
Share
Open the native share sheet. Supports text, URLs, and files.Promise<BridgeResponse> with { success, cancelled?, error? }.
Browser fallback: Uses navigator.share() if available, otherwise copies text to clipboard.
ShareOptions
| Property | Type | Description |
|---|---|---|
text | string? | Plain text to share |
title | string? | Title shown in the share sheet |
url | string? | URL to share |
base64 | string? | Base64-encoded file data |
mimeType | string? | MIME type when sharing a file |
filename | string? | Filename when sharing a file |
Open URL
Open a URL in the system browser, escaping the webview.window.open(url, '_blank').
Copy to Clipboard
Copy text to the system clipboard.Promise<boolean> — true if the copy succeeded.
Browser fallback: navigator.clipboard.writeText().
Download
Download a file. In MentraOS, this writes the file and opens the share sheet so the user can save it.Promise<BridgeResponse> with { success, error?, filePath? }.
Browser fallback: Creates a temporary download link.
DownloadOptions
| Property | Type | Description |
|---|---|---|
base64 | string? | Base64-encoded file data |
url | string? | URL to download from |
mimeType | string? | MIME type of the file |
filename | string | Filename for the downloaded file (required) |
Capsule Menu
The capsule menu is the floating pill in the top-right corner of miniapp webviews (containing the... menu and close button). It renders on top of your content, so you need to account for it in your layout.

useCapsuleMenu()
React hook that returns the capsule menu’s bounding rect and a convenience safeAreaTop value.
{ rect: CapsuleMenuRect | null, safeAreaTop: number }
rect— the bounding box of the capsule menu, ornulloutside MentraOSsafeAreaTop— minimum top padding (in px) to clear the capsule menu.0outside MentraOS.
getCapsuleMenuRect()
Standalone function (no React required). Returns the capsule menu’s bounding rect relative to the webview content area.
CapsuleMenuRect | null
CapsuleMenuRect
| Property | Type | Description |
|---|---|---|
top | number | Distance from top of webview content (px) |
right | number | Distance from right edge of screen (px) |
bottom | number | Bottom edge = top + height (px) |
left | number | Left edge (px) |
width | number | Width of the capsule menu (px) |
height | number | Height of the capsule menu (px) |
Custom Navigation Bar
If you want to build a custom nav bar that sits beside the capsule (like WeChat mini programs), use the raw rect:useMentraBridge() Hook
Convenience hook that bundles all bridge capabilities:
Browser Fallbacks
Every bridge function gracefully falls back when running outside MentraOS:| Function | MentraOS | Browser Fallback |
|---|---|---|
share() | Native share sheet | navigator.share() then clipboard |
openUrl() | System browser | window.open() |
copyToClipboard() | Native clipboard | navigator.clipboard |
download() | Save via share sheet | Download link |
getCapsuleMenuRect() | Bounding rect | null |
useCapsuleMenu() | { rect, safeAreaTop } | { null, 0 } |

