A modern, customizable social sharing component for Streamlit applications. Enable users to share your content across multiple social platforms with beautiful, responsive buttons.
- Multiple Built-in Networks: X (Twitter), LinkedIn, Facebook, WhatsApp, Telegram and more
- Custom Networks: Create your own sharing buttons with custom styling and URLs
- Return Values: Get feedback on which platform users shared to
- Easy Integration: One-line integration with your Streamlit apps
- Flexible Icons: Support for emojis, characters, or custom image URLs
- X (Twitter) - Share tweets with text and URLs
- Threads - Meta's new social platform
- LinkedIn - Professional network sharing
- Facebook - Share to Facebook timeline
- Reddit - Community discussions
- Telegram - Share to Telegram chats
- WhatsApp - Share via WhatsApp messages
- Email - Opens default email client
pip install streamlit-social-shareimport streamlit as st
from streamlit_social_share import streamlit_social_share, create_custom_network
st.title("My Awesome App")
# Basic usage
network = streamlit_social_share(
text="Check out this amazing Streamlit app!",
url="https://your-app-url.com",
networks=["x", "linkedin", "whatsapp", "email"]
)| Parameter | Type | Description |
|---|---|---|
text |
str |
Text to include in the shared message |
url |
str | None |
URL to share (uses current page if None) |
image |
str | None |
Image URL to attach (when supported) |
networks |
list[str] | None |
List of networks to display |
key |
str | None |
Unique component key |
Returns: str | None - The network name if shared, None otherwise
Create your own sharing buttons with the create_custom_network() function:
from streamlit_social_share import streamlit_social_share, create_custom_network
# Create custom networks
my_platform = create_custom_network(
network_id="my_platform",
name="My Platform",
color="#FF6B6B",
icon="🚀", # Emoji, character, or image URL
share_url="https://myplatform.com/share?url={url}&text={text}"
)
dev_to = create_custom_network(
network_id="dev_to",
name="Dev.to",
color="#0A0A0A",
icon="https://dev.to/favicon.ico", # Custom icon URL
share_url="https://dev.to/new?prefill={text} {url}"
)
# Use custom networks alongside built-in ones
network = streamlit_social_share(
text="Check out my article!",
url="https://example.com",
networks=[my_platform, dev_to, "x", "linkedin"] # Clean and simple!
)| Parameter | Type | Description |
|---|---|---|
network_id |
str |
Unique identifier for the network |
name |
str |
Display name for the button |
color |
str |
Background color (hex code like #FF6B6B) |
icon |
str |
Emoji (🚀), character, or image URL |
share_url |
str |
URL template with {text}, {url}, {image} placeholders |
Returns: str - The network_id that can be used in the networks parameter
A comprehensive example demonstrating all features, network categories, and custom network creation is provided in example.py. Run it with:
streamlit run example.py# Clone the repository
git clone https://github.com/lejuliennn/streamlit-social-share.git
cd streamlit-social-share
# Install dependencies
pip install -r requirements.txt
# Run the example
streamlit run example.py# Build the package
python setup.py sdist bdist_wheel
# Install locally
pip install -e .Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions