> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/common/growth/share/share-message.md).

# Message sharing

`share` You can display the native share sheet with this function so users can easily share content. For example, users can select an app they want from the list of installed apps, such as a messenger or notes app, to share invitation messages or text information. It uses the default sharing interface provided by each platform (Android, iOS).

`options.message` When you pass the message to be shared in the property, a list of apps the user can choose from is displayed. For example, it is useful when the user wants to share a text message or save it to a notes app.

**Signature**

```typescript
function share(message: { message: string }): Promise<void>;
```

**Parameters**

* **options** · Required · `object`

  An object containing the message to share.

  * **options.message** · Required · `string`

    The text string to share. For example, "Hello! I'm sharing this content."

**Example: Implementing the share feature**

Below is a simple example that shares a message when a button is clicked.

{% tabs %}
{% tab title="js" %}

```js
import { share } from '@apps-in-toss/web-framework';

async function handleShare() {
  try {
    await share({ message: 'Message to share' });
    console.log('Share complete');
  } catch (error) {
    console.error('Share failed:', error);
  }
}
```

{% endtab %}

{% tab title="React" %}

```tsx
import { share } from '@apps-in-toss/web-framework';

const ShareButton = () => {
  const handleShare = async () => {
    try {
      await share({ message: 'Message to share' });
      console.log('Share complete');
    } catch (error) {
      console.error('Share failed:', error);
    }
  };

  return <button onClick={handleShare}>Share</button>;
};
```

{% endtab %}

{% tab title="React Native" %}

```tsx
import { share } from '@apps-in-toss/framework';
import { Button } from 'react-native';

function MyPage() {
  return <Button title="Share" onPress={() => share({ message: 'This is the message to share.' })} />;
}
```

{% endtab %}
{% endtabs %}

**Share a message by receiving user input**

You can also implement sharing a message entered directly by the user. The following is an example of an invitation message creation feature.

```tsx
import { useState } from 'react';
import { TextInput, Button, View, Alert } from 'react-native';
import { share } from '@apps-in-toss/framework';

function ShareWithInput() {
  const [invitationMessage, setInvitationMessage] = useState(''); // [!code highlight]

  const handleShare = () => {
    if (!invitationMessage.trim()) {
      Alert.alert('Please enter a message to share.');
      return;
    }
    share({ message: invitationMessage }); // [!code highlight]
  };

  return (
    <View style={{ padding: 20 }}>
      <TextInput
        style={{
          height: 40,
          borderColor: 'gray',
          borderWidth: 1,
          marginBottom: 10,
          paddingHorizontal: 8,
        }}
        placeholder="Enter an invitation message"
        value={invitationMessage}
        onChangeText={setInvitationMessage}
      />
      <Button title="Share Invitation Message" onPress={handleShare} />
    </View>
  );
}
```

**Try the example app**

[apps-in-toss-examples](https://github.com/toss/apps-in-toss-examples) from the repository [with-share-text](https://github.com/toss/apps-in-toss-examples/tree/main/with-share-text) Download the code, or scan the QR code below to try it yourself.

QR code link: intoss\://with-share-text


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/common/growth/share/share-message.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
