# Streamlit

{% embed url="<https://www.youtube.com/watch?v=bYQPjvKVnUw>" %}

Streamlit is [a platform for building and sharing data apps written in Python](https://streamlit.io/). 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.

<figure><img src="/files/rZYZVICMsnoHpGxVl0Ot" alt=""><figcaption><p>30 Days of Streamlit app in the PixieBrix sidebar</p></figcaption></figure>

### Embedding a Streamlit App

{% hint style="warning" %}
The Streamlit Community Cloud does not support embedding private Streamlit apps
{% endhint %}

PixieBrix supports embedding a [Streamlit app via an iframe](https://docs.streamlit.io/streamlit-community-cloud/share-your-app/embed-your-app#embedding-with-iframes). 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)

<figure><img src="/files/xyhExOh24DH87j6WZAqa" alt=""><figcaption><p>Configuring a Sidebar mod to display a public Streamlit app</p></figcaption></figure>

#### Embed Options

Public Streamlit apps embedded via an iframe support the following [embed options to customize the UI of the embed](https://docs.streamlit.io/streamlit-community-cloud/share-your-app/embed-your-app#embed-options). To provide an embed option, provide one or more `embed_options` query parameters with the iframe URL:&#x20;

* 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](https://docs.streamlit.io/streamlit-community-cloud/share-your-app/embed-your-app#build-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](https://docs.streamlit.io/library/api-reference/utilities/st.query_params).

For example:

```python
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:

<figure><img src="/files/NXJJBTNUB8vpuiaHgWy1" alt=""><figcaption><p>Constructing a Streamlit app URL in PixieBrix</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pixiebrix.com/integrations/streamlit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
