I see that there’s no feature to right justify st.chat_message() for ‘user’ prompts. The 3rd party component, streamlit-chat, has this feature.
Is there a work-around?
I see that there’s no feature to right justify st.chat_message() for ‘user’ prompts. The 3rd party component, streamlit-chat, has this feature.
Is there a work-around?
The code below should do the trick. I also found this CSS hacking tut very helpful, which should help you be able to apply this anything you want more generally.
import streamlit as st
st.markdown(
"""
<style>
.stChatMessage {
text-align: right;
}
</style>
""",
unsafe_allow_html=True,
)
with st.chat_message("user"):
st.write("Hello 👋")
st.write("I'm on the right 👋")