How to make your Streamlit app Shine?
— Python, Streamlit, Data — 1 min read
Finding weird stuff on the Internet is not a new thing, but here I am only talking about weird SEO stuff while doing it's (SEO) work. This is what this article is about, the FWS!
Give some still to your app with titles
Let's start simple: titles. What better way to give some style and shine to your webapp than to get some orders and put some titles, header and subheaders.
First it's like in SEO: only one title that will be the equivalent of you
<title> tag and you
<h1> tag. So at the start of your Python script use this
1st.title('Your shinny title')
After that, you could get the equivalent of
<h2> tags thanks to the
1st.header('Your shinny header')
And if you wanna go a little deeper, let's use the
1st.subheader('Your shinny sub header')
Selections could make your app shine
st.multiselect() you could let your users select defined variables, directly on the UI.
You can even let then add something in a text box with
st.text_input('Shinny search?') and the script that runs the app could help them find what they are looking for. You can think of anything ... and it's compatible with REGEX 🏎 🌎
Using the sidebar
I must say that one of my favorite stuff is adding elements in the sidebar, not just for adding them, but mostly to help the user understand the app and make some selection.
Usually I use an "How to" section and all the selector we just saw. And the best thing is that the code nearly change, you just have to add
.sidebar inside the existing
st streamlit fuction you created. Let's see some examples:
1st.sidebar.header('Your sidebar shinny header')2st.sidebar.subheader('Your sidebar shinny sub header')3st.sidebar.text('Your shinny text on the sidebar')4st.sidebar.markdown('Your **Shinny** _Markdown_ on the sidebar')5st.sidebar.selectbox('Select only one', ['Shine', 'Shinny'])6st.sidebar.multiselect('Choose several', ['Sun', 'Streamlit', 'You', 'SOS'])
Not satisfied with my list of shinny things for your Streamlit app? It's okay
If you want other tips, there is still the Cheat Sheet from Streamlit that could help you achieve great thing ... and shine (or let your app shine): https://docs.streamlit.io/library/cheatsheet
See you soon for another Streamlit tip!