Actions

share

Shares a link through the system's share sheet, or copies it where there is none, and says which happened. Call it from a click: browsers open the share sheet only for one. It never throws.

import { share } from "@/lib/ouro/share";

Example

const result = await share({ url: location.href, title: document.title });
if (result === "copied") toast("Link copied");

Use instead when

  • Use ShareButton instead for the whole button, with its "Link copied" confirmation.

Parameters

data
Type: ShareContent

Returns

Promise<ShareResult>