useWebShare
HookProgressive-enhancement hook for the Web Share API. Exposes share(), canShare(), isSupported, isLoading, and error. Falls back gracefully on unsupported platforms.
core/use-web-shareInstallation
1 · Add registry to components.json
2 · Install component
Examples
Share button
Uses the native OS share sheet where supported.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
isSupported | boolean | — | Whether Web Share API is available. |
isLoading | boolean | — | True while a share dialog is open. |
share | (data: WebShareData) => Promise<boolean> | — | Trigger native share. |
canShare | (data: WebShareData) => boolean | — | Check if specific data can be shared. |
error | string | null | — | Error message if share() throws. |
clearError | () => void | — | Reset the error state. |