Vue NativeVue Native
Guide
Components
Composables
Navigation
  • iOS
  • Android
  • macOS
GitHub
Guide
Components
Composables
Navigation
  • iOS
  • Android
  • macOS
GitHub
  • Device & System

    • useNetwork
    • useAppState
    • useColorScheme
    • useDeviceInfo
    • useDimensions
    • usePlatform
  • Storage & Files

    • useAsyncStorage
    • useSecureStorage
    • useFileSystem
    • useDatabase
  • Sensors & Hardware

    • useGeolocation
    • useBiometry
    • useHaptics
    • useSensors
    • useBluetooth
  • Media

    • useCamera
    • useAudio
    • useCalendar
    • useContacts
  • Networking

    • useHttp
    • useWebSocket
  • Permissions

    • usePermissions
  • Navigation

    • useBackHandler
    • useSharedElementTransition
  • UI

    • useKeyboard
    • useClipboard
    • useShare
    • useLinking
    • useAnimation
    • useGesture
    • useNotifications
    • useI18n
    • usePerformance
  • Authentication

    • useAppleSignIn
    • useGoogleSignIn
  • Monetization & Updates

    • useIAP
    • useOTAUpdate
    • useBackgroundTask
  • Desktop (macOS)

    • useWindow
    • useMenu
    • useFileDialog
    • useDragDrop

useShare

Show the native share sheet to share text content and URLs with other apps.

Usage

<script setup>
import { useShare } from '@thelacanians/vue-native-runtime'

const { share } = useShare()

async function shareContent() {
  const result = await share({
    message: 'Check out Vue Native!',
    url: 'https://example.com'
  })
  if (result.shared) {
    console.log('Shared successfully')
  }
}
</script>

API

useShare(): {
  share: (content: ShareContent) => Promise<ShareResult>
}

Parameters

The share function accepts a ShareContent object:

PropertyTypeDescription
messagestring?Text message to share.
urlstring?URL to share.

At least one of message or url should be provided.

Return Value

The share function returns a Promise<ShareResult>:

PropertyTypeDescription
sharedbooleantrue if the user completed the share action, false if they cancelled.

Platform Support

PlatformSupport
iOSUses UIActivityViewController to present the system share sheet.
AndroidUses Intent.ACTION_SEND with Intent.createChooser.

Example

<script setup>
import { ref } from '@thelacanians/vue-native-runtime'
import { useShare } from '@thelacanians/vue-native-runtime'

const { share } = useShare()
const status = ref('')

async function shareLink() {
  const result = await share({
    message: 'Built with Vue Native',
    url: 'https://example.com'
  })
  status.value = result.shared ? 'Shared!' : 'Cancelled'
}

async function shareText() {
  await share({ message: 'Hello from Vue Native!' })
}
</script>

<template>
  <VView :style="{ padding: 20 }">
    <VButton :onPress="shareLink"><VText>Share Link</VText></VButton>
    <VButton :onPress="shareText"><VText>Share Text</VText></VButton>
    <VText :style="{ marginTop: 16 }">{{ status }}</VText>
  </VView>
</template>

Notes

  • The share sheet is a system-provided UI. You cannot customize its appearance.
  • On iOS, both message and url are passed as activity items. Some share targets may use one or both.
  • The returned shared boolean may not be fully reliable on all platforms -- some share extensions do not report completion status.
Edit this page
Last Updated: 2/28/26, 11:24 PM
Contributors: Abdul Hamid, Claude Opus 4.6
Prev
useClipboard
Next
useLinking