Does a text output widget exist?

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?

Thank you

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.

Hi Debbie,

I appreciate the info. I’m brand new to streamlit so I’ll have to read up on creating my own components.

Is there a means by which streamlit takes requests for the consideration of these sorts of improvements?

You can also build your output with HTML and put that into st.markdown to make it look how you want

For example:

title = f'<p style="text-align: center; font-weight: bold;"><a href="{link}">Title</p>'
st.markdown(title, unsafe_allow_html=True)

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.