Just a quick update: we’re making progress on Custom Components (i.e. plugins). This will unlock a lot of use-cases brought up in this thread — and we even have a little Folium plugin example working internally. Just give us time to finish this work and open up our beta
If I were to venture a guess, I’d say we’re around 1.5 months away from the beta. But don’t quote me on that
I had a go at building a third-party library to allow the primary accent colour to be changed in a way that plays nicely with streamlit (i.e. CSS only). It took quite a while to figure out all of the classes that needed to be overridden.
Unfortunately I hit a roadblock when it came to the BaseUI components. I couldn’t find a way to override those styles without changing the React variables and rebuilding the whole frontend (which requires more memory than is available on my humble dev VPS!).
Looking forward to official support for theming… I can at least see now why it’s a little way off!
I’m also using HTML right now to support downloading of a data table.
def get_table_download_link(df, file_name):
"""Generates a link allowing the data in a given panda dataframe to be downloaded
in: dataframe
out: href string
"""
csv = df.to_csv(index=True)
b64 = base64.b64encode(
csv.encode()
).decode() # some strings <-> bytes conversions necessary here
href = f'<a href="data:file/csv;base64,{b64}">Download ' + file_name + "</a>"
return href
That is the code block that I’ve been using recently.
I am a Persian native speaker and some times I need to write in Persian. Persian is an RTL language. I use <p dir="rtl">some Persian text (یه کم متن فارسی)</p> to write Persian.
Arabic and Hebrew are also RTL languages like Persian.
I want to horizontally align a company logo using st.image and a team name in text. If anyone has anyone suggestions on how to do that then that would be very helpful!
Hello,
I am trying to put two different coloured box around two different text in the same line. I know that currently a dedicated feature is not available. But as is visible in the twitter link you have attached she has somehow managed to do this. So could anyone please tell me how see was able to do that. I went through her git code but couldn’t figure out how:").
This is what I tried:
HTML_l = “”“
Total: {}
”""
HTML_r = “”“
Total: {}
”""
st.write((HTML_l.format(‘text1’),HTML_r.format(‘text2’)),unsafe_allow_html=True)
But didn’t work out
I’d like to show the output of tk.keras.model_summary, which includes multiple spaces on each line to ensure the various elements align. st.write collapses contiguous whitespace chars to a single one, and this messes up the display. Example output is
If I surround each string with <pre>... </pre> and use the unsafe_allow_html=True option, this whitespace gets preserved, otherwise collapsing whitespaces creates an unreadable/misaligned output
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.