I don’t know whether this is an expected behavior or not, but it seems that the ‘format_func’ parameter (used to modify the text displayed as an option) behaves differently depending on the widget.
More precisely, it supports emojis and symbols when used in a st.pills, but not in a st.multiselect.
Here is a minimal reproducible example :
st.pills("Test", [10, 20, 30], format_func=lambda value: f"{value} :coffee:", default=20)
st.multiselect("Test", [10, 20, 30], format_func=lambda value: f"{value} :coffee:", default=20)
I’d like to know if this is a bug or not. Thank you.
Streamlit 1.41.0 / Python 3.13
edsaac
January 14, 2025, 2:13pm
2
I was able to reproduce and I think it’s a bug. Passing the actual emoji does work though.
st.pills(
"Test",
[10, 20, 30],
format_func=lambda value: f"{value} :coffee:",
default=20,
)
st.multiselect(
"Does not render emojis correctly",
[10, 20, 30],
format_func=lambda value: f"{value} :coffee:",
default=[10, 20, 30],
)
st.multiselect(
"This works though",
[10, 20, 30],
format_func=lambda value: f"{value} ☕",
default=[10, 20, 30],
)
I think it’s a bug because emoji shortcodes should work for all widgets:
opened 07:59PM - 15 Jul 21 UTC
closed 04:49PM - 12 Nov 22 UTC
type:enhancement
feature:markdown
Current Emoji ico codes are working but not shortcodes.
---
Community voti… ng on feature requests enables the Streamlit team to understand which features are most important to our users.
**If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.**
Thank you for confirming.
Passing the actual emoji indeed works. However there doesn’t seem to be a workaround for Google’s Material Symbols.
I have the same (or another?) problem with st.markdown when using unsafe_allow_html=True :
st.markdown("anytext<p>:coffee:</p>", unsafe_allow_html=True)
→ emoji is rendered
st.markdown("<p>:coffee:</p>", unsafe_allow_html=True)
→ emoji is not rendered
Google’s Material Symbols are not rendered in anyway.
There is a PR open to fix this for Selectbox here: [WIP] Allow markdown in the options of `st.selectbox` and `st.multiselect` by jrieke · Pull Request #10086 · streamlit/streamlit · GitHub
The current open issue is here if you want to upvote it:
opened 03:48PM - 01 Oct 23 UTC
type:enhancement
feature:st.radio
feature:st.selectbox
### Checklist
- [X] I have searched the [existing issues](https://github.com/… streamlit/streamlit/issues) for similar feature requests.
- [X] I added a descriptive title and summary to this issue.
### Summary
Selectbox label can render markdown text (from #863), but options can't.
Options are only plain text.
It would be very useful if options text could be markdown, hltml or latex data.
This feature was requested previously in #1140, but was marked as duplicated of #863 and it isn't.
### Why?
Because if options can reder markdown text (or html/latex), they can be more descriptive, containing for example, images, multiline info with italic o bold text, etc.
### How?
```python
import streamlit as st
d = st.selectbox('Select appropiate data', options=['data\n\n**element 1**: description *important*', 'data\n\n**element 2**: other option'])
```
### Additional Context
Initial feature request: #1140.
system
Closed
August 12, 2025, 5:27pm
5
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.