Streamlit copy‑to‑clipboard button component
Project description
Streamlit Copy-to-Clipboard Button Component
A tiny, theme‑aware Streamlit component that adds a one‑click "copy-to-clipboard" button to your app — perfect for the chat UI, URLs or any other text the user might need to copy.
✨ Features
- Streamlit theme aware: Adapts icon colour & tooltip style automatically; works in both light and dark themes.
- Two icon styles: Google Material Symbols (default) or the native Streamlit code‑block icon.
- Custom tooltip & "Copied!" label: Localised UI in one line.
- Keyboard‑friendly: Fully focusable, press Enter/Space to copy.
🔧 Installation
pip install st-copy
⚡ Quick start
import streamlit as st
from st_copy import copy_button
st.title('Minimal demo')
copy_button('Hello, Streamlit!') # one line – that's it 🎉
Run your script:
streamlit run app.py
🛠 API
def copy_button(
text: str,
*,
icon: Literal['material_symbols', 'st'] = 'material_symbols',
tooltip: str = 'Copy',
copied_label: str = 'Copied!',
key: Optional[str] = None,
) -> Optional[bool]:
| Parameter | Type / Default | Description |
|---|---|---|
text |
str | Text placed on the user’s clipboard. |
icon |
Literal['material_symbols', 'st']default 'material_symbols' |
Icon style: Google Material content_copy (material_symbols) or Streamlit’s native code‑block icon (st). |
tooltip |
str, default 'Copy' |
Tooltip shown on hover/focus. |
copied_label |
str, default 'Copied!' |
Small label displayed for ~1 s after a successful copy. |
key |
str | None, default None |
Unique component key; if omitted a random UUIDv4 is generated. |
| Returns | bool | None | True – copy succeeded; False – Clipboard API failed; None – button not clicked yet. |
🎨 Examples
See examples/app.py for a chat‑style demo that showcases every argument and the deployed version at https://st-copy.streamlit.app/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file st_copy-1.0.1.tar.gz.
File metadata
- Download URL: st_copy-1.0.1.tar.gz
- Upload date:
- Size: 108.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06ae24ccc5048f8324832b0e1abffea76133be58fd2d61e84a1fcf8e18e0f826
|
|
| MD5 |
1e9a0cad63fcb85e564c571888350ba4
|
|
| BLAKE2b-256 |
663182d0f520e056010fa87b53f560714a6ace47fb58df0c30a5302be43fd295
|
Provenance
The following attestation bundles were made for st_copy-1.0.1.tar.gz:
Publisher:
python-publish.yml on alex-feel/st-copy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
st_copy-1.0.1.tar.gz -
Subject digest:
06ae24ccc5048f8324832b0e1abffea76133be58fd2d61e84a1fcf8e18e0f826 - Sigstore transparency entry: 206832232
- Sigstore integration time:
-
Permalink:
alex-feel/st-copy@a8bc4a602bdd940d8894a1f6b2ff3d89ae7ab0fb -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/alex-feel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@a8bc4a602bdd940d8894a1f6b2ff3d89ae7ab0fb -
Trigger Event:
release
-
Statement type:
File details
Details for the file st_copy-1.0.1-py3-none-any.whl.
File metadata
- Download URL: st_copy-1.0.1-py3-none-any.whl
- Upload date:
- Size: 108.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b45872e105b05641c9de78a74e59087689ce6249bc59720066b681f2e3f75d0
|
|
| MD5 |
28431598cda1ab50d4632717169ac7f9
|
|
| BLAKE2b-256 |
348f2a9c11ef6aed1a80710d4f962476698e07dad81b4b3c81cf613aa6dd0fd3
|
Provenance
The following attestation bundles were made for st_copy-1.0.1-py3-none-any.whl:
Publisher:
python-publish.yml on alex-feel/st-copy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
st_copy-1.0.1-py3-none-any.whl -
Subject digest:
4b45872e105b05641c9de78a74e59087689ce6249bc59720066b681f2e3f75d0 - Sigstore transparency entry: 206832234
- Sigstore integration time:
-
Permalink:
alex-feel/st-copy@a8bc4a602bdd940d8894a1f6b2ff3d89ae7ab0fb -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/alex-feel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@a8bc4a602bdd940d8894a1f6b2ff3d89ae7ab0fb -
Trigger Event:
release
-
Statement type: