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.")
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.")
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);