Selectbox widget R2L language

Hi,

I use selectbox for selecting a desired sentence.
The thing is that my sentences are in R2L language, so I used the below markdown to represent them in R2L way in the drop-down list, so far so good.
But when I choose a sentence, it is presented (L2R) not as the way it does on the list (R2L).

import streamlit as st

if __name__ == '__main__':
    st.markdown("""<style>
                div[role="listbox"] ul {
                    direction: RTL;
                    text-align: right;
                    } </style>""", unsafe_allow_html=True)

    selected = st.selectbox("select", ["", "R2L text01", "R2L text02", "R2L text03"])

How should I do it?

Many thanks!

Hey @Daniel_Juravski, thanks for your patience.

I’m not sure I’m understanding the question exactly. Is the suggestion that we might need to add a direction keyword to st.selectbox?

Hi @Daniel_Juravski, you need to open the chrome developer tools and experiment with modifying the CSS on various elements related to the widget you want to modify.

The following snippet combined with your code above should do the trick.

    st.markdown("""<style>
                div[data-baseweb="select"] {
                    direction: RTL;
                } </style>""", unsafe_allow_html=True)
1 Like

Looks like we have an open issue for this as well: