St.code copy message bug

st.code(‘print(“hi”)’, language=“python”)

Streamlit shows a copy icon next to this block of code, however if i click on that i don’t get a message saying copied. How to achieve that?

Hi @abhijithjainn, there is no Click parameter exposed for you to monitor the copy-to-clipboard event with st.code. You will have to check and see if they is an external library that tells you of a new clipboard entry, and then assume that the copied element has happened in st.code, if such checking statements immediately follow the st.code command.

Maybe, a streamlit insider can inform better.


Thanks @Shawn_Pereira, even i thought so. However i was expecting if streamlit insiders can help me somehow.

That functionality doesn’t exist currently, but feel free to create a feature request here Issues · streamlit/streamlit · GitHub if there isn’t one already.

1 Like