TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/whitphx/stlite/llms.txt
Use this file to discover all available pages before exploring further.
<streamlit-app> custom element lets you embed a Streamlit app entirely in HTML markup without writing any JavaScript. Once the @stlite/browser script is loaded, the browser automatically detects the tag, parses its children, and mounts the app onto the page. Under the hood it is a thin wrapper around the mount() function, so every feature available in mount() can also be expressed through the custom element syntax.
Basic usage — inline Python
Write your Python code directly as the text content of<streamlit-app>. The runtime treats the content as the main script (streamlit_app.py) and runs it immediately.
Loading from a URL
Use thesrc attribute to load the main script from an external file. Both absolute and relative URLs are accepted. When src is present, any inline text content is ignored.
The filename is inferred from the URL path (e.g.
app.py from /path/to/app.py). If the URL does not end in .py, the entry point falls back to streamlit_app.py.Multi-file apps — <app-file>
For apps that span multiple Python files, use <app-file> child elements. Each <app-file> must have a name attribute. Mark exactly one file as the entry point with the entrypoint attribute — the runtime will call streamlit run on that file.
Adding a config.toml file
Pass .streamlit/config.toml as an <app-file> to configure Streamlit settings declaratively.
Loading a file from a URL via <app-file url="...">
<app-file> also accepts a url attribute to fetch the file content from a remote URL instead of embedding it inline.
encoding attribute on <app-file>
When loading a file via url, you can pass an optional encoding attribute. The value is forwarded to Emscripten’s FS.writeFile() as the encoding option (e.g. "utf8" or "binary").
Installing packages — <app-requirements>
List the Python packages your app needs inside an <app-requirements> tag — one package per line, using the same syntax as requirements.txt. Multiple <app-requirements> blocks are merged together.
Loading archives — <app-archive>
Use <app-archive> to fetch a zip or tar archive, unpack it, and mount its contents onto the virtual file system. The url and format attributes are both required.
SharedWorker mode
By default every<streamlit-app> element runs its Python environment in a dedicated worker. If you embed many apps on the same page, this can consume significant memory. Add the shared-worker boolean attribute to run all apps in a single shared worker instead.
Multipage apps
Provide multiple page scripts underpages/ to create a multipage Streamlit app.