File size: 1,873 Bytes
12d891e
d796104
8d2f0ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73d7e50
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import streamlit as st

# Define the HTML and CSS for the cloud-shaped button and text field
cloud_button_html = """
<style>
  .cloud-button {
    background-color: #FFCC99;
    border: none;
    color: white;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    transition-duration: 0.4s;
    cursor: pointer;
    border-radius: 16px;
    box-shadow: 0 6px 6px 0 rgba(0, 0, 0, 0.24), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    position: relative;
  }

  .cloud-button:after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    border-width: 0 15px 10px 15px;
    border-style: solid;
    border-color: #FFCC99 transparent transparent transparent;
    margin-left: -15px;
    margin-top: -2px;
  }

  .text-field {
    border: none;
    background: transparent;
    color: #333;
    width: 100%;
    text-align: center;
  }
</style>
<div style="text-align: center; margin-top: 20px;">
    <button class="cloud-button" onclick="handleClick()">
        <input type="text" value="this is a text field" class="text-field" readonly />
    </button>
</div>
<script>
function handleClick() {
    const outputDiv = document.getElementById('output');
    if(outputDiv) {
        outputDiv.innerText = 'success';
    }
}
</script>
"""

# Render the cloud button with Streamlit
st.markdown(cloud_button_html, unsafe_allow_html=True)

# Placeholder for the output text
output = st.empty()

# Update the output text when the button is clicked
if "button_clicked" not in st.session_state:
    st.session_state["button_clicked"] = False

if st.session_state["button_clicked"]:
    output.text("success")

# Button click handler
with st.form(key="my_form"):
    submit_button = st.button("Click me!")
    if submit_button:
        st.session_state["button_clicked"] = True