I am developing a streamlit app on snowflake. In general, it gets data from the db then displays it for users to view and interact with (I know, this describes every app).
My issue is, I am using text_input widgets to actually display output because it looks nicer than just printing it to the screen as markdown. The label and input box serve to visually organize and separate different pieces of output in a nice way. It reminds me of a JTextField from Java Swing, which is the framework I am migrating my app from.
Of course, the problem is that text_inputs all act like inputs, and display “press enter to apply”, and are always editable. I don’t want any of that for just displaying output. I know I can set them as disabled, but then they are all grayed out and don’t look very good.
My question is: does there exist anywhere a sort of “text_output” widget (or widget-like thing), that would have the look and feel of a text_input but none of the functionality, other than displaying a string (or markdown)? If not, would it be possible to create such a thing?
Short answer, no, not as part of the library. (There is st.code, but that doesn’t exactly match what you’ve described.)
You could build or look for a custom component to do exactly what you describe.
Or, you could use other elements (like containers with borders, st.code, and/or formatted Markdown) to create the visual separations you want. e.g. Don’t just put the output directly into Markdown, build a Markdown string from your output that includes a label, highlighted text, etc.
Thank you for the example. But I don’t think this is a good solution for my use case. I’m trying to avoid using plain markdown because I want the look and feel of text boxes holding the output of my app.
There is nothing built-in that will give you that (I don’t think it is a common request), but you can customize your text output to your heart’s content using html and css.
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.