Add copy to clipboard button to a table

Hello,
I display a simple table using st.table().
One of the columns specifies a path to a local folder.
I want to add a column where there will be a button that when clicked will copy the path to clipboard.

Or alternatively, the folder path column will be clickable, and clicking on it will open the folder on the computer.

Can anyone help me with this?
Thanks

There is no direct way to copy something as far as i know
But if you use markdown as code then you will get option to copy there

import streamlit as st
def main():
    st.title("Copy Paste in streamlit")
    pathinput = st.text_input("Enter your Path:")
    #you can place your path instead
    Path = f'''{pathinput}'''
    st.code(Path, language="python")
    st.markdown("Now you get option to copy")
if __name__ == "__main__":main()

here in this example you can get copy option

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.