I want to create a textbox with a copy button, but using st.write
didn’t work. I tried other solutions, but none of them were effective. How can I achieve this? If it’s not possible, should I create a custom component?
Hey @Kevin10, yeah Streamlit’s native text input or markdown elements don’t have a copy button. Here is an open feature request: Add Copy to Clipboard feature to Markdown and other fields · Issue #6726 · streamlit/streamlit · GitHub and it would make sense for you to upvote it Upvotes is one signal we look at when defining the roadmap.
Creating a custom component is also a great option of course In the comment’s thread of the linked issue another user has pasted this repo: GitHub - everydaydigital/streamlit-custom-copy-buttons: Custom "Copy to Clipboard" Buttons for Streamlit Perhaps this is helpful for you, too.