> ## Documentation Index
> Fetch the complete documentation index at: https://sunpeak.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# useOpenLink

> Open external links.

<Badge color="yellow">sunpeak API</Badge>

## Overview

Returns a function to open URLs through the host application. The host controls how the link is opened (new tab, in-app browser, etc.).

<Card horizontal title="Wraps openLink" icon="cube" href="/mcp-apps/app/requests/open-link">
  MCP Apps SDK reference
</Card>

## Import

```tsx theme={null}
import { useOpenLink } from 'sunpeak';
```

## Signature

```tsx theme={null}
function useOpenLink(): (params: OpenLinkParams) => Promise<void>
```

### OpenLinkParams

<ResponseField name="url" type="string" required>
  The URL to open.
</ResponseField>

## Returns

<ResponseField name="openLink" type="(params: OpenLinkParams) => Promise<void>">
  Function to open a URL through the host application.
</ResponseField>

## Usage

```tsx theme={null}
import { useOpenLink } from 'sunpeak';

function MyResource() {
  const openLink = useOpenLink();

  return (
    <button onClick={() => openLink({ url: 'https://example.com' })}>
      Visit Website
    </button>
  );
}
```
