Streamlit

Embed a Streamlit data app on any web application.

Streamlit is a platform for building and sharing data apps written in Pythonarrow-up-right. 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.

30 Days of Streamlit app in the PixieBrix sidebar

Embedding a Streamlit App

circle-exclamation

PixieBrix supports embedding a Streamlit app via an iframearrow-up-right. 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)

Configuring a Sidebar mod to display a public Streamlit app

Embed Options

Public Streamlit apps embedded via an iframe support the following embed options to customize the UI of the embedarrow-up-right. 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 linkarrow-up-right.

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 utilityarrow-up-right.

For example:

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

Constructing a Streamlit app URL in PixieBrix

Last updated

Was this helpful?