import streamlit as st import urllib.parse def main(): st.title("Text Copy Demo") # Create a text input text_to_copy = st.text_input("Enter text to copy:", "Hello, World!") # Encode the text for URL encoded_text = urllib.parse.quote(text_to_copy) # You'll need to replace this with your actual hosted HTML file URL hosted_html_file = "https://your-domain.com/copy.html" iframe_url = f"{hosted_html_file}?copy={encoded_text}" # Create the iframe with some styling st.markdown( f""" """, unsafe_allow_html=True ) # Add some instructions st.markdown(""" ### Instructions: 1. Enter your text in the input field above 2. Click the clipboard button to copy the text 3. The button will show a checkmark when the text is copied """) if __name__ == "__main__": main()