Hi folks,
I’m using the text_input widget, it’s default behavior is representing the typed text in Left to Right direction (which legit for the English language).
But in my case, I expect the user to insert not an English text - but a Right 2 Left direction text, which seems very strange when it viewed in the opposite way.
Any flag or workaround to avoid it?
Thanks!
1 Like
Hi @Daniel_Juravski,
Looks like you can do this as a workaround.
import streamlit as st
st.markdown("""
<style>
input {
unicode-bidi:bidi-override;
direction: RTL;
}
</style>
""", unsafe_allow_html=True)
i1 = st.text_input("text input 1")
st.write('value 1: "', i1, '"')
Feel free to file a feature request if you feel it’s needed!
2 Likes
Hi @Jonathan_Rhone,
That worked like a magic!
Thanks!
Hi @Jonathan_Rhone, this is a great tip. Thanks!
I would like to apply RTL style to the output. What code should work?
Thanks in advance for your support.
Hi @mzeidhassan,
import streamlit as st
st.markdown("""
<style>
input, .rtl {
unicode-bidi:bidi-override;
direction: RTL;
}
</style>
""", unsafe_allow_html=True)
text = st.text_input("text input")
st.markdown('<div class="rtl">%s</div>' % text, unsafe_allow_html=True)
1 Like