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

CommandDescription
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

CommandDescription
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
st.info('Info message')Displays an info message
st.empty()Creates an empty space
st.sidebarCreates a sidebar

Streamlit Input

CommandDescription
st.button('Button')Displays a button
st.checkbox('Checkbox')Displays a checkbox
st.radio('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

CommandDescription
st.image('Image')Displays an image
st.audio('Audio')Displays an audio file
st.video('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
st.map(data)Displays a map
st.dataframe(data)Displays a Pandas dataframe
st.table(data)Displays a table

Streamlit Deployment

CommandDescription
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