How to create horizontal scrollbar into a st.text_area?

Hello,
I have a big text and i want to create a horizontal scrollbar in my text_area.

I’m not sure if this is the behavior you’re looking for, but you could turn off line wrapping via css, which automatically gives you a horizontal scrollbar

import streamlit as st

st.text_area("My text here", value="Default text" * 100, height=100)

st.markdown(
    """
<style>
textarea {
    white-space: nowrap;
}
""",
    unsafe_allow_html=True,
)

Perfect !

Thank You.

Hi blackary,

How i can create a horizontal scrollbar into st.markdown ?

st.markdown(mybigtext,unsafe_allow_html=True)

Here’s one way

import streamlit as st

st.write(
    """
<p style="max-width: 400px; white-space: nowrap; overflow: auto;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tempor tristique turpis. Maecenas congue ligula ac odio sollicitudin lorem. Maecenas congue ligula ac odio sollicitudin. Donec tempor tristique turpis. Maecenas congue ligula ac odio sollicitudin lorem. Maecenas congue ligula ac odio sollicitudin. Donec tempor tristique turpis. Maecenas congue ligula ac odio sollicitudin
</br>
lorem. Maecenas congue ligula ac odio sollicitudin. Donec tempor tristique turpis. Maecenas congue ligula ac odio sollicitudin
</br>
lorem. Maecenas congue ligula ac odio sollicitudin. Donec tempor tristique turpis. Maecenas congue ligula ac odio sollicitudin
</br>
lorem. Maecenas congue ligula ac odio sollicitudin. Donec tempor tristique turpis. Maecenas congue ligula ac odio sollicitudin
</br>
</p>
    """,
    unsafe_allow_html=True,
)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.