---
title: "st-copy: A Clean Copy-to-Clipboard Button for Streamlit"
description: "st-copy is a tiny, theme-aware Streamlit component that adds a one-click copy-to-clipboard button to any Streamlit app — built for the chat UIs and prompt outputs I needed while shipping AI products."
date: "2025-05-05T07:00:00Z"
last_updated: "2026-07-27"
build_time: "2026-08-16T06:32:51Z"
project_name: "st-copy — Streamlit Copy-to-Clipboard Button Component"
project_description: "A tiny, theme-aware Streamlit component that adds a one-click copy-to-clipboard button to any Streamlit app. Distributed as the `st-copy` PyPI package; used in AI chat UIs and prompt-output surfaces where a clean, accessible copy button was missing from the Streamlit toolbox."
status: "Active"
period_from: "2025-05-05"
project_url: "https://st-copy.streamlit.app/"
repository: "https://github.com/alex-feel/st-copy"
related_skills: ["software-development","python","javascript","devops"]
related_projects: ["aila","hugo-artifacts"]
keywords: ["Streamlit","Streamlit Component","Copy to Clipboard","UI Component","Open Source","Python","PyPI"]
license: "https://creativecommons.org/licenses/by/4.0/"
canonical: "https://www.alexfeel.info/projects/st-copy/"
---

## Overview

**st-copy** is a tiny, theme-aware [Streamlit](https://streamlit.io/) component that adds a one-click copy-to-clipboard button to any Streamlit app — published on PyPI as [`st-copy`](https://pypi.org/project/st-copy/) under the MIT license, with the full source on [GitHub](https://github.com/alex-feel/st-copy). It has spread well beyond the apps I built it for: by download volume it sits in the top 10% of everything published on PyPI.

You can try it live at [st-copy.streamlit.app](https://st-copy.streamlit.app/) — a small demo that shows the button rendered inside chat messages, with all parameters in use.

## The Problem

Streamlit's built-in widgets cover most app-building needs, but one small thing was consistently missing: a clean, theme-aware, keyboard-accessible copy-to-clipboard button that can sit inline next to assistant messages, generated prompts, install commands, or any other snippet users might want to copy. The options available outside Streamlit's core either looked out of place in a Streamlit theme, required heavier JavaScript dependencies than the task deserves, or didn't integrate cleanly with Streamlit's component API. In an AI chat UI — where copy buttons should feel native — that small gap was visible every time.

## The Solution

`st-copy` is deliberately narrow: one function, a handful of arguments, one job.

- **One-line usage.** `copy_button('some text')` drops a working copy button into the Streamlit layout.
- **Inline, frameless layout.** Built on Streamlit's Custom Components v2 — the button renders directly in the app DOM with no iframe, so it sits flush beside other elements, including inside `st.container(horizontal=True)`.
- **Theme-aware out of the box.** The button picks up Streamlit's light or dark theme automatically — icon color, tooltip style, and focus ring all follow the host app's palette.
- **Two icon styles.** A Google _Material Symbols_ icon by default, or Streamlit's native code-block icon via `icon='st'` for apps that want the button to blend into a `st.code()` visual lineage.
- **Localizable microcopy.** The hover tooltip (`tooltip='Copy'`) and post-copy confirmation label (`copied_label='Copied!'`) are plain-string arguments, so the component drops cleanly into apps serving non-English users.
- **Keyboard-accessible.** The button is fully focusable; pressing **Enter** or **Space** copies, matching how users expect a well-behaved web button to work.
- **Truthful return value.** The function returns `True` on a successful copy, `False` if the browser Clipboard API refuses, or `None` while the button hasn't been clicked yet — useful for apps that want to confirm or log the copy event.

Consumers only need `pip install st-copy` and `import st_copy` — the prebuilt frontend bundle is embedded in the wheel, so there is no Node.js requirement on the consumer side.

<!-- markdownlint-disable MD034 -->

[alex-feel/st-copy](https://github.com/alex-feel/st-copy) — 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. (9 stars · Python · MIT)

<!-- markdownlint-enable MD034 -->

## Usage and Adoption

- **Published on PyPI** as [`st-copy`](https://pypi.org/project/st-copy/), where it has passed 150,000 downloads.
- **Public GitHub repository** at [alex-feel/st-copy](https://github.com/alex-feel/st-copy) under the MIT license, with CI/CD and release automation.
- **Live demo** at [st-copy.streamlit.app](https://st-copy.streamlit.app/) — deployed on Streamlit Community Cloud, source in the companion [st-copy-example](https://github.com/alex-feel/st-copy-example) repository.
- **Requirements** stay lean: Streamlit **1.56 or newer** (for the Custom Components v2 API), Python **3.10 or newer**, and an HTTPS context at runtime (standard for deployed Streamlit apps).

## Why I Built It

`st-copy` came directly out of my applied AI work — in particular, shipping Streamlit-based UIs for AI products like [AILA (AI Localisation Assistant)](/projects/aila/) at Spotware and other internal Streamlit tools for AI workflows. Those apps kept running into the same tiny paper-cut: the chat message was there, the generated text was there, but the "copy this" affordance users expect from modern chat UIs simply wasn't in Streamlit's toolbox at a quality the apps deserved. I wanted something beautiful, functional, and simple — so rather than work around the gap in every app, I built the missing primitive once, published it, and put it on my own apps.

That kept the Streamlit apps clean and made the component available to the wider Streamlit community — the kind of small, sharp open-source tool the ecosystem benefits from.

## My Role

I designed, built, and maintain `st-copy` end-to-end as a solo open-source project — the Python wrapper and the frontend, the theme-aware behavior, the test suite, the release automation, and the PyPI distribution. It lives on my personal GitHub under an MIT license, and I accept issues and contributions from the Streamlit community.


## Site index

- [llms.txt](https://www.alexfeel.info/llms.txt)
- [Complete index](https://www.alexfeel.info/llms-index.txt)
