How to trigger on_click on image

Hi @Hugo_Lavezac,

Recent sombody asked a similar qustion about how to do different stlyes for buttons.
I guess there several ways to make it happen (in the future). This is what i came up with:

  1. make components stackable:
 img = Image.open("images/top_spiderman.png")
st.button(st.image(img))

or

  1. add styling and classes to the streamlit compoents :
 st.button("add" , **styles,  **classes)
 enabling  to do: 
 st.button("add" , img=img,  bold=True)


st.markdown("""
<style>
.bold{
  background-color: yellow;
}
</style>
""")
  1. I guess you could also write your own button component.
5 Likes