import streamlit as st
if st.button(“Click me”):
with st.expander(“Details”):
# Input field for name
name = st.text_input(“Name:”, “”)
# Input field for address
address = st.text_input("Address:", "")
# Display the entered details
if name and address:
st.success(f"Entered Details: \nName: {name}\nAddress: {address}")
else:
st.warning("Please enter both name and address.")
st.markdown(
“”"
button {
background: none!important;
border: none;
padding: 0!important;
color: black !important;
text-decoration: none;
cursor: pointer;
border: none !important;
}
button:hover {
text-decoration: none;
color: black !important;
}
button:focus {
outline: none !important;
box-shadow: none !important;
color: black !important;
}
“”",
unsafe_allow_html=True,
)
Hi @suraj1529
Are you looking for something like this?
import streamlit as st
def button(*args, key=None, **kwargs):
if key is None: raise ValueError("Missing button key")
if key not in st.session_state: st.session_state[key] = False
if st.button(*args, **kwargs):
st.session_state[key] = not st.session_state[key]
st.rerun()
return st.session_state[key]
if button("Click me", key="btnkey"):
with st.expander("Details", True):
name = st.text_input("Name:", "")
address = st.text_input("Address:", "")
if name and address: st.success(f"Entered Details: \nName: {name}\nAddress: {address}")
else: st.warning("Please enter both name and address.")
Cheers
Hi @Shawn_Pereira
Yes , But instead of “Click Me” button i want to use “Click Me” Clickable Text.
Well, streamlit does not have this option natively (not that I know of).
You could either use CSS to remove the borders of the button, so that it looks like text OR import a library that allows you to run javascript along with event handlers (which will be available on pypi);
Cheers