DocumentationsearchSearchrocket_launchGet startedInstallationaddFundamentalsaddFirst stepsaddcodeDevelopConceptsaddAPI referenceremovePAGE ELEMENTSWrite and magicaddText elementsremoveHEADINGS & BODYst.titlest.headerst.subheaderst.markdownFORMATTED TEXTst.captionst.codest.dividerst.echost.latexst.textData elementsaddChart elementsaddInput widgetsaddMedia elementsaddLayouts and containersaddChat elementsaddStatus elementsaddThird-party componentsopen_in_newAPPLICATION LOGICNavigation and pagesaddExecution flowaddCaching and stateaddConnections and secretsaddCustom componentsaddUtilitiesaddConfigurationaddTOOLSApp testingaddCommand lineaddTutorialsaddQuick referenceaddweb_assetDeployConceptsaddStreamlit Community CloudaddStreamlit in Snowflakeopen_in_newOther platformsaddschoolKnowledge baseFAQInstalling dependenciesDeployment issuesHome/Develop/API reference/Text elementsText elements
Streamlit apps usually start with a call to st.title to set the
app's title. After that, there are 2 heading levels you can use:
st.header and st.subheader.
Pure text is entered with st.text, and Markdown with
st.markdown.
We also offer a "swiss-army knife" command called st.write, which accepts
multiple arguments, and multiple data types. And as described above, you can
also use magic commands in place of st.write.
Headings and body text
MarkdownDisplay string formatted as Markdown.st.markdown("Hello **world**!")
TitleDisplay text in title formatting.st.title("The app title")
HeaderDisplay text in header formatting.st.header("This is a header")
SubheaderDisplay text in subheader formatting.st.subheader("This is a subheader")

Formatted text
CaptionDisplay text in small font.st.caption("This is written small caption text")
Code blockDisplay a code block with optional syntax highlighting.st.code("a = 1234")
EchoDisplay some code on the app, then execute it. Useful for tutorials.with st.echo():
  st.write('This code will be printed')
Preformatted textWrite fixed-width and preformatted text.st.text("Hello world")
LaTeXDisplay mathematical expressions formatted as LaTeX.st.latex("\int a x^2 \,dx")
DividerDisplay a horizontal rule.st.divider()

Third-party componentsThese are featured components created by our lovely community. If you don't see what you're looking for, check out our Components Hub app and Streamlit Extras for more examples and inspiration! PreviousTagsAdd tags to your Streamlit apps. Created by @gagan3012.st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1')
NLUApply text mining on a dataframe. Created by @JohnSnowLabs.nlu.load('sentiment').predict('I love NLU! <3')
Streamlit ExtrasA library with useful Streamlit extras. Created by @arnaudmiribel.mention(label="An awesome Streamlit App", icon="streamlit",  url="https://extras.streamlit.app",)
Annotated textDisplay annotated text in Streamlit apps. Created by @tvst.annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".")
Drawable CanvasProvides a sketching canvas using Fabric.js. Created by @andfanilo.st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",)
TagsAdd tags to your Streamlit apps. Created by @gagan3012.st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1')
NLUApply text mining on a dataframe. Created by @JohnSnowLabs.nlu.load('sentiment').predict('I love NLU! <3')
Streamlit ExtrasA library with useful Streamlit extras. Created by @arnaudmiribel.mention(label="An awesome Streamlit App", icon="streamlit",  url="https://extras.streamlit.app",)
Annotated textDisplay annotated text in Streamlit apps. Created by @tvst.annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".")
Drawable CanvasProvides a sketching canvas using Fabric.js. Created by @andfanilo.st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",)
TagsAdd tags to your Streamlit apps. Created by @gagan3012.st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1')
NLUApply text mining on a dataframe. Created by @JohnSnowLabs.nlu.load('sentiment').predict('I love NLU! <3')
Streamlit ExtrasA library with useful Streamlit extras. Created by @arnaudmiribel.mention(label="An awesome Streamlit App", icon="streamlit",  url="https://extras.streamlit.app",)
 NextPrevious: Write and magicNext: st.titleforumStill have questions?Our forums are full of helpful information and Streamlit experts.HomeContact UsCommunity© 2024 Snowflake Inc.Cookie policy