Streamlit Cheat Sheet

Streamlit is an open-source Python library that allows developers to create interactive web applications with ease. It is designed to simplify the process of building data-driven applications by providing a simple and intuitive interface for creating visualizations, dashboards, and other interactive components.

With Streamlit, developers can quickly create and deploy web applications without having to worry about the underlying infrastructure. The library provides a range of built-in components that can be used to create interactive charts, tables, and other visualizations, as well as tools for handling user input and managing data.

This cheat sheet provides an overview of the most commonly used Streamlit commands and functions.

Basic Streamlit Commands

streamlit run <filename>Runs a Streamlit app from the command line
streamlit helloRuns the Streamlit “”Hello, World!”” app
streamlit --helpDisplays the Streamlit help menu
streamlit versionDisplays the current version of Streamlit

Streamlit Layout

st.title('Title')Displays a title
st.header('Header')Displays a header
st.subheader('Subheader')Displays a subheader
st.text('Text')Displays text
st.markdown('Markdown')Displays Markdown
st.latex('Latex')Displays Latex
st.write('Text')Displays text, data, or plots
st.code('Code')Displays code
st.error('Error message')Displays an error message
st.warning('Warning message')Displays a warning message
st.success('Success message')Displays a success message'Info message')Displays an info message
st.empty()Creates an empty space
st.sidebarCreates a sidebar

Streamlit Input

st.button('Button')Displays a button
st.checkbox('Checkbox')Displays a checkbox'Radio', options)Displays a radio button
st.selectbox('Select', options)Displays a dropdown menu
st.multiselect('Multiselect', options)Displays a multiselect dropdown menu
st.slider('Slider', min_value, max_value, value)Displays a slider
st.text_input('Text input')Displays a text input
st.number_input('Number input')Displays a number input
st.text_area('Text area')Displays a text area
st.date_input('Date input')Displays a date input
st.time_input('Time input')Displays a time input
st.file_uploader('File uploader')Displays a file uploader

Streamlit Output

st.image('Image')Displays an image'Audio')Displays an audio file'Video')Displays a video file
st.pyplot(fig)Displays a Matplotlib plot
st.altair_chart(chart)Displays an Altair chart
st.bokeh_chart(chart)Displays a Bokeh chart
st.plotly_chart(chart)Displays a Plotly chart a map
st.dataframe(data)Displays a Pandas dataframe
st.table(data)Displays a table

Streamlit Deployment

streamlit deploy <filename>Deploys a Streamlit app to the web
streamlit loginLogs in to Streamlit
streamlit logoutLogs out of Streamlit
streamlit sharing listLists all deployed Streamlit apps
streamlit sharing delete <app_name>Deletes a deployed Streamlit app

Streamlit Resources