Is there a command to draw a horizotnal black line to separate parts of the app?
Or, is there a way to automatically put horizontal black lines between container objects.
You can do this with html components.
Something like
components.html("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """)
Similarly, if color customization is not essential, without the need for components
you can go with plain Markdown
import streamlit as st
text = '''
I am above line
---
I am below line
'''
st.markdown(text)
I get an error âcomponents not definedâ.
I also tried it with st.html and my_container.html and got an error (module âstreamlitâ has no attribute âhtmlâ)
Ah yes, you have to import the streamlit components bitâŠ
import streamlit.components.v1 as components
st.markdown("""---""")
You need to write it like this:
st.markdown("""<hr style="height:10px;border:none;color:#333;background-color:#333;" /> """, unsafe_allow_html=True)
Thank you man, you just made my day!
You could probably try the emoji route too:
st.write("" * 34) # horizontal separator line. Just change 34 as needed.
Cheers
They added the cleaner st.divider()
method since the original post.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.