How to add emoji to a button

st.button("Click ME - " + str(i+1))

How do I add a emoji in my button?

Hi @Hiba_Fatima :wave:

You should be able to copy+paste your favorite emojis to the label argument for st.button like so:

import streamlit

st.button("Click Me 👈")


I’ve used sites like Get Emoji and Emoji Finder search for emojis.

Here’s a fun, reproducible example where the emoji used in st.button updates with every click. It makes use of Streamlit’s Session State API and callbacks:

import streamlit as st
import random

# callback to update emojis in Session State
# in response to the on_click event
def random_emoji():
    st.session_state.emoji = random.choice(emojis)

# initialize emoji as a Session State variable
if "emoji" not in st.session_state:
    st.session_state.emoji = "👈"

emojis = ["🐶", "🐱", "🐭", "🐹", "🐰", "🦊", "🐻", "🐼"]

st.button(f"Click Me {st.session_state.emoji}", on_click=random_emoji)


Happy Streamlit’ing! :balloon: