Streamlit Extras
Streamlit Extras is a community-driven collection of useful Streamlit components and utilities designed to extend Streamlit's core functionality. It provides a wide range of 'extras' for common UI patterns, interactivity, and backend integrations that are not natively available in Streamlit. The library is actively maintained with frequent minor releases adding new features and fixing bugs, currently at version 1.4.1.
Warnings
- breaking Version 1.0.0 introduced a significant repository re-architecture to support Streamlit Custom Components v2 (CCv2). While many existing extras might still function, users who built custom components or heavily integrated with `streamlit-extras` internals prior to v1.0.0 may need to update their code.
- deprecated The `st_theme` extra was deprecated. Streamlit now offers robust native theming options.
- gotcha Each extra often has specific usage patterns and, in some cases, implicit dependencies. Not all extras are suitable for all Streamlit deployment environments (e.g., some might rely on specific browser features or client-side JavaScript that could be limited in certain embedded contexts).
- gotcha Due to the community-driven nature, new extras are added frequently, and existing ones may evolve. The API surface can be dynamic.
Install
-
pip install streamlit-extras
Imports
- stylable_container
from streamlit_extras.stylable_container import stylable_container
- no_footer
from streamlit_extras.no_footer import no_footer
- st_theme
This extra is deprecated; consider using native Streamlit theme options or custom CSS.
Quickstart
import streamlit as st
from streamlit_extras.stylable_container import stylable_container
from streamlit_extras.no_footer import no_footer
from streamlit_extras.badges import badge
st.set_page_config(layout="centered")
st.title("Streamlit Extras Quickstart")
with stylable_container(
key="my_stylable_container",
css_styles="""
{
border: 2px solid #4CAF50;
border-radius: 10px;
padding: 15px;
margin-bottom: 20px;
}
"""
):
st.subheader("A Stylable Section")
st.write("This content is wrapped in a container with custom CSS.")
st.button("Hello from inside!")
badge(type="info", text="Powered by Streamlit Extras")
# Example of removing Streamlit's default footer
no_footer()