Streamlit

Embed a Streamlit data app on any web application

Streamlit is a platform for building and sharing data apps written in Python. With PixieBrix, you can embed a Streamlit data app on any web page or application. Additionally, you can pass context to the page to the Streamlit app.

Embedding a Streamlit App

The Streamlit Community Cloud does not support embedding private Streamlit apps

PixieBrix supports embedding a Streamlit app via an iframe. To embed a Streamlit app:

  1. Create a new Mod Component with the "Sidebar Panel" starter brick

  2. Remove the Render Document Brick

  3. Add the IFrame brick

  4. Provide the URL for the public app with ?embed=true appended to the URL. (Providing the embed parameter removes excess UI and padding from the app)

Embed Options

Public Streamlit apps embedded via an iframe support the following embed options to customize the UI of the embed. To provide an embed option, provide one or more embed_options query parameters with the iframe URL:

  • show_toolbar

  • show_padding

  • show_footer

  • show_colored_line

  • hide_loading_screen

  • disable_scrolling

  • light_theme

  • dark_theme

You can use the Streamlit app's menu to create an embed link.

Passing Page Context to a Streamlit App

Page Context is passed to Streamlit via URL query parameters. To accept URL query parameters in your Streamlit app, use Streamlit's st.query_params utility.

For example:

inputs = st.query_params.to_dict()
st.title(f'URL param demo: {inputs.get("first_key")}')

In PixieBrix, use the Construct URL brick to construct a URL given the parameters. Provide the constructed URL to the IFrame brick:

Last updated