Skip to content

share ​

The share function uses the browser's native sharing API to share data such as title, text, URL, or files.

Syntax ​

typescript
share(data: ShareData): Promise<void>;

Parameters ​

NameTypeDescription
dataShareDataData to be shared (title, text, url, files)

Returns ​

NameTypeDescription
–Promise<void>Promise resolved after sharing

Examples ​

typescript
share({
  title: "Title",
  text: "Check out this link!",
  url: "https://example.com"
});

Notes ​

  • Available only in browsers that support the Web Share API.
  • May throw an error if sharing is canceled or not supported.

References ​

Released under the MIT License.