From ec90b095fa26ca5f97f6a45f4326e74b361ca01f Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 14:37:48 +0200 Subject: [PATCH 01/15] Add 1.62.0 release notes Co-authored-by: Cursor --- .../quick-references/release-notes/2026.md | 47 +++++++++++ .../quick-references/release-notes/_index.md | 79 +++++++++---------- 2 files changed, 83 insertions(+), 43 deletions(-) diff --git a/content/develop/quick-references/release-notes/2026.md b/content/develop/quick-references/release-notes/2026.md index 372d326db..5312fcda3 100644 --- a/content/develop/quick-references/release-notes/2026.md +++ b/content/develop/quick-references/release-notes/2026.md @@ -9,6 +9,53 @@ keywords: changelog, release notes, version history This page contains release notes for Streamlit versions released in 2026. For the latest version of Streamlit, see [Release notes](/develop/quick-reference/release-notes). +## **Version 1.62.0** + +_Release date: August 19, 2026_ + +**Highlights** + +- ✨ Introducing `streamlit.typing` (also available as `st.typing`), a public namespace for annotating Streamlit-owned types like `UploadedFile`, `DataframeState`, and `DataEditorState` ([#16295](https://github.com/streamlit/streamlit/pull/16295), [#16275](https://github.com/streamlit/streamlit/pull/16275), [#16351](https://github.com/streamlit/streamlit/pull/16351), [#7801](https://github.com/streamlit/streamlit/issues/7801)). +- πŸ“ Introducing wrap control for horizontal layouts and widgets. A new `wrap` parameter keeps columns, containers, and labels on one row instead of wrapping: + - [`st.columns`](/develop/api-reference/layout/st.columns) `wrap=False` disables stacking on narrow viewports ([#16367](https://github.com/streamlit/streamlit/pull/16367), [#5003](https://github.com/streamlit/streamlit/issues/5003), [#2313](https://github.com/streamlit/streamlit/issues/2313)). + - [`st.container`](/develop/api-reference/layout/st.container) `wrap=False` keeps a horizontal container in a single scrolling row ([#16484](https://github.com/streamlit/streamlit/pull/16484), [#9544](https://github.com/streamlit/streamlit/issues/9544), [#12582](https://github.com/streamlit/streamlit/issues/12582)). + - Button-like elements (`st.button`, `st.download_button`, `st.link_button`, `st.form_submit_button`, `st.popover`, and `st.menu_button`) can ellipsize overflowing labels ([#16325](https://github.com/streamlit/streamlit/pull/16325)). + - [`st.checkbox`](/develop/api-reference/widgets/st.checkbox) and [`st.toggle`](/develop/api-reference/widgets/st.toggle) can keep their labels on one row ([#16470](https://github.com/streamlit/streamlit/pull/16470)). + - [`st.multiselect`](/develop/api-reference/widgets/st.multiselect) keeps selected chips in a single scrolling row ([#16509](https://github.com/streamlit/streamlit/pull/16509), [#12644](https://github.com/streamlit/streamlit/issues/12644)). + +**Notable Changes** + +- 🎯 [`st.text_input`](/develop/api-reference/widgets/st.text_input) adds `email`, `url`, `phone`, and `search` types, plus a `validate` parameter for client-side regex checks ([#16385](https://github.com/streamlit/streamlit/pull/16385), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#8790](https://github.com/streamlit/streamlit/issues/8790)). +- πŸ“… [`st.date_input`](/develop/api-reference/widgets/st.date_input) has been rebuilt with accessible segmented fields and keyboard calendar navigation ([#16460](https://github.com/streamlit/streamlit/pull/16460), [#7865](https://github.com/streamlit/streamlit/issues/7865), [#8556](https://github.com/streamlit/streamlit/issues/8556)). +- ⏱ [`st.datetime_input`](/develop/api-reference/widgets/st.datetime_input) uses the same segmented editor, with a time row in the calendar popover ([#16501](https://github.com/streamlit/streamlit/pull/16501), [#16502](https://github.com/streamlit/streamlit/pull/16502)). +- 🎨 Chart color theme options (`chartCategoricalColors`, `chartSequentialColors`, and `chartDivergingColors`) can now be set in `theme.light`, `theme.dark`, and sidebar sections ([#16357](https://github.com/streamlit/streamlit/pull/16357), [#16355](https://github.com/streamlit/streamlit/issues/16355)). +- πŸ”€ Theme font weights now accept 50-step values like 150 or 550 ([#16396](https://github.com/streamlit/streamlit/pull/16396), [#16354](https://github.com/streamlit/streamlit/issues/16354)). +- 🧠 When Streamlit raises an error during local development, an "Install skills" callout appears below the exception if agent skills aren't installed ([#15693](https://github.com/streamlit/streamlit/pull/15693)). +- βš™ New `runner.cacheHashSeed` config option lets you change the sample used when hashing large cached objects ([#16284](https://github.com/streamlit/streamlit/pull/16284), [#14622](https://github.com/streamlit/streamlit/issues/14622)). +- πŸ‘» **Breaking change:** The deprecated `st.cache` command has been removed. Use [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) or [`st.cache_resource`](/develop/api-reference/caching-and-state/st.cache_resource) instead ([#15787](https://github.com/streamlit/streamlit/pull/15787)). +- ❌ **Breaking change:** [`st.pyplot`](/develop/api-reference/charts/st.pyplot) now requires a figure. Calling it without one no longer uses Matplotlib's global figure ([#16464](https://github.com/streamlit/streamlit/pull/16464)). +- ☠️ **Breaking change:** Passing Matplotlib `savefig` keyword arguments to `st.pyplot` is deprecated. Save the figure and pass it to `st.image` instead ([#16450](https://github.com/streamlit/streamlit/pull/16450)). + +**Other Changes** + +- πŸ› Bug fix: `st.popover` contents stay within narrow and embedded viewports ([#16173](https://github.com/streamlit/streamlit/pull/16173), [#9340](https://github.com/streamlit/streamlit/issues/9340)). +- πŸ¦‹ Bug fix: `st.pyplot` supports `format="svg"` without crashing ([#16283](https://github.com/streamlit/streamlit/pull/16283), [#11489](https://github.com/streamlit/streamlit/issues/11489)). +- πŸͺ² Bug fix: Heading anchors update when heading text changes on rerun ([#16286](https://github.com/streamlit/streamlit/pull/16286), [#8793](https://github.com/streamlit/streamlit/issues/8793)). +- 🐜 Bug fix: Altair charts rebuilt with `alt.Chart.from_json` keep their inline data ([#16288](https://github.com/streamlit/streamlit/pull/16288), [#6269](https://github.com/streamlit/streamlit/issues/6269)). +- 🐝 Bug fix: Nested fragments with `run_every` no longer duplicate widgets when an ancestor rerun already rendered them ([#16314](https://github.com/streamlit/streamlit/pull/16314), [#10719](https://github.com/streamlit/streamlit/issues/10719)). +- 🐞 Bug fix: Hashing falls back to MD5 on FIPS builds where BLAKE2b rejects a custom digest size ([#16324](https://github.com/streamlit/streamlit/pull/16324), [#15148](https://github.com/streamlit/streamlit/issues/15148)). +- πŸ•·οΈ Bug fix: A malformed WebSocket `BackMsg` closes the connection instead of sending a traceback to the browser ([#16392](https://github.com/streamlit/streamlit/pull/16392), [#16391](https://github.com/streamlit/streamlit/issues/16391)). +- πŸͺ³ Bug fix: The `server.enableCORS=false` startup warning no longer claims CORS is overridden to true ([#16393](https://github.com/streamlit/streamlit/pull/16393), [#16390](https://github.com/streamlit/streamlit/issues/16390)). +- πŸͺ° Bug fix: Derived `codeBackgroundColor` and `dataframeHeaderBackgroundColor` follow a custom background instead of the base theme ([#16401](https://github.com/streamlit/streamlit/pull/16401), [#16398](https://github.com/streamlit/streamlit/issues/16398)). +- 🦠 Bug fix: `st.slider` rejects date and time bounds outside the frontend-safe range instead of snapping silently ([#16475](https://github.com/streamlit/streamlit/pull/16475), [#16474](https://github.com/streamlit/streamlit/issues/16474)). +- 🦟 Bug fix: `st.toast` is preserved when `st.rerun()` follows immediately after ([#16498](https://github.com/streamlit/streamlit/pull/16498), [#7740](https://github.com/streamlit/streamlit/issues/7740)). +- πŸ¦‚ Bug fix: `st.color_picker` is interactive inside `st.dialog` again ([#16541](https://github.com/streamlit/streamlit/pull/16541), [#16538](https://github.com/streamlit/streamlit/issues/16538)). +- πŸ¦— Bug fix: `st.metric` sparklines reappear after chart data goes empty and is later populated ([#16543](https://github.com/streamlit/streamlit/pull/16543), [#16539](https://github.com/streamlit/streamlit/issues/16539)). +- πŸ•ΈοΈ Bug fix: `st.date_input` and `st.datetime_input` no longer overflow in narrow containers, and the calendar marks today ([#16565](https://github.com/streamlit/streamlit/pull/16565)). +- πŸ“ `st.table` uses 14px font to match other widgets ([#16397](https://github.com/streamlit/streamlit/pull/16397), [#16389](https://github.com/streamlit/streamlit/issues/16389)). +- πŸ“¦ Streamlit no longer depends on `tenacity` ([#16497](https://github.com/streamlit/streamlit/pull/16497)). +- πŸ”Œ Streamlit is compatible with Starlette 1.4+ after gzip middleware updates ([#16344](https://github.com/streamlit/streamlit/pull/16344), [#16462](https://github.com/streamlit/streamlit/pull/16462), [#16341](https://github.com/streamlit/streamlit/issues/16341)). + ## **Version 1.61.0** _Release date: August 4, 2026_ diff --git a/content/develop/quick-references/release-notes/_index.md b/content/develop/quick-references/release-notes/_index.md index 69150194f..3013f9ef6 100644 --- a/content/develop/quick-references/release-notes/_index.md +++ b/content/develop/quick-references/release-notes/_index.md @@ -21,59 +21,52 @@ pip install --upgrade streamlit -## **Version 1.61.0 (latest)** +## **Version 1.62.0 (latest)** -_Release date: August 4, 2026_ +_Release date: August 19, 2026_ **Highlights** -- ⚑ Introducing lazy loading for [`st.dataframe`](/develop/api-reference/data/st.dataframe): large dataframes now load their rows on demand automatically, so the browser stays responsive. A new `lazy` parameter lets you turn this on or off explicitly, and Polars `LazyFrame` objects are supported natively ([#15756](https://github.com/streamlit/streamlit/pull/15756)). -- 🍿 [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) and [`st.cache_resource`](/develop/api-reference/caching-and-state/st.cache_resource) have a new `refresh_mode="background"` option that refreshes expired cache values in the background, so your app keeps serving the previous value without waiting ([#16057](https://github.com/streamlit/streamlit/pull/16057), [#5871](https://github.com/streamlit/streamlit/issues/5871)). +- ✨ Introducing `streamlit.typing` (also available as `st.typing`), a public namespace for annotating Streamlit-owned types like `UploadedFile`, `DataframeState`, and `DataEditorState` ([#16295](https://github.com/streamlit/streamlit/pull/16295), [#16275](https://github.com/streamlit/streamlit/pull/16275), [#16351](https://github.com/streamlit/streamlit/pull/16351), [#7801](https://github.com/streamlit/streamlit/issues/7801)). +- πŸ“ Introducing wrap control for horizontal layouts and widgets. A new `wrap` parameter keeps columns, containers, and labels on one row instead of wrapping: + - [`st.columns`](/develop/api-reference/layout/st.columns) `wrap=False` disables stacking on narrow viewports ([#16367](https://github.com/streamlit/streamlit/pull/16367), [#5003](https://github.com/streamlit/streamlit/issues/5003), [#2313](https://github.com/streamlit/streamlit/issues/2313)). + - [`st.container`](/develop/api-reference/layout/st.container) `wrap=False` keeps a horizontal container in a single scrolling row ([#16484](https://github.com/streamlit/streamlit/pull/16484), [#9544](https://github.com/streamlit/streamlit/issues/9544), [#12582](https://github.com/streamlit/streamlit/issues/12582)). + - Button-like elements (`st.button`, `st.download_button`, `st.link_button`, `st.form_submit_button`, `st.popover`, and `st.menu_button`) can ellipsize overflowing labels ([#16325](https://github.com/streamlit/streamlit/pull/16325)). + - [`st.checkbox`](/develop/api-reference/widgets/st.checkbox) and [`st.toggle`](/develop/api-reference/widgets/st.toggle) can keep their labels on one row ([#16470](https://github.com/streamlit/streamlit/pull/16470)). + - [`st.multiselect`](/develop/api-reference/widgets/st.multiselect) keeps selected chips in a single scrolling row ([#16509](https://github.com/streamlit/streamlit/pull/16509), [#12644](https://github.com/streamlit/streamlit/issues/12644)). **Notable Changes** -- 🎯 [`st.metric`](/develop/api-reference/data/st.metric) has a new `icon` parameter to display an icon next to the metric label ([#15805](https://github.com/streamlit/streamlit/pull/15805), [#12298](https://github.com/streamlit/streamlit/issues/12298)). -- ⏱ [`st.time_input`](/develop/api-reference/widgets/st.time_input) received a major revamp with editable time segments, a new `format` parameter to control the hour cycle (12-hour, 24-hour, or localized), seconds granularity when `step` is under 60 seconds, paste support, and improved form behavior with Enter-to-submit ([#16126](https://github.com/streamlit/streamlit/pull/16126), [#16128](https://github.com/streamlit/streamlit/pull/16128), [#16096](https://github.com/streamlit/streamlit/pull/16096), [#15647](https://github.com/streamlit/streamlit/pull/15647), [#6423](https://github.com/streamlit/streamlit/issues/6423), [#8234](https://github.com/streamlit/streamlit/issues/8234)). -- πŸ‘₯ [`st.multiselect`](/develop/api-reference/widgets/st.multiselect) has improved tag accessibility, including keyboard navigation between tags and WAI-ARIA-aligned dropdown focus ([#16200](https://github.com/streamlit/streamlit/pull/16200), [#16109](https://github.com/streamlit/streamlit/issues/16109)). -- πŸ“₯ [`st.download_button`](/develop/api-reference/widgets/st.download_button) now infers a missing `file_name` and `mime` from a file object's name when you pass data opened from disk ([#16061](https://github.com/streamlit/streamlit/pull/16061)). Thanks, [SoMika00](https://github.com/SoMika00)! -- πŸšͺ [`st.Page`](/develop/api-reference/navigation/st.page) is now a proper class, so `isinstance(page, st.Page)` behaves as expected (`StreamlitPage` remains a backward-compatible alias) ([#16268](https://github.com/streamlit/streamlit/pull/16268)). -- πŸ”’ New `server.allowedHosts` config option lets deployments with known hostnames restrict incoming WebSocket handshakes ([#16147](https://github.com/streamlit/streamlit/pull/16147)). -- πŸ›‘ The `disabled` widget parameter is now enforced server-side, so a disabled widget never accepts a value from the browser ([#16209](https://github.com/streamlit/streamlit/pull/16209)). -- πŸ‘» **Breaking change:** The deprecated `use_column_width` parameter has been removed from [`st.image`](/develop/api-reference/media/st.image). Use the `width` parameter instead ([#15786](https://github.com/streamlit/streamlit/pull/15786)). -- ☠️ **Breaking change:** Passing local file paths as strings to [`st.html`](/develop/api-reference/utilities/st.html) and [`st.iframe`](/develop/api-reference/utilities/st.iframe) is deprecated. Use a `pathlib.Path` object to load local files instead ([#16150](https://github.com/streamlit/streamlit/pull/16150)). +- 🎯 [`st.text_input`](/develop/api-reference/widgets/st.text_input) adds `email`, `url`, `phone`, and `search` types, plus a `validate` parameter for client-side regex checks ([#16385](https://github.com/streamlit/streamlit/pull/16385), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#8790](https://github.com/streamlit/streamlit/issues/8790)). +- πŸ“… [`st.date_input`](/develop/api-reference/widgets/st.date_input) has been rebuilt with accessible segmented fields and keyboard calendar navigation ([#16460](https://github.com/streamlit/streamlit/pull/16460), [#7865](https://github.com/streamlit/streamlit/issues/7865), [#8556](https://github.com/streamlit/streamlit/issues/8556)). +- ⏱ [`st.datetime_input`](/develop/api-reference/widgets/st.datetime_input) uses the same segmented editor, with a time row in the calendar popover ([#16501](https://github.com/streamlit/streamlit/pull/16501), [#16502](https://github.com/streamlit/streamlit/pull/16502)). +- 🎨 Chart color theme options (`chartCategoricalColors`, `chartSequentialColors`, and `chartDivergingColors`) can now be set in `theme.light`, `theme.dark`, and sidebar sections ([#16357](https://github.com/streamlit/streamlit/pull/16357), [#16355](https://github.com/streamlit/streamlit/issues/16355)). +- πŸ”€ Theme font weights now accept 50-step values like 150 or 550 ([#16396](https://github.com/streamlit/streamlit/pull/16396), [#16354](https://github.com/streamlit/streamlit/issues/16354)). +- 🧠 When Streamlit raises an error during local development, an "Install skills" callout appears below the exception if agent skills aren't installed ([#15693](https://github.com/streamlit/streamlit/pull/15693)). +- βš™ New `runner.cacheHashSeed` config option lets you change the sample used when hashing large cached objects ([#16284](https://github.com/streamlit/streamlit/pull/16284), [#14622](https://github.com/streamlit/streamlit/issues/14622)). +- πŸ‘» **Breaking change:** The deprecated `st.cache` command has been removed. Use [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) or [`st.cache_resource`](/develop/api-reference/caching-and-state/st.cache_resource) instead ([#15787](https://github.com/streamlit/streamlit/pull/15787)). +- ❌ **Breaking change:** [`st.pyplot`](/develop/api-reference/charts/st.pyplot) now requires a figure. Calling it without one no longer uses Matplotlib's global figure ([#16464](https://github.com/streamlit/streamlit/pull/16464)). +- ☠️ **Breaking change:** Passing Matplotlib `savefig` keyword arguments to `st.pyplot` is deprecated. Save the figure and pass it to `st.image` instead ([#16450](https://github.com/streamlit/streamlit/pull/16450)). **Other Changes** -- πŸ› Bug fix: `AppTest` now converts a script file path to its parent directory before adding it to `sys.path` ([#15775](https://github.com/streamlit/streamlit/pull/15775)). Thanks, [ishaanlabs-gg](https://github.com/ishaanlabs-gg)! -- πŸ¦‹ Bug fix: An unclean WebSocket close now reconnects to the existing session, preserving widget values, `st.session_state`, and run count instead of restarting the app ([#15909](https://github.com/streamlit/streamlit/pull/15909), [#8901](https://github.com/streamlit/streamlit/issues/8901)). -- πŸͺ² Bug fix: The in-app "install skills" nudge is now suppressed when an install would only conflict, and reports why ([#15966](https://github.com/streamlit/streamlit/pull/15966)). -- 🐜 Bug fix: `st.selectbox` fuzzy search matches non-contiguous substrings again, fixing a regression since 1.59.0 ([#16009](https://github.com/streamlit/streamlit/pull/16009), [#16003](https://github.com/streamlit/streamlit/issues/16003)). Thanks, [LuC-9](https://github.com/LuC-9)! -- 🐝 Bug fix: `st.popover` placed inside `st.sidebar` no longer renders off-screen ([#16087](https://github.com/streamlit/streamlit/pull/16087), [#9387](https://github.com/streamlit/streamlit/issues/9387)). -- 🐞 Bug fix: Pressing Escape in `st.selectbox` now clears the typed search query and restores the committed label ([#16088](https://github.com/streamlit/streamlit/pull/16088), [#16004](https://github.com/streamlit/streamlit/issues/16004)). -- πŸ•·οΈ Bug fix: `st.bar_chart` and other built-in charts no longer fail on column names containing a `.` ([#16089](https://github.com/streamlit/streamlit/pull/16089), [#7714](https://github.com/streamlit/streamlit/issues/7714)). -- πŸͺ³ Bug fix: `st.expander` no longer stays clipped after a rapid open/close interaction interrupts its animation ([#16090](https://github.com/streamlit/streamlit/pull/16090), [#16027](https://github.com/streamlit/streamlit/issues/16027)). -- πŸͺ° Bug fix: Right-side padding is preserved when a `st.code` block is scrolled horizontally to the end ([#16091](https://github.com/streamlit/streamlit/pull/16091), [#8206](https://github.com/streamlit/streamlit/issues/8206)). -- 🦠 Bug fix: `AppTest` multipage path handling is now deterministic and better documented ([#16122](https://github.com/streamlit/streamlit/pull/16122), [#8429](https://github.com/streamlit/streamlit/issues/8429), [#8154](https://github.com/streamlit/streamlit/issues/8154)). -- 🦟 Bug fix: `AppTest` now clears stale elements on each rerun, so its element tree no longer accumulates duplicate widgets from earlier runs ([#16123](https://github.com/streamlit/streamlit/pull/16123), [#9128](https://github.com/streamlit/streamlit/issues/9128), [#12566](https://github.com/streamlit/streamlit/issues/12566)). -- πŸ¦‚ Bug fix: An open `st.data_editor` cell edit is now committed when you click outside the grid ([#16132](https://github.com/streamlit/streamlit/pull/16132), [#7868](https://github.com/streamlit/streamlit/issues/7868)). -- πŸ¦— Bug fix: `@st.fragment(run_every=...)` no longer raises a `TypeError` when Sentry's threading integration is enabled ([#16140](https://github.com/streamlit/streamlit/pull/16140), [#16139](https://github.com/streamlit/streamlit/issues/16139)). -- πŸ•ΈοΈ Bug fix: `st.data_editor` row additions no longer silently overwrite existing rows for non-`RangeIndex` DataFrames ([#16144](https://github.com/streamlit/streamlit/pull/16144)). -- 🐌 Bug fix: `st.Page` now rejects network paths and null bytes before touching the filesystem ([#16146](https://github.com/streamlit/streamlit/pull/16146)). -- 🦎 Bug fix: Mermaid config keys hardened by Streamlit can no longer be overridden by inline `%%{init}%%` directives in diagram source ([#16151](https://github.com/streamlit/streamlit/pull/16151)). -- πŸ¦€ Bug fix: The `st.multiselect` dropdown background now matches the sidebar theme ([#16163](https://github.com/streamlit/streamlit/pull/16163), [#11348](https://github.com/streamlit/streamlit/issues/11348)). -- πŸ‘½ Bug fix: Plotly Sankey charts now honor layout fonts set via `fig.update_layout(font=...)` ([#16164](https://github.com/streamlit/streamlit/pull/16164), [#11031](https://github.com/streamlit/streamlit/issues/11031)). -- πŸ‘» Bug fix: `st.data_editor` `NumberColumn` now preserves IME composition, so CJK input is no longer cut off after the first composed digit ([#16165](https://github.com/streamlit/streamlit/pull/16165), [#16129](https://github.com/streamlit/streamlit/issues/16129)). -- πŸ› Bug fix: A dataframe header background configured with an alpha channel now renders stably instead of shifting color on hover ([#16166](https://github.com/streamlit/streamlit/pull/16166), [#11950](https://github.com/streamlit/streamlit/issues/11950)). -- πŸ¦‹ Bug fix: Downloading an Altair/Vega-Lite chart as PNG now respects display DPI for a higher-resolution export ([#16170](https://github.com/streamlit/streamlit/pull/16170), [#8177](https://github.com/streamlit/streamlit/issues/8177)). -- πŸͺ² Bug fix: Fragments nested inside a shared container no longer lose their children after the enclosing parent fragment reruns ([#16171](https://github.com/streamlit/streamlit/pull/16171), [#12514](https://github.com/streamlit/streamlit/issues/12514)). -- 🐜 Bug fix: An `st.selectbox` near the bottom of the sidebar now flips its dropdown up instead of clipping past the viewport ([#16199](https://github.com/streamlit/streamlit/pull/16199), [#16181](https://github.com/streamlit/streamlit/issues/16181)). -- 🐝 Bug fix: `st.help` no longer shows "page.run()" as the header in multipage apps ([#16244](https://github.com/streamlit/streamlit/pull/16244), [#11430](https://github.com/streamlit/streamlit/issues/11430)). -- 🐞 Bug fix: `st.pills` and `st.segmented_control` keep the current selection highlighted when a `format_func` changes an option's label between reruns ([#16271](https://github.com/streamlit/streamlit/pull/16271), [#16269](https://github.com/streamlit/streamlit/issues/16269)). -- πŸ•·οΈ Bug fix: `st.download_button` now accepts `io.StringIO` data as documented ([#16272](https://github.com/streamlit/streamlit/pull/16272), [#16270](https://github.com/streamlit/streamlit/issues/16270)). -- πŸͺ³ Bug fix: Port auto-increment is restored on Windows, so a second `streamlit run` no longer binds an in-use port ([#16315](https://github.com/streamlit/streamlit/pull/16315), [#16296](https://github.com/streamlit/streamlit/issues/16296)). -- πŸͺ° Bug fix: An `st.status` opened on a container declared outside a fragment no longer blanks the app ([#16316](https://github.com/streamlit/streamlit/pull/16316), [#16281](https://github.com/streamlit/streamlit/issues/16281)). -- 🦠 Bug fix: The host message guard again accepts same-window self-posts, restoring embedded Streamlit-in-Snowflake auth delivery ([#16327](https://github.com/streamlit/streamlit/pull/16327)). -- πŸ“¦ Streamlit no longer depends on GitPython and inspects local repositories via the `git` CLI instead ([#16241](https://github.com/streamlit/streamlit/pull/16241)). +- πŸ› Bug fix: `st.popover` contents stay within narrow and embedded viewports ([#16173](https://github.com/streamlit/streamlit/pull/16173), [#9340](https://github.com/streamlit/streamlit/issues/9340)). +- πŸ¦‹ Bug fix: `st.pyplot` supports `format="svg"` without crashing ([#16283](https://github.com/streamlit/streamlit/pull/16283), [#11489](https://github.com/streamlit/streamlit/issues/11489)). +- πŸͺ² Bug fix: Heading anchors update when heading text changes on rerun ([#16286](https://github.com/streamlit/streamlit/pull/16286), [#8793](https://github.com/streamlit/streamlit/issues/8793)). +- 🐜 Bug fix: Altair charts rebuilt with `alt.Chart.from_json` keep their inline data ([#16288](https://github.com/streamlit/streamlit/pull/16288), [#6269](https://github.com/streamlit/streamlit/issues/6269)). +- 🐝 Bug fix: Nested fragments with `run_every` no longer duplicate widgets when an ancestor rerun already rendered them ([#16314](https://github.com/streamlit/streamlit/pull/16314), [#10719](https://github.com/streamlit/streamlit/issues/10719)). +- 🐞 Bug fix: Hashing falls back to MD5 on FIPS builds where BLAKE2b rejects a custom digest size ([#16324](https://github.com/streamlit/streamlit/pull/16324), [#15148](https://github.com/streamlit/streamlit/issues/15148)). +- πŸ•·οΈ Bug fix: A malformed WebSocket `BackMsg` closes the connection instead of sending a traceback to the browser ([#16392](https://github.com/streamlit/streamlit/pull/16392), [#16391](https://github.com/streamlit/streamlit/issues/16391)). +- πŸͺ³ Bug fix: The `server.enableCORS=false` startup warning no longer claims CORS is overridden to true ([#16393](https://github.com/streamlit/streamlit/pull/16393), [#16390](https://github.com/streamlit/streamlit/issues/16390)). +- πŸͺ° Bug fix: Derived `codeBackgroundColor` and `dataframeHeaderBackgroundColor` follow a custom background instead of the base theme ([#16401](https://github.com/streamlit/streamlit/pull/16401), [#16398](https://github.com/streamlit/streamlit/issues/16398)). +- 🦠 Bug fix: `st.slider` rejects date and time bounds outside the frontend-safe range instead of snapping silently ([#16475](https://github.com/streamlit/streamlit/pull/16475), [#16474](https://github.com/streamlit/streamlit/issues/16474)). +- 🦟 Bug fix: `st.toast` is preserved when `st.rerun()` follows immediately after ([#16498](https://github.com/streamlit/streamlit/pull/16498), [#7740](https://github.com/streamlit/streamlit/issues/7740)). +- πŸ¦‚ Bug fix: `st.color_picker` is interactive inside `st.dialog` again ([#16541](https://github.com/streamlit/streamlit/pull/16541), [#16538](https://github.com/streamlit/streamlit/issues/16538)). +- πŸ¦— Bug fix: `st.metric` sparklines reappear after chart data goes empty and is later populated ([#16543](https://github.com/streamlit/streamlit/pull/16543), [#16539](https://github.com/streamlit/streamlit/issues/16539)). +- πŸ•ΈοΈ Bug fix: `st.date_input` and `st.datetime_input` no longer overflow in narrow containers, and the calendar marks today ([#16565](https://github.com/streamlit/streamlit/pull/16565)). +- πŸ“ `st.table` uses 14px font to match other widgets ([#16397](https://github.com/streamlit/streamlit/pull/16397), [#16389](https://github.com/streamlit/streamlit/issues/16389)). +- πŸ“¦ Streamlit no longer depends on `tenacity` ([#16497](https://github.com/streamlit/streamlit/pull/16497)). +- πŸ”Œ Streamlit is compatible with Starlette 1.4+ after gzip middleware updates ([#16344](https://github.com/streamlit/streamlit/pull/16344), [#16462](https://github.com/streamlit/streamlit/pull/16462), [#16341](https://github.com/streamlit/streamlit/issues/16341)). ## Older versions of Streamlit From 531942b661d8b89c20f1970e36a8ca934ea9392a Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 14:37:52 +0200 Subject: [PATCH 02/15] Generate docstrings for Streamlit 1.62.0 Co-authored-by: Cursor --- python/generate.py | 7 +- python/streamlit.json | 15291 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 15295 insertions(+), 3 deletions(-) diff --git a/python/generate.py b/python/generate.py index 3dc07518f..65c0d1e24 100644 --- a/python/generate.py +++ b/python/generate.py @@ -30,6 +30,7 @@ from streamlit.elements.vega_charts import VegaLiteState from streamlit.elements.arrow import DataframeState, DataframeSelectionState from streamlit.elements.deck_gl_json_chart import PydeckState, PydeckSelectionState +from streamlit.elements.widgets.data_editor import DataEditorState from streamlit.elements.lib.mutable_expander_container import ExpanderContainer from streamlit.elements.lib.mutable_popover_container import PopoverContainer from streamlit.elements.lib.mutable_tab_container import TabContainer @@ -547,9 +548,8 @@ def get_obj_docstring_dict(obj, key_prefix, signature_prefix, only_include=None) # memo and singleton are callable objects rather than functions # See: https://github.com/streamlit/streamlit/pull/4263 - # Replace the member with its decorator object except st.cache - # which is deprecated - while (member in streamlit.runtime.caching.__dict__.values() and member != streamlit.cache): + # Replace the member with its decorator object + while member in streamlit.runtime.caching.__dict__.values(): member = member._decorator # Create the full name of the member using key_prefix and membername @@ -651,6 +651,7 @@ def get_streamlit_docstring_dict(): VegaLiteState: ["VegaLiteState", "VegaLiteState"], DataframeState: ["DataframeState", "DataframeState"], DataframeSelectionState: ["DataframeSelectionState", "DataframeSelectionState"], + DataEditorState: ["DataEditorState", "DataEditorState"], PydeckState: ["PydeckState", "PydeckState"], PydeckSelectionState: ["PydeckSelectionState", "PydeckSelectionState"], BidiComponentResult: ["BidiComponentResult", "BidiComponentResult"], diff --git a/python/streamlit.json b/python/streamlit.json index 9e4751c9d..4913fa52b 100644 --- a/python/streamlit.json +++ b/python/streamlit.json @@ -417459,5 +417459,15296 @@ "is_class": true, "is_interface": true } + }, + "1.62.0": { + "streamlit.App": { + "name": "App", + "signature": "st.App(script_path, *, secrets=None, lifespan=None, routes=None, middleware=None, on_script_error=None, exception_handlers=None, debug=False)", + "is_class": true, + "methods": [ + { + "name": "lifespan", + "signature": "st.lifespan.lifespan()", + "examples": "

Mount st.App on FastAPI:

\n
\nfrom fastapi import FastAPI\nimport streamlit as st\n\nstreamlit_app = st.App("dashboard.py")\nfastapi_app = FastAPI(lifespan=streamlit_app.lifespan())\nfastapi_app.mount("/dashboard", streamlit_app)\n
\n", + "description": "

Get a lifespan context manager for mounting on external ASGI frameworks.

", + "args": [], + "returns": [ + { + "type_name": "Callable[[Any], AbstractAsyncContextManager[None]]", + "is_generator": false, + "description": "

A lifespan context manager compatible with Starlette/FastAPI.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/web/server/starlette/starlette_app.py#L617" + }, + { + "name": "run", + "signature": "st.run.run(*, config=None)", + "examples": "

Launch a launcher module directly with python app.py:

\n
\nimport streamlit as st\n\napp = st.App("dashboard.py")\n\nif __name__ == "__main__":\n    app.run()\n
\n

Pin server settings so the launcher is fully self-contained:

\n
\nif __name__ == "__main__":\n    app.run(config={"server.port": 8502, "server.address": "0.0.0.0"})\n
\n

A launcher run with uv run app.py can include its dependencies in\nthe script:

\n

# /// script\n# dependencies = [\n# "streamlit",\n# ]\n# ///\nimport streamlit as st

\n

app = st.App("dashboard.py")

\n
\n
if __name__ == "__main__":
\n
app.run()
\n
\n", + "description": "

Start a local Streamlit server for this app and block until stopped.

", + "args": [ + { + "name": "config", + "type_name": "Mapping[str, Any] or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Config option overrides, keyed by dotted config name (e.g.\n{"server.port": 8502}). This is the programmatic equivalent of\nthe config flags accepted by streamlit run. Sensitive options and\nunknown options are rejected. If this is None (default), config\ncomes from config.toml and environment variables as usual.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/web/server/starlette/starlette_app.py#L516" + } + ], + "properties": [ + { + "name": "script_path", + "signature": "st.script_path.script_path", + "description": "

The entry point script path.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/web/server/starlette/starlette_app.py#L506" + }, + { + "name": "state", + "signature": "st.state.state", + "description": "

Application state, populated by lifespan context manager.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/web/server/starlette/starlette_app.py#L511" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/web/server/starlette/starlette_app.py#L282", + "examples": "

Basic usage:

\n
\nimport streamlit as st\napp = st.App("main.py")\n
\n

With lifespan hooks:

\n
\nfrom contextlib import asynccontextmanager\nimport streamlit as st\n\n@asynccontextmanager\nasync def lifespan(app):\n    print("Starting up...")\n    yield {"model": "loaded"}\n    print("Shutting down...")\n\napp = st.App("main.py", lifespan=lifespan)\n
\n

With custom routes:

\n
\nimport streamlit as st\nfrom starlette.routing import Route\nfrom starlette.responses import JSONResponse\n\nasync def health(request):\n    return JSONResponse({"status": "ok"})\n\napp = st.App("main.py", routes=[Route("/health", health)])\n
\n

With programmatic secrets:

\n
\nimport os\nimport streamlit as st\n\napp = st.App(\n    "main.py",\n    secrets={\n        "database": {\n            "host": os.environ["DB_HOST"],\n            "password": os.environ["DB_PASSWORD"],\n        }\n    },\n)\n
\n

With error monitoring (Sentry):

\n
\nimport sentry_sdk\nimport streamlit as st\n\nsentry_sdk.init(dsn="...")\n\ndef log_to_sentry(exc):\n    sentry_sdk.capture_exception(exc)\n    return None  # Show default exception display\n\napp = st.App("main.py", on_script_error=log_to_sentry)\n
\n

With custom error UI:

\n
\nimport streamlit as st\n\ndef custom_error_handler(exc):\n    st.error("Something went wrong!")\n    return True  # Suppress default exception display\n\napp = st.App("main.py", on_script_error=custom_error_handler)\n
\n", + "description": "

ASGI-compatible Streamlit application.

\n
\n

Warning

\n

Hosting multiple App instances with different script_path values\nin the same process is not supported. The first App constructed in a\nprocess pins the script-level config directory (via the process-global\nconfig._main_script_path), and subsequent App instances will\nresolve relative script_path values against that first directory\nrather than the current working directory.

\n
\n

This class provides a way to configure and run Streamlit applications\nwith custom routes, middleware, lifespan hooks, and exception handlers.

\n", + "args": [ + { + "name": "script_path", + "type_name": "str | Path", + "is_optional": false, + "description": "

Path to the main Streamlit script. Can be absolute or relative. Relative\npaths are resolved based on context: when started via streamlit run,\nthey resolve relative to the main script; when started directly via uvicorn\nor another ASGI server, they resolve relative to the current working directory.

\n", + "default": null + }, + { + "name": "secrets", + "type_name": "Mapping[str, SecretsValue] | None", + "is_optional": false, + "description": "

A dictionary of secrets to make available via st.secrets. Supported\nvalue types are: str, int, float, bool, list, and nested\ndict. Lists and dicts are validated recursively, so their elements\nmust themselves be supported secrets types. When provided, these secrets\nare shallow-merged with file-based secrets (programmatic secrets override\nfile-based secrets at the top level). Unsupported types raise\nTypeError at construction.

\n", + "default": null + }, + { + "name": "lifespan", + "type_name": "Callable[[App], AbstractAsyncContextManager[dict[str, Any] | None]] | None", + "is_optional": false, + "description": "

Async context manager for startup/shutdown logic. The context manager\nreceives the App instance and can yield a dictionary of state that will\nbe accessible via app.state.

\n", + "default": null + }, + { + "name": "routes", + "type_name": "Sequence[BaseRoute] | None", + "is_optional": false, + "description": "

Additional routes to mount alongside Streamlit. User routes are checked\nagainst reserved Streamlit routes and will raise ValueError if they conflict.

\n", + "default": null + }, + { + "name": "middleware", + "type_name": "Sequence[Middleware] | None", + "is_optional": false, + "description": "

Middleware stack to apply to all requests. User middleware runs before\nStreamlit's internal middleware.

\n", + "default": null + }, + { + "name": "on_script_error", + "type_name": "Callable[[Exception], bool | None] | None", + "is_optional": false, + "description": "

Callback invoked when an uncaught exception occurs during script execution.\nThe callback receives the exception and can optionally return True to\nsuppress the default exception display in the UI, allowing custom error UI\nto be shown instead. Returns False or None to show the exception\nnormally. Useful for integrating with error monitoring services like Sentry.

\n

The handler is invoked for:

\n
    \n
  • Uncaught exceptions in the full app script
  • \n
  • Exceptions in widget callbacks (on_change, on_click, etc.)
  • \n
\n

The handler is NOT invoked for:

\n
    \n
  • st.stop() / st.rerun() (control flow, not errors)
  • \n
  • Syntax/compile errors in the script
  • \n
  • KeyboardInterrupt / SystemExit
  • \n
\n", + "default": "exception" + }, + { + "name": "exception_handlers", + "type_name": "Mapping[Any, ExceptionHandler] | None", + "is_optional": false, + "description": "

A mapping of either integer status codes, or exception class types onto\ncallables which handle the exceptions. Exception handler callables should\nbe of the form handler(request, exc) -> response and may be either\nstandard functions, or async functions. This is only for exception handling\non the network layer. Use on_script_error for customized handling of\nuncaught exceptions from the app script.

\n", + "default": null + }, + { + "name": "debug", + "type_name": "bool", + "is_optional": false, + "description": "

Enable debug mode for the underlying Starlette application.

\n", + "default": null + } + ], + "returns": [] + }, + "streamlit.Page": { + "name": "Page", + "signature": "st.Page(page, *, title=None, icon=None, url_path=None, default=False, visibility=\"visible\")", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.run.run()", + "description": "

Execute the page.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L446" + } + ], + "properties": [ + { + "name": "external_url", + "signature": "st.external_url.external_url", + "description": "

The external URL of the page, if this is an external link.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L438" + }, + { + "name": "icon", + "signature": "st.icon.icon", + "description": "

The icon of the page.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L393" + }, + { + "name": "is_external", + "signature": "st.is_external.is_external", + "description": "

Whether this page is an external URL.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L428" + }, + { + "name": "title", + "signature": "st.title.title", + "description": "

The title of the page.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L380" + }, + { + "name": "url_path", + "signature": "st.url_path.url_path", + "description": "

The page's URL pathname, which is the path relative to the app's root URL.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L401" + }, + { + "name": "visibility", + "signature": "st.visibility.visibility", + "description": "

The visibility of the page in the navigation menu.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L416" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L54", + "example": "
\nimport streamlit as st\n\ndef page2():\n    st.title("Second page")\n\npg = st.navigation([\n    st.Page("page1.py", title="First page", icon="\ud83d\udd25"),\n    st.Page(page2, title="Second page", icon=":material/favorite:"),\n    st.Page(\n        "https://docs.streamlit.io",\n        title="Streamlit Docs",\n        icon=":material/open_in_new:"\n    ),\n])\npg.run()\n
\n", + "description": "

Configure a page for st.navigation in a multipage app.

\n

Call st.Page to initialize a Page object, and pass it to\nst.navigation to declare a page in your app.

\n

When a user navigates to a page, st.navigation returns the selected\nPage object. Call .run() on the returned Page\nobject to execute the page. You can only run the page returned by\nst.navigation, and you can only run it once per app rerun.

\n

A page can be defined by a Python file, Callable, or external URL.

\n", + "args": [ + { + "name": "page", + "type_name": "str, Path, or callable", + "is_optional": false, + "description": "

The source for the internal or external page. This can be one of the\nfollowing values:

\n
    \n
  • callable: Streamlit executes the callable when it runs the page.\nThe callable can't accept arguments.
  • \n
  • Path to a Python file: Streamlit executes the Python script when it\nruns the page. The path can be a string or pathlib.Path\nobject. It can be absolute or relative to the entrypoint file.
  • \n
  • URL: Streamlit opens the URL in a new tab when a user selects it\nin the navigation menu or a page link. In this case, the app doesn't\nrerun. The URL must contain an HTTP or HTTPS scheme, like\n"https://docs.streamlit.io". If the page is defined by a URL,\nthen the title parameter is required.
  • \n
\n", + "default": null + }, + { + "name": "title", + "type_name": "str or None", + "is_optional": false, + "description": "

The title of the page. If this is None (default), the page title\n(in the browser tab) and label (in the navigation menu) will be\ninferred from the filename or callable name in page. For more\ninformation, see Overview of multipage apps.

\n

The title supports GitHub-flavored Markdown of the following types:\nBold, Italics, Strikethrough, Inline Code, and Images. Images display\nlike icons, with a max height equal to the font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional, supported\nMarkdown directives.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "description": "

An optional emoji or icon to display next to the page title and label.\nIf icon is None (default), no icon is displayed next to the\npage label in the navigation menu, and a Streamlit icon is displayed\nnext to the title (in the browser tab). If icon is a string, the\nfollowing options are valid:

\n
    \n
  • \n
    A single-character emoji. For example, you can set icon="\ud83d\udea8"
    \n

    or icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
    \n
    \n
  • \n
  • \n
    An icon from the Material Symbols library (rounded style) in the
    \n

    format ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
    \n
    \n
  • \n
  • "spinner": Displays a spinner as an icon. In this case, the\nspinner only displays next to the page label in the navigation menu.\nThe spinner isn't used as the page favicon next to the title in the\nbrowser tab. The favicon is the default Streamlit icon unless\notherwise specified with the page_icon parameter of\nst.set_page_config.

    \n
  • \n
\n", + "default": "Streamlit" + }, + { + "name": "url_path", + "type_name": "str or None", + "is_optional": false, + "description": "

The page's URL pathname, which is the path relative to the app's root\nURL. If this is None (default), the URL pathname will be inferred\nfrom the filename or callable name in page. For more information,\nsee Overview of multipage apps.

\n

The default page will have a pathname of "", indicating the root\nURL of the app. If you set default=True, url_path is ignored.\nurl_path can't include forward slashes; paths can't include\nsubdirectories.

\n", + "default": "page" + }, + { + "name": "default", + "type_name": "bool", + "is_optional": false, + "description": "

Whether this page is the default page to be shown when the app is\nloaded. If default is False (default), the page will have a\nnonempty URL pathname. However, if no default page is passed to\nst.navigation and this is the first page, this page will become the\ndefault page. If default is True, then the page will have\nan empty pathname and url_path will be ignored.

\n", + "default": "page" + }, + { + "name": "visibility", + "type_name": "\"visible\" or \"hidden\"", + "is_optional": false, + "description": "

Whether the page is shown in the navigation menu. If this is\n"visible" (default), the page appears in the navigation menu. If\nthis is "hidden", the page is excluded from the navigation menu.\nHidden pages defined by Python files or callables remain accessible\nby st.page_link and st.switch_page. External URLs can always\nbe accessed using st.page_link regardless of their inclusion or\nvisibility in the navigation menu.

\n
\n

Note

\n

Navigating to an internal page by URL starts a new session. For\nany internal page to be accessible by URL, it must be passed to\nst.navigation during the new session's initial script\nrun. The page can be visible or hidden.

\n
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str", + "is_optional": false, + "description": "

The icon of the page.

\n

If no icon was declared in st.Page, this property returns "".

\n", + "default": null + }, + { + "name": "title", + "type_name": "str", + "is_optional": false, + "description": "

The title of the page.

\n

Unless declared otherwise in st.Page, the page title is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.

\n

The title supports GitHub-flavored Markdown as described in st.Page.

\n", + "default": null + }, + { + "name": "url_path", + "type_name": "str", + "is_optional": false, + "description": "

The page's URL pathname, which is the path relative to the app's root\nURL.

\n

Unless declared otherwise in st.Page, the URL pathname is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.

\n

The default page will always have a url_path of "" to indicate\nthe root URL (e.g. homepage).

\n", + "default": "page" + }, + { + "name": "visibility", + "type_name": "Literal[\"visible\", \"hidden\"]", + "is_optional": false, + "description": "

Whether the page is shown in the navigation menu. If this is\n"visible" (default), the page appears in the navigation menu. If\nthis is "hidden", the page is excluded from the navigation menu.

\n

For internal pages, hidden pages remain accessible via direct URL,\nst.page_link, or st.switch_page. For external URL pages,\nhidden pages are not URL-accessible or switchable via\nst.switch_page; they can still be linked with st.page_link.

\n
\n

Note

\n

Navigating to an internal page by URL starts a new session.\nFor a hidden page to be accessible by URL, it must be passed\nto st.navigation during the new session's initial script\nrun.

\n
\n", + "default": null + } + ], + "returns": [] + }, + "streamlit.altair_chart": { + "name": "altair_chart", + "signature": "st.altair_chart(altair_chart, *, width=None, height=\"content\", use_container_width=None, theme=\"streamlit\", key=None, on_select=\"ignore\", selection_mode=None)", + "examples": "
\nimport altair as alt\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((60, 3)), columns=["a", "b", "c"])\n\nchart = (\n    alt.Chart(df)\n    .mark_circle()\n    .encode(x="a", y="b", size="c", color="c", tooltip=["a", "b", "c"])\n)\n\nst.altair_chart(chart)\n
\n", + "description": "

Display a chart using the Vega-Altair library.

\n

Vega-Altair is a declarative\nstatistical visualization library for Python, based on Vega and\nVega-Lite.

\n", + "args": [ + { + "name": "altair_chart", + "type_name": "altair.Chart", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The Altair chart object to display. See\nhttps://altair-viz.github.io/gallery/ for examples of graph\ndescriptions.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch": The width of the element matches the width of the\nparent container.

    \n
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.

    \n
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.

    \n
  • \n
  • None (default): Streamlit uses "stretch" for most charts,\nand uses "content" for the following multi-view charts:

    \n
    \n
      \n
    • Facet charts: the spec contains "facet" or encodings for\n"row", "column", or "facet".
    • \n
    • Horizontal concatenation charts: the spec contains\n"hconcat".
    • \n
    • Repeat charts: the spec contains "repeat".
    • \n
    • Nested composition charts: the spec contains "vconcat"\nwith nested "hconcat", "vconcat", "concat", or\n"layer" operators (e.g., scatter plots with marginal\nhistograms).
    • \n
    \n
    \n
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override the chart's native width with the width of\nthe parent container. This can be one of the following:

\n
    \n
  • None (default): Streamlit will use the parent container's\nwidth for all charts except those with known incompatibility\n(altair.Facet, altair.HConcatChart, and\naltair.RepeatChart).
  • \n
  • True: Streamlit sets the width of the chart to match the\nwidth of the parent container.
  • \n
  • False: Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of\nthe parent container.
  • \n
\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The theme of the chart. If theme is "streamlit" (default),\nStreamlit uses its own design default. If theme is None,\nStreamlit falls back to the default behavior of the library.

\n

The "streamlit" theme can be partially customized through the\nconfiguration options theme.chartCategoricalColors and\ntheme.chartSequentialColors. Font configuration options are\nalso applied.

\n", + "default": "behavior" + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string to use for giving this element a stable\nidentity. If this is None (default), the element's identity\nwill be determined based on the values of the other parameters.

\n

Additionally, if selections are activated and key is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only. For more\ndetails, see Widget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\", \"rerun\", or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the figure should respond to user selection events. This\ncontrols whether or not the figure behaves like an input widget.\non_select can be one of the following:

\n
    \n
  • "ignore" (default): Streamlit will not react to any selection\nevents in the chart. The figure will not behave like an input\nwidget.
  • \n
  • "rerun": Streamlit will rerun the app when the user selects\ndata in the chart. In this case, st.altair_chart will return\nthe selection data as a dictionary.
  • \n
  • A callable: Streamlit will rerun the app and execute the\ncallable as a callback function before the rest of the app.\nIn this case, st.altair_chart will return the selection data\nas a dictionary.
  • \n
\n

To use selection events, the object passed to altair_chart must\ninclude selection parameters. To learn about defining interactions\nin Altair and how to declare selection-type parameters, see\nInteractive Charts\nin Altair's documentation.

\n

For consistent selection output, especially in multi-view charts\n(layer, hconcat, vconcat, facet, repeat), specify fields or\nencodings in your selection, like\nalt.selection_point(fields=["Origin"]) or\nalt.selection_point(encodings=["x", "y"]). Without explicit\nfields, Vega may add an internal row identifier field (vgsid)\nto your data, and selections can then return this identifier\ninstead of your original data values.

\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "str or Iterable of str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The selection parameters Streamlit should use. If\nselection_mode is None (default), Streamlit will use all\nselection parameters defined in the chart's Altair spec.

\n

When Streamlit uses a selection parameter, selections from that\nparameter will trigger a rerun and be included in the selection\nstate. When Streamlit does not use a selection parameter,\nselections from that parameter will not trigger a rerun and not be\nincluded in the selection state.

\n

Selection parameters are identified by their name property.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or VegaLiteState", + "is_generator": false, + "description": "

If on_select is "ignore" (default), this command returns an\ninternal placeholder for the chart element. Otherwise, this command\nreturns a VegaLiteState object. This object is dictionary-like\nand supports both key and attribute notation. To use this type in\nan annotation, import it from streamlit.typing.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/vega_charts.py#L1801" + }, + "streamlit.area_chart": { + "name": "area_chart", + "signature": "st.area_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, stack=None, width=\"stretch\", height=\"content\", use_container_width=None)", + "examples": "

Example 1: Basic area chart from a dataframe

\n

If you don't use any of the optional parameters, Streamlit plots each\ncolumn as a separate area, uses the index as the x values, and labels\neach series with the column name:

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((20, 3)), columns=["a", "b", "c"])\n\nst.area_chart(df)\n
\n

Example 2: Area chart from specific dataframe columns

\n

You can choose different columns to use for the x and y values. If your\ndataframe is in long format (all y-values in one column), you can set\nthe area colors from another column.

\n

If the column contains color strings, the colors will be applied\ndirectly and the series will be unlabeled. If the column contains other\nvalues, those values will label each area, and the area colors will be\nselected from the default color palette. You can configure this color\npalette in the theme.chartCategoryColors configuration option.

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    {\n        "col1": list(range(20)) * 3,\n        "col2": rng(0).standard_normal(60),\n        "col3": ["a"] * 20 + ["b"] * 20 + ["c"] * 20,\n    }\n)\n\nst.area_chart(df, x="col1", y="col2", color="col3")\n
\n

Example 3: Area chart from wide-format dataframe

\n

If your dataframe is in wide format (y-values are in multiple columns),\nyou can pass a list of columns to the y parameter. Each column\nname becomes a series label. To override the default colors, pass a\nlist of colors to the color parameter, one for each series. If your\nareas are overlapping, use colors with some transparency (alpha\nchannel) for the best results.

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    {\n        "col1": list(range(20)),\n        "col2": rng(0).standard_normal(20),\n        "col3": rng(1).standard_normal(20),\n    }\n)\n\nst.area_chart(\n    df,\n    x="col1",\n    y=["col2", "col3"],\n    color=["#FF000080", "#0000FF80"],\n)\n
\n

Example 4: Area chart with different stacking

\n

You can adjust the stacking behavior by setting stack. You can\ncreate a streamgraph by setting stack="center":

\n
\nimport streamlit as st\nfrom vega_datasets import data\n\ndf = data.unemployment_across_industries()\n\nst.area_chart(df, x="date", y="count", color="series", stack="center")\n
\n", + "description": "

Display an area chart.

\n

This is syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.

\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Data to be plotted.

\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column name or key associated to the x-axis data. If x is\nNone (default), Streamlit uses the data index for the x-axis\nvalues.

\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column name(s) or key(s) associated to the y-axis data. If this is\nNone (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a Sequence of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.

\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The label for the x-axis. If this is None (default), Streamlit\nwill use the column name specified in x if available, or else\nno label will be displayed.

\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The label for the y-axis. If this is None (default), Streamlit\nwill use the column name(s) specified in y if available, or\nelse no label will be displayed.

\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color to use for different series in this chart.

\n

For an area chart with just 1 series, this can be:

\n
    \n
  • None, to use the default color.
  • \n
  • A hex string like "#ffaa00" or "#ffaa0088".
  • \n
  • An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.
  • \n
  • A built-in color name: "red", "orange", "yellow", "green",\n"blue", "violet", "gray"/"grey", or "primary". These map to\ntheme colors that you can customize using theme.<color>Color\nconfiguration options.
  • \n
\n

For an area chart with multiple series, where the dataframe is in\nlong format (that is, y is None or just one column), this can be:

\n
    \n
  • None, to use the default colors.

    \n
  • \n
  • The name of a column in the dataset. Data points will be grouped\ninto series of the same color based on the value of this column.\nIn addition, if the values in this column match one of the color\nformats above (hex string or color tuple), then that color will\nbe used.

    \n

    For example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints will be grouped into three series whose colors will be\nautomatically selected from the default palette.

    \n

    But, if for the same 1000-row dataset, this column contained\nthe values "#ffaa00", "#f0f", "#0000ff", then then those 1000\ndatapoints would still be grouped into 3 series, but their\ncolors would be "#ffaa00", "#f0f", "#0000ff" this time around.

    \n
  • \n
\n

For an area chart with multiple series, where the dataframe is in\nwide format (that is, y is a Sequence of columns), this can be:

\n
    \n
  • None, to use the default colors.
  • \n
  • A list of string colors or color tuples to be used for each of\nthe series in the chart. This list should have the same length\nas the number of y values (e.g. color=["#fd0", "#f0f", "#04f"]\nfor three lines). You can also use built-in color names in the\nlist (e.g. color=["red", "blue", "green"]).
  • \n
\n

You can set the default colors in the theme.chartCategoryColors\nconfiguration option.

\n", + "default": "color" + }, + { + "name": "stack", + "type_name": "bool, \"normalize\", \"center\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to stack the areas. If this is None (default),\nStreamlit uses Vega's default. Other values can be as follows:

\n
    \n
  • True: The areas form a non-overlapping, additive stack within\nthe chart.
  • \n
  • False: The areas overlap each other without stacking.
  • \n
  • "normalize": The areas are stacked and the total height is\nnormalized to 100% of the height of the chart.
  • \n
  • "center": The areas are stacked and shifted to center their\nbaseline, which creates a steamgraph.
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override the chart's native width with the width of\nthe parent container. This can be one of the following:

\n
    \n
  • None (default): Streamlit will use the chart's default behavior.
  • \n
  • True: Streamlit sets the width of the chart to match the\nwidth of the parent container.
  • \n
  • False: Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of\nthe parent container.
  • \n
\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/vega_charts.py#L908" + }, + "streamlit.audio": { + "name": "audio", + "signature": "st.audio(data, format=\"audio/wav\", start_time=0, *, sample_rate=None, end_time=None, loop=False, autoplay=False, width=\"stretch\")", + "examples": "

To display an audio player for a local file, specify the file's string\npath and format.

\n
\nimport streamlit as st\n\nst.audio("cat-purr.mp3", format="audio/mpeg", loop=True)\n
\n

You can also pass bytes or numpy.ndarray objects to st.audio.

\n
\nimport streamlit as st\nimport numpy as np\n\naudio_file = open("myaudio.ogg", "rb")\naudio_bytes = audio_file.read()\n\nst.audio(audio_bytes, format="audio/ogg")\n\nsample_rate = 44100  # 44100 samples per second\nseconds = 2  # Note duration of 2 seconds\nfrequency_la = 440  # Our played note will be 440 Hz\n# Generate array with seconds*sample_rate steps, ranging between 0 and seconds\nt = np.linspace(0, seconds, seconds * sample_rate, False)\n# Generate a 440 Hz sine wave\nnote_la = np.sin(frequency_la * t * 2 * np.pi)\n\nst.audio(note_la, sample_rate=sample_rate)\n
\n", + "description": "

Display an audio player.

\n", + "args": [ + { + "name": "data", + "type_name": "str, Path, bytes, BytesIO, numpy.ndarray, or file", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The audio to play. This can be one of the following:

\n
    \n
  • A URL (string) for a hosted audio file. Also supports\n/app/static/<asset> URLs for files served via\nstatic file serving.
  • \n
  • A path to a local audio file. The path can be a str\nor Path object. Paths can be absolute or relative to the\nworking directory (where you execute streamlit run).
  • \n
  • Raw audio data. Raw data formats must include all necessary file\nheaders to match the file format specified via format.
  • \n
\n

If data is a NumPy array, it must either be a 1D array of the\nwaveform or a 2D array of shape (C, S) where C is the number of\nchannels and S is the number of samples. See the default channel\norder at\nhttp://msdn.microsoft.com/en-us/library/windows/hardware/dn653308(v=vs.85).aspx

\n", + "default": "channel" + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The MIME type for the audio file. This defaults to "audio/wav".\nFor more information about MIME types, see\nhttps://www.iana.org/assignments/media-types/media-types.xhtml.

\n", + "default": null + }, + { + "name": "start_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The time from which the element should start playing. This can be\none of the following:

\n
    \n
  • None (default): The element plays from the beginning.
  • \n
  • An int or float specifying the time in seconds. float\nvalues are rounded down to whole seconds.
  • \n
  • A string specifying the time in a format supported by Pandas'\nTimedelta constructor,\ne.g. "2 minute", "20s", or "1m14s".
  • \n
  • A timedelta object from Python's built-in datetime library,\ne.g. timedelta(seconds=70).
  • \n
\n", + "default": null + }, + { + "name": "sample_rate", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The sample rate of the audio data in samples per second. This is\nonly required if data is a NumPy array.

\n", + "default": null + }, + { + "name": "end_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The time at which the element should stop playing. This can be\none of the following:

\n
    \n
  • None (default): The element plays through to the end.
  • \n
  • An int or float specifying the time in seconds. float\nvalues are rounded down to whole seconds.
  • \n
  • A string specifying the time in a format supported by Pandas'\nTimedelta constructor,\ne.g. "2 minute", "20s", or "1m14s".
  • \n
  • A timedelta object from Python's built-in datetime library,\ne.g. timedelta(seconds=70).
  • \n
\n", + "default": null + }, + { + "name": "loop", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the audio should loop playback.

\n", + "default": null + }, + { + "name": "autoplay", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the audio file should start playing automatically. This is\nFalse by default. Browsers will not autoplay audio files if the\nuser has not interacted with the page by clicking somewhere.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the audio player element. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/media.py#L71" + }, + "streamlit.audio_input": { + "name": "audio_input", + "signature": "st.audio_input(label, *, sample_rate=16000, key=None, help=None, on_change=None, args=None, kwargs=None, disabled=False, label_visibility=\"visible\", width=\"stretch\")", + "examples": "

Example 1: Record a voice message and play it back.*

\n

The default sample rate of 16000 Hz is optimal for speech recognition.

\n
\nimport streamlit as st\n\naudio_value = st.audio_input("Record a voice message")\n\nif audio_value:\n    st.audio(audio_value)\n
\n

Example 2: Record high-fidelity audio and play it back.*

\n

Higher sample rates can create higher-quality, larger audio files. This\nmight require a nicer microphone to fully appreciate the difference.

\n
\nimport streamlit as st\n\naudio_value = st.audio_input("Record high quality audio", sample_rate=48000)\n\nif audio_value:\n    st.audio(audio_value)\n
\n", + "description": "

Display a widget that returns an audio recording from the user's microphone.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this widget is used for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "sample_rate", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The target sample rate for the audio recording in Hz. This\ndefaults to 16000, which is optimal for speech recognition.

\n

The following values are supported: 8000 (telephone quality),\n11025, 16000 (speech-recognition quality), 22050,\n24000, 32000, 44100, 48000 (high-quality), or\nNone. If this is None, the widget uses the browser's\ndefault sample rate (typically 44100 or 48000 Hz).

\n", + "default": "sample" + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you access the widget's value via\nst.session_state[key] (read-only). For more details, see\nWidget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when this audio input's value\nchanges.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the audio input if set to\nTrue. Default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the audio input widget. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "None or UploadedFile", + "is_generator": false, + "description": "

The UploadedFile class is a subclass of BytesIO, and\ntherefore is "file-like". This means you can pass an instance of it\nanywhere a file is expected. The MIME type for the audio data is\naudio/wav. To use this type in an annotation, import it from\nstreamlit.typing.

\n
\n

Note

\n

The resulting UploadedFile is subject to the size\nlimitation configured in server.maxUploadSize. If you\nexpect large sound files, update the configuration option\nappropriately.

\n
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/audio_input.py#L90" + }, + "streamlit.badge": { + "name": "badge", + "signature": "st.badge(label, *, icon=None, color=\"blue\", width=\"content\", help=None)", + "examples": "

Create standalone badges with st.badge (with or without icons). If\nyou want to have multiple, side-by-side badges, you can use the\nMarkdown directive in st.markdown.

\n
\nimport streamlit as st\n\nst.badge("New")\nst.badge("Success", icon=":material/check:", color="green")\n\nst.markdown(\n    ":violet-badge[:material/star: Favorite] :orange-badge[\u26a0\ufe0f Needs review] :gray-badge[Deprecated]"\n)\n
\n", + "description": "

Display a colored badge with an icon and label.

\n

This is a thin wrapper around the color-badge Markdown directive.\nThe following are equivalent:

\n
    \n
  • st.markdown(":blue-badge[Home]")
  • \n
  • st.badge("Home", color="blue")
  • \n
\n
\n

Note

\n

You can insert badges everywhere Streamlit supports Markdown by\nusing the color-badge Markdown directive. See st.markdown for\nmore information.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label to display in the badge. The label can optionally contain\nGitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives. Because this command escapes square\nbrackets ([ ]) in this parameter, any directive requiring\nsquare brackets is not supported.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the badge label. If\nicon is None (default), no icon is displayed. If icon\nis a string, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
  • \n
\n", + "default": null + }, + { + "name": "color", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color to use for the badge. This defaults to "blue".

\n

This can be one of the following supported colors: red, orange,\nyellow, blue, green, violet, gray/grey, or primary. If you use\n"primary", Streamlit will use the default primary accent color\nunless you set the theme.primaryColor configuration option.

\n", + "default": "primary" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the badge element. This can be one of the following:

\n
    \n
  • "content" (default): The width of the element matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the element matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip to display when hovering over the badge. If this is\nNone (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/markdown.py#L454" + }, + "streamlit.balloons": { + "name": "balloons", + "signature": "st.balloons()", + "examples": "
\nimport streamlit as st\n\nst.balloons()\n
\n

...then watch your app and get ready for a celebration!

\n", + "description": "

Draw celebratory balloons.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/balloons.py#L27" + }, + "streamlit.bar_chart": { + "name": "bar_chart", + "signature": "st.bar_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, horizontal=False, sort=True, stack=None, width=\"stretch\", height=\"content\", use_container_width=None)", + "examples": "

Example 1: Basic bar chart from a dataframe

\n

If you don't use any of the optional parameters, Streamlit plots each\ncolumn as a series of bars, uses the index as the x values, and labels\neach series with the column name:

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((20, 3)), columns=["a", "b", "c"])\n\nst.bar_chart(df)\n
\n

Example 2: Bar chart from specific dataframe columns

\n

You can choose different columns to use for the x and y values. If your\ndataframe is in long format (all y-values in one column), you can set\nthe bar colors from another column.

\n

If the column contains color strings, the colors will be applied\ndirectly and the series will be unlabeled. If the column contains other\nvalues, those values will label each series, and the bar colors will be\nselected from the default color palette. You can configure this color\npalette in the theme.chartCategoryColors configuration option.

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    {\n        "col1": list(range(20)) * 3,\n        "col2": rng(0).standard_normal(60),\n        "col3": ["a"] * 20 + ["b"] * 20 + ["c"] * 20,\n    }\n)\n\nst.bar_chart(df, x="col1", y="col2", color="col3")\n
\n

Example 3: Bar chart from wide-format dataframe

\n

If your dataframe is in wide format (y-values are in multiple columns),\nyou can pass a list of columns to the y parameter. Each column\nname becomes a series label. To override the default colors, pass a\nlist of colors to the color parameter, one for each series:

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    {\n        "col1": list(range(20)),\n        "col2": rng(0).standard_normal(20),\n        "col3": rng(1).standard_normal(20),\n    }\n)\n\nst.bar_chart(\n    df,\n    x="col1",\n    y=["col2", "col3"],\n    color=["#FF0000", "#0000FF"],\n)\n
\n

Example 4: Horizontal bar chart

\n

You can use the horizontal parameter to display horizontal bars\ninstead of vertical bars. This is useful when you have long labels on\nthe x-axis, or when you want to display a large number of categories.\nThis example requires vega_datasets to be installed.

\n
\nimport streamlit as st\nfrom vega_datasets import data\n\nsource = data.barley()\n\nst.bar_chart(source, x="variety", y="yield", color="site", horizontal=True)\n
\n

Example 5: Unstacked bar chart

\n

You can configure the stacking behavior of the bars by setting the\nstack parameter. Set it to False to display bars side by side.\nThis example requires vega_datasets to be installed.

\n
\nimport streamlit as st\nfrom vega_datasets import data\n\nsource = data.barley()\n\nst.bar_chart(source, x="year", y="yield", color="site", stack=False)\n
\n", + "description": "

Display a bar chart.

\n

This is syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.

\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Data to be plotted.

\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column name or key associated to the x-axis data. If x is\nNone (default), Streamlit uses the data index for the x-axis\nvalues.

\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column name(s) or key(s) associated to the y-axis data. If this is\nNone (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a Sequence of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.

\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The label for the x-axis. If this is None (default), Streamlit\nwill use the column name specified in x if available, or else\nno label will be displayed.

\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The label for the y-axis. If this is None (default), Streamlit\nwill use the column name(s) specified in y if available, or\nelse no label will be displayed.

\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color to use for different series in this chart.

\n

For a bar chart with just one series, this can be:

\n
    \n
  • None, to use the default color.
  • \n
  • A hex string like "#ffaa00" or "#ffaa0088".
  • \n
  • An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.
  • \n
  • A built-in color name: "red", "orange", "yellow", "green",\n"blue", "violet", "gray"/"grey", or "primary". These map to\ntheme colors that you can customize using theme.<color>Color\nconfiguration options.
  • \n
\n

For a bar chart with multiple series, where the dataframe is in\nlong format (that is, y is None or just one column), this can be:

\n
    \n
  • None, to use the default colors.

    \n
  • \n
  • The name of a column in the dataset. Data points will be grouped\ninto series of the same color based on the value of this column.\nIn addition, if the values in this column match one of the color\nformats above (hex string or color tuple), then that color will\nbe used.

    \n

    For example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints will be grouped into three series whose colors will be\nautomatically selected from the default palette.

    \n

    But, if for the same 1000-row dataset, this column contained\nthe values "#ffaa00", "#f0f", "#0000ff", then then those 1000\ndatapoints would still be grouped into 3 series, but their\ncolors would be "#ffaa00", "#f0f", "#0000ff" this time around.

    \n
  • \n
\n

For a bar chart with multiple series, where the dataframe is in\nwide format (that is, y is a Sequence of columns), this can be:

\n
    \n
  • None, to use the default colors.
  • \n
  • A list of string colors or color tuples to be used for each of\nthe series in the chart. This list should have the same length\nas the number of y values (e.g. color=["#fd0", "#f0f", "#04f"]\nfor three lines). You can also use built-in color names in the\nlist (e.g. color=["red", "blue", "green"]).
  • \n
\n

You can set the default colors in the theme.chartCategoryColors\nconfiguration option.

\n", + "default": "color" + }, + { + "name": "horizontal", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to make the bars horizontal. If this is False\n(default), the bars display vertically. If this is True,\nStreamlit swaps the x-axis and y-axis and the bars display\nhorizontally.

\n", + "default": null + }, + { + "name": "sort", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How to sort the bars. This can be one of the following:

\n
    \n
  • True (default): The bars are sorted automatically along the\nindependent/categorical axis with Altair's default sorting. This\nalso correctly sorts ordered categorical columns\n(pd.Categorical).
  • \n
  • False: The bars are shown in data order without sorting.
  • \n
  • The name of a column (e.g. "col1"): The bars are sorted by\nthat column in ascending order.
  • \n
  • The name of a column with a minus-sign prefix (e.g. "-col1"):\nThe bars are sorted by that column in descending order.
  • \n
\n", + "default": "sorting" + }, + { + "name": "stack", + "type_name": "bool, \"normalize\", \"center\", \"layered\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to stack the bars. If this is None (default),\nStreamlit uses Vega's default. Other values can be as follows:

\n
    \n
  • True: The bars form a non-overlapping, additive stack within\nthe chart.
  • \n
  • False: The bars display side by side.
  • \n
  • "layered": The bars overlap each other without stacking.
  • \n
  • "normalize": The bars are stacked and the total height is\nnormalized to 100% of the height of the chart.
  • \n
  • "center": The bars are stacked and shifted to center the\ntotal height around an axis.
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override the chart's native width with the width of\nthe parent container. This can be one of the following:

\n
    \n
  • None (default): Streamlit will use the chart's default behavior.
  • \n
  • True: Streamlit sets the width of the chart to match the\nwidth of the parent container.
  • \n
  • False: Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of\nthe parent container.
  • \n
\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/vega_charts.py#L1194" + }, + "streamlit.button": { + "name": "button", + "signature": "st.button(label, key=None, help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", icon=None, icon_position=\"left\", disabled=False, use_container_width=None, width=\"content\", shortcut=None, wrap=None)", + "examples": "

Example 1: Customize your button type

\n
\nimport streamlit as st\n\nst.button("Reset", type="primary")\nif st.button("Say hello"):\n    st.write("Why hello there")\nelse:\n    st.write("Goodbye")\n\nif st.button("Aloha", type="tertiary"):\n    st.write("Ciao")\n
\n

Example 2: Add icons to your button

\n

Although you can add icons to your buttons through Markdown, the\nicon parameter is a convenient and consistent alternative.

\n
\nimport streamlit as st\n\nleft, middle, right = st.columns(3)\nif left.button("Plain button", width="stretch"):\n    left.markdown("You clicked the plain button.")\nif middle.button("Emoji button", icon="\ud83d\ude03", width="stretch"):\n    middle.markdown("You clicked the emoji button.")\nif right.button("Material button", icon=":material/mood:", width="stretch"):\n    right.markdown("You clicked the Material button.")\n
\n

Example 3: Use keyboard shortcuts

\n

The following example shows how to use keyboard shortcuts to trigger a\nbutton. If you use any of the platform-dependent modifiers (Ctrl, Cmd,\nor Mod), they are interpreted interchangeably and always displayed to\nthe user to match their platform.

\n
\nimport streamlit as st\n\nwith st.container(horizontal=True, horizontal_alignment="distribute"):\n    "`A`" if st.button("A", shortcut="A") else "` `"\n    "`S`" if st.button("S", shortcut="Ctrl+S") else "` `"\n    "`D`" if st.button("D", shortcut="Cmd+Shift+D") else "` `"\n    "`F`" if st.button("F", shortcut="Mod+Alt+Shift+F") else "` `"\n
\n", + "description": "

Display a button widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this button is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you access the widget's value via\nst.session_state[key] (read-only). For more details, see\nWidget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed when the button is hovered over. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this button is clicked.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string that specifies the button type. This can be one\nof the following:

\n
    \n
  • "primary": The button's background is the app's primary color\nfor additional emphasis.
  • \n
  • "secondary" (default): The button's background coordinates\nwith the app's background color for normal emphasis.
  • \n
  • "tertiary": The button is plain text without a border or\nbackground for subtlety.
  • \n
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "icon_position", + "type_name": "\"left\" or \"right\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The position of the icon relative to the button label. This\ndefaults to "left".

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the button if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch". For use_container_width=False, use\nwidth="content".

\n" + }, + "description": "

Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its contents. If use_container_width is\nTrue, the width of the button matches its parent container.

\n

In both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the button. This can be one of the following:

\n
    \n
  • "content" (default): The width of the button matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the button matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The button has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the button matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "shortcut", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional keyboard shortcut that triggers the button. This can be\none of the following strings:

\n
    \n
  • A single alphanumeric key like "K" or "4".
  • \n
  • A function key like "F11".
  • \n
  • A special key like "Enter", "Esc", or "Tab".
  • \n
  • Any of the above combined with modifiers. For example, you can use\n"Ctrl+K" or "Cmd+Shift+O".
  • \n
\n
\n

Important

\n

The keys "C" and "R" are reserved and can't be used,\neven with modifiers. Punctuation keys like "." and ","\naren't currently supported. Some combinations such as\n"Ctrl+T", "Ctrl+W", "Ctrl+PageUp",\n"Ctrl+PageDown", and "F11" are reserved by the browser\nor operating system and may never reach Streamlit.

\n
\n

The following special keys are supported: Backspace, Delete, Down,\nEnd, Enter, Esc, Home, Left, PageDown, PageUp, Right, Space, Tab,\nand Up.

\n

The following modifiers are supported: Alt, Ctrl, Cmd, Meta, Mod,\nOption, Shift.

\n
    \n
  • Ctrl, Cmd, Meta, and Mod are interchangeable and will display to\nthe user to match their platform.
  • \n
  • Option and Alt are interchangeable and will display to the user\nto match their platform.
  • \n
\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the button label can wrap onto multiple lines. This can be\none of the following:

\n
    \n
  • None (default): Streamlit decides based on the surrounding\nlayout. Inside a horizontal container, the button keeps its\nstandard, single-row height and truncates an overflowing label\nwith an ellipsis; in other layouts, the label wraps onto\nadditional lines.
  • \n
  • True: If the label is too wide for the button, it wraps onto\nadditional lines and the button grows taller.
  • \n
  • False: The button keeps its standard, single-row height. A\nlabel that is too wide is truncated with an ellipsis.
  • \n
\n

When the button keeps a single-row label and no help is set,\nhovering reveals the full label. Icons and keyboard shortcuts\nremain visible.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "

True if the button was clicked on the last run of the app,\nFalse otherwise.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/button.py#L133" + }, + "streamlit.cache_data": { + "name": "cache_data", + "signature": "st.cache_data(func=None, *, ttl, max_entries, show_spinner, show_time=False, persist, hash_funcs=None, scope=\"global\", refresh_mode=\"foreground\")", + "examples": "
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n
\n

To set the persist parameter, use this command as follows:

\n
\nimport streamlit as st\n\n@st.cache_data(persist="disk")\ndef fetch_and_clean_data(url):\n    # Fetch data from URL here, and then clean it up.\n    return data\n
\n

By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nconnection = make_database_connection()\nd1 = fetch_and_clean_data(connection, num_rows=10)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nanother_connection = make_database_connection()\nd2 = fetch_and_clean_data(another_connection, num_rows=10)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _database_connection parameter was different\n# in both calls.\n
\n

A cached function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n    # Fetch data from _db_connection here, and then clean it up.\n    return data\n\nfetch_and_clean_data.clear(_db_connection, 50)\n# Clear the cached entry for the arguments provided.\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n
\n

To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. datetime.datetime) to a hash\nfunction (lambda dt: dt.isoformat()) like this:

\n
\nimport streamlit as st\nimport datetime\n\n@st.cache_data(hash_funcs={datetime.datetime: lambda dt: dt.isoformat()})\ndef convert_to_utc(dt: datetime.datetime):\n    return dt.astimezone(datetime.timezone.utc)\n
\n

Alternatively, you can map the type's fully-qualified name\n(e.g. "datetime.datetime") to the hash function instead:

\n
\nimport streamlit as st\nimport datetime\n\n@st.cache_data(hash_funcs={"datetime.datetime": lambda dt: dt.isoformat()})\ndef convert_to_utc(dt: datetime.datetime):\n    return dt.astimezone(datetime.timezone.utc)\n
\n", + "description": "

Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).

\n

Cached objects can be global or session-scoped. Global cached data is\navailable across all users, sessions, and reruns. Session-scoped cached\ndata is only available in the current session and removed when the\nsession disconnects.

\n

Cached objects are stored in "pickled" form, which means that the return\nvalue of a cached function must be pickleable. Each caller of the cached\nfunction gets its own copy of the cached data.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_data.clear().

\n

A function's arguments must be hashable to cache it. Streamlit makes a\nbest effort to hash a variety of objects, but the fallback hashing method\nrequires that the argument be pickleable, also. If you have an unhashable\nargument (like a database connection) or an argument you want to exclude\nfrom caching, use an underscore prefix in the argument name. In this case,\nStreamlit will return a cached value when all other arguments match a\nprevious function call. Alternatively, you can declare custom hashing\nfunctions with hash_funcs.

\n

Objects cached by st.cache_data are returned as copies. To cache a\nshared resource or something you want to mutate in place, use\nst.cache_resource instead. To learn more about caching, see\nCaching overview.

\n
\n

Note

\n

Caching async functions is not supported. To upvote this feature,\nsee GitHub issue #8308.

\n
\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The function to cache. Streamlit hashes the function's source code.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum time to keep an entry in the cache. Can be one of:

\n\n

Note that ttl will be ignored if persist="disk" or persist=True.

\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. When a new entry is added to a full cache,\nthe oldest cached entry will be removed. Defaults to None.

\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached data is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", + "default": "True" + }, + { + "name": "show_time", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show the elapsed time next to the spinner text. If this is\nFalse (default), no time is displayed. If this is True,\nelapsed time is displayed with a precision of 0.1 seconds. The time\nformat is not configurable.

\n", + "default": null + }, + { + "name": "persist", + "type_name": "\"disk\", bool, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Optional location to persist cached data to. Passing "disk" (or True)\nwill persist the cached data to the local disk. None (or False) will disable\npersistence. The default is None.

\n", + "default": "None" + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Mapping of types or fully qualified names to hash functions.\nThis is used to override the behavior of the hasher inside Streamlit's\ncaching mechanism: when the hasher encounters an object, it will first\ncheck to see if its type matches a key in this dict and, if so, will use\nthe provided function to generate a hash for it. See below for an example\nof how this can be used.

\n", + "default": null + }, + { + "name": "scope", + "type_name": "\"global\" or \"session\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The scope for the data cache. If this is "global" (default),\nthe data is cached globally. If this is "session", the data is\nremoved from the cache when the session disconnects.

\n

Because a session-scoped cache is cleared when a session disconnects,\nan unstable network connection can cause the cache to populate\nmultiple times in a single session. If this is a problem, you might\nconsider adjusting the server.websocketPingInterval\nconfiguration option.

\n", + "default": null + }, + { + "name": "refresh_mode", + "type_name": "\"foreground\" or \"background\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How to refresh a cache entry once its ttl expires. This can be one of\nthe following:

\n
    \n
  • "foreground" (default): When the ttl expires, the next access\nruns the cached function synchronously. The app rerun waits until the new\nvalue is ready.
  • \n
  • "background": Return the expired value immediately and update it in\nthe background. Streamlit can keep returning the expired value for up to\none additional ttl. After that, the next call waits for a new value.\nThis mode requires a ttl and can't be used with persist.
  • \n
\n
\n

Note

\n

A function that refreshes in the background can't use session-specific\nfeatures such as st.session_state. Pass any required session values\nas arguments instead. The function also shouldn't contain Streamlit\ncommands that display elements. Streamlit doesn't replay these elements\nfor cached results and shows a warning when the function creates them.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/caching/cache_data_api.py#L486" + }, + "streamlit.cache_resource": { + "name": "cache_resource", + "signature": "st.cache_resource(func, *, ttl, max_entries, show_spinner, show_time=False, validate, hash_funcs=None, on_release=None, scope=\"global\", refresh_mode=\"foreground\")", + "examples": "

Example 1: Global cache

\n

By default, an @st.cache_resource-decorated function uses a global cache.

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(url):\n    # Create a database session object that points to the URL.\n    return session\n\ns1 = get_database_session(SESSION_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(SESSION_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the connection object in s1 is the same as in s2.\n\ns3 = get_database_session(SESSION_URL_2)\n# This is a different URL, so the function executes.\n
\n

Example 2: Session-scoped cache

\n

By passing scope="session", an @st.cache_resource-decorated function\nuses a session-scoped cache. You can also use on_release to clean up\nresources when they are no longer needed.

\n
\nimport streamlit as st\n\n@st.cache_resource(scope="session", on_release=lambda sess: sess.close())\ndef get_database_session(url):\n    # Create a database session object that points to the URL.\n    return session\n
\n

Example 3: Unhashable arguments

\n

By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with _ will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\ns1 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _sessionmaker parameter was different\n# in both calls.\n
\n

Example 4: Clearing a cache

\n

A cached function's cache can be procedurally cleared:

\n
\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n    # Create a database connection object that points to the URL.\n    return connection\n\nget_database_session.clear(_sessionmaker, "https://streamlit.io/")\n# Clear the cached entry for the arguments provided.\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n
\n

Example 5: Custom hashing

\n

To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. Person) to a hash\nfunction (str) like this:

\n
\nimport streamlit as st\nfrom pydantic import BaseModel\n\nclass Person(BaseModel):\n    name: str\n\n@st.cache_resource(hash_funcs={Person: str})\ndef get_person_name(person: Person):\n    return person.name\n
\n

Alternatively, you can map the type's fully-qualified name\n(e.g. "__main__.Person") to the hash function instead:

\n
\nimport streamlit as st\nfrom pydantic import BaseModel\n\nclass Person(BaseModel):\n    name: str\n\n@st.cache_resource(hash_funcs={"__main__.Person": str})\ndef get_person_name(person: Person):\n    return person.name\n
\n", + "description": "

Decorator to cache functions that return resource objects (e.g. database connections, ML models).

\n

Cached objects can be global or session-scoped. Global resources are\nshared across all users, sessions, and reruns. Session-scoped resources are\nscoped to the current session and are removed when the session disconnects.\nGlobal resources must be thread-safe. If thread safety is an issue,\nconsider using a session-scoped cache or storing the resource in\nst.session_state instead.

\n

You can clear a function's cache with func.clear() or clear the entire\ncache with st.cache_resource.clear().

\n

A function's arguments must be hashable to cache it. Streamlit makes a\nbest effort to hash a variety of objects, but the fallback hashing method\nrequires that the argument be pickleable, also. If you have an unhashable\nargument (like a database connection) or an argument you want to exclude\nfrom caching, use an underscore prefix in the argument name. In this case,\nStreamlit will return a cached value when all other arguments match a\nprevious function call. Alternatively, you can declare custom hashing\nfunctions with hash_funcs.

\n

Objects cached by st.cache_resource act like singletons and can\nmutate. To cache data and return copies, use st.cache_data instead.\nTo learn more about caching, see Caching overview.

\n
\n

Warning

\n

Async objects are not officially supported in Streamlit. Caching\nasync objects or objects that reference async objects may have\nunintended consequences. For example, Streamlit may close event\nloops in its normal operation and make the cached object raise an\nEvent loop closed error.

\n

To upvote official asyncio support, see GitHub issue #8488. To upvote\nsupport for caching async functions, see GitHub issue #8308.

\n
\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The function that creates the cached resource. Streamlit hashes the\nfunction's source code.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum age of a returned entry from the cache. This can be one\nof the following values:

\n
    \n
  • None if cache entries should never expire (default).
  • \n
  • A number specifying the time in seconds.
  • \n
  • A string specifying the time in a format supported by Pandas's\nTimedelta constructor,\ne.g. "1D", "1.5 days", or "1h23s". Note that number strings\nwithout units are treated by Pandas as nanoseconds.
  • \n
  • A timedelta object from Python's built-in datetime library,\ne.g. timedelta(days=1).
  • \n
\n

Changes to this value will trigger a new cache to be created.

\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. When a new entry is added to a full cache,\nthe oldest cached entry will be removed. Defaults to None.

\n

Changes to this value will trigger a new cache to be created.

\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached resource is being created. If string,\nvalue of show_spinner param will be used for spinner text.

\n", + "default": "True" + }, + { + "name": "show_time", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show the elapsed time next to the spinner text. If this is\nFalse (default), no time is displayed. If this is True,\nelapsed time is displayed with a precision of 0.1 seconds. The time\nformat is not configurable.

\n", + "default": null + }, + { + "name": "validate", + "type_name": "callable or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional validation function for cached resources. validate is called\neach time the cached value is accessed. It receives the cached value as\nits only parameter and it must return a boolean. If validate returns\nFalse, the current cached value is discarded, and the decorated function\nis called to compute a new value. This is useful e.g. to check the\nhealth of database connections.

\n", + "default": null + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Mapping of types or fully qualified names to hash functions.\nThis is used to override the behavior of the hasher inside Streamlit's\ncaching mechanism: when the hasher encounters an object, it will first\ncheck to see if its type matches a key in this dict and, if so, will use\nthe provided function to generate a hash for it. See below for an example\nof how this can be used.

\n", + "default": null + }, + { + "name": "on_release", + "type_name": "callable or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A function to call when an entry is removed from the cache.\nThe removed item will be provided to the function as an argument.

\n

This is only useful for caches that remove entries normally.\nMost commonly, this is used session-scoped caches to release\nper-session resources. This can also be used with max_entries\nor ttl settings.

\n

TTL expiration only happens when expired resources are accessed.\nTherefore, don't rely on TTL expiration to guarantee timely cleanup.\nAlso, expiration can happen on any script run. Ensure that\non_release functions are thread-safe and don't rely on session\nstate.

\n

The on_release function isn't guaranteed to be called when an\napp is shut down.

\n", + "default": null + }, + { + "name": "scope", + "type_name": "\"global\" or \"session\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The scope for the resource cache. If this is "global" (default),\nthe resource is cached globally. If this is "session", the\nresource is removed from the cache when the session disconnects.

\n

Because a session-scoped cache is cleared when a session disconnects,\nan unstable network connection can cause the cache to populate\nmultiple times in a single session. If this is a problem, you might\nconsider adjusting the server.websocketPingInterval\nconfiguration option.

\n", + "default": null + }, + { + "name": "refresh_mode", + "type_name": "\"foreground\" or \"background\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How to refresh a cached resource once its ttl expires. This can be\none of the following:

\n
    \n
  • "foreground" (default): When the ttl expires, the next access\nruns the cached function synchronously. The app rerun waits until the new\nresource is ready.
  • \n
  • "background": Return the expired resource immediately and update it\nin the background. Streamlit can keep returning the expired resource for\nup to one additional ttl. After that, the next call waits for a new\nresource. This mode requires a ttl. If you set on_release,\nStreamlit calls it for the old resource after a successful update.
  • \n
\n
\n

Note

\n

A function that refreshes in the background can't use session-specific\nfeatures such as st.session_state. Pass any required session values\nas arguments instead. The function also shouldn't contain Streamlit\ncommands that display elements. Streamlit doesn't replay these elements\nfor cached results and shows a warning when the function creates them.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/caching/cache_resource_api.py#L377" + }, + "streamlit.camera_input": { + "name": "camera_input", + "signature": "st.camera_input(label, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", resolution=None, width=\"stretch\")", + "examples": "

Example 1: Capture a photo and display it.

\n
\nimport streamlit as st\n\nenable = st.checkbox("Enable camera")\npicture = st.camera_input("Take a picture", disabled=not enable)\n\nif picture:\n    st.image(picture)\n
\n

Example 2: Capture a photo at 720p resolution.

\n
\nimport streamlit as st\n\npicture = st.camera_input("Scan QR code", resolution="720p")\n\nif picture:\n    st.image(picture)\n
\n", + "description": "

Display a widget that returns pictures from the user's webcam.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this widget is used for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you access the widget's value via\nst.session_state[key] (read-only). For more details, see\nWidget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this camera_input's value\nchanges.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the camera input if set to\nTrue. Default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "resolution", + "type_name": "\"480p\", \"720p\", \"1080p\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The capture resolution to request from the user's camera. Resolution\npresets set the target image height in pixels; the width is determined\nby the camera's native aspect ratio. This can be one of the following:

\n
    \n
  • None (default): Streamlit captures at a resolution determined by\nthe widget's display size.
  • \n
  • "480p": Target a height of 480 pixels.
  • \n
  • "720p": Target a height of 720 pixels.
  • \n
  • "1080p": Target a height of 1080 pixels.
  • \n
\n

The value is a request, not a guarantee. Cameras support a fixed set of\nresolutions, so the browser selects the closest supported resolution and\nthe returned image may differ from the requested height. If you need\nexact dimensions, resize the captured image after capture (for example,\nwith PIL.Image.resize).

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the camera input widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "None or UploadedFile", + "is_generator": false, + "description": "

The UploadedFile class is a subclass of BytesIO, and\ntherefore is "file-like". This means you can pass an instance of it\nanywhere a file is expected. To use this type in an annotation,\nimport it from streamlit.typing.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/camera_input.py#L95" + }, + "streamlit.caption": { + "name": "caption", + "signature": "st.caption(body, unsafe_allow_html=False, *, help=None, width=\"stretch\", text_alignment=\"left\")", + "examples": "
\nimport streamlit as st\n\nst.caption("This is a string that explains something above.")\nst.caption("A caption with _italics_ :blue[colors] and emojis :sunglasses:")\n
\n", + "description": "

Display text in small font.

\n

This should be used for captions, asides, footnotes, sidenotes, and\nother explanatory text.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Whether to render HTML within body. If this is False\n(default), any HTML tags found in body will be escaped and\ntherefore treated as raw text. If this is True, any HTML\nexpressions within body will be rendered.

\n

Adding custom HTML to your app impacts safety, styling, and\nmaintainability.

\n
\n

Note

\n

If you only want to insert HTML or CSS without Markdown text,\nwe recommend using st.html instead.

\n
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the caption. If this is\nNone (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the caption element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "text_alignment", + "type_name": "\"left\", \"center\", \"right\", or \"justify\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of the text within the element. This can\nbe one of the following:

\n
    \n
  • "left" (default): Text is aligned to the left edge.
  • \n
  • "center": Text is centered.
  • \n
  • "right": Text is aligned to the right edge.
  • \n
  • "justify": Text is justified (stretched to fill the available\nwidth with the last line left-aligned).
  • \n
\n
\n

Note

\n

For text alignment to have a visible effect, the element's\nwidth must be wider than its content. If you use\nwidth="content" with short text, the alignment may not be\nnoticeable.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/markdown.py#L252" + }, + "streamlit.chat_input": { + "name": "chat_input", + "signature": "st.chat_input(placeholder=\"Your message\", *, key=None, max_chars=None, max_upload_size=None, accept_file=False, file_type=None, accept_audio=False, audio_sample_rate=16000, disabled=False, submit_mode=\"submit\", on_submit=None, args=None, kwargs=None, width=\"stretch\", height=\"content\")", + "examples": "

Example 1: Pin the chat input widget to the bottom of your app

\n

When st.chat_input is used in the main body of an app, it will be\npinned to the bottom of the page.

\n
\nimport streamlit as st\n\nprompt = st.chat_input("Say something")\nif prompt:\n    st.write(f"User has sent the following prompt: {prompt}")\n
\n

Example 2: Use the chat input widget inline

\n

The chat input can also be used inline by nesting it inside any layout\ncontainer (container, columns, tabs, sidebar, etc) or fragment. Create\nchat interfaces embedded next to other content, or have multiple\nchatbots!

\n
\nimport streamlit as st\n\nwith st.sidebar:\n    messages = st.container(height=200)\n    if prompt := st.chat_input("Say something"):\n        messages.chat_message("user").write(prompt)\n        messages.chat_message("assistant").write(f"Echo: {prompt}")\n
\n

Example 3: Let users upload files

\n

When you configure your chat input widget to allow file attachments, it\nwill return a dict-like object when the user sends a submission. You\ncan access the user's message through the text attribute of this\ndictionary. You can access a list of the user's submitted file(s)\nthrough the files attribute. Similar to st.session_state, you\ncan use key or attribute notation.

\n
\nimport streamlit as st\n\nprompt = st.chat_input(\n    "Say something and/or attach an image",\n    accept_file=True,\n    file_type=["jpg", "jpeg", "png"],\n)\nif prompt and prompt.text:\n    st.markdown(prompt.text)\nif prompt and prompt["files"]:\n    st.image(prompt["files"][0])\n
\n

Example 4: Programmatically set the text via session state

\n

You can use st.session_state to set the text of the chat input widget.\nBecause st.chat_input is a trigger widget, the value in Session State\nis cleared after the widget is populated. This prevents the widget from\nreturning the value until the user submits it.

\n
\nimport streamlit as st\n\nif st.button("Set Value"):\n    st.session_state.chat_input = "Hello, world!"\nst.chat_input(key="chat_input")\nst.write("Chat input value:", st.session_state.chat_input)\n
\n

Example 5: Enable audio recording

\n

You can enable audio recording by setting accept_audio=True.\nThe accept_audio parameter works independently of accept_file,\nallowing you to enable audio recording with or without file uploads.

\n
\nimport streamlit as st\n\nprompt = st.chat_input(\n    "Say or record something",\n    accept_audio=True,\n)\nif prompt and prompt.text:\n    st.write("Text:", prompt.text)\nif prompt and prompt.audio:\n    st.audio(prompt.audio)\n    st.write("Audio file:", prompt.audio.name)\n
\n", + "description": "

Display a chat input widget.

\n", + "args": [ + { + "name": "placeholder", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A placeholder text shown when the chat input is empty. This\ndefaults to "Your message". For accessibility reasons, you\nshould not use an empty string.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing accept_file, file_type, max_chars,\nor max_upload_size resets the widget even when a key\nis provided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of characters that can be entered. If this is\nNone (default), there will be no maximum.

\n", + "default": null + }, + { + "name": "max_upload_size", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum allowed size of each uploaded file in megabytes.

\n

If this is None (default), the maximum file size is set by the\nserver.maxUploadSize configuration option in your\nconfig.toml file. If this is an integer, it must be positive\nand will override the server.maxUploadSize configuration option.

\n", + "default": null + }, + { + "name": "accept_file", + "type_name": "bool, \"multiple\", or \"directory\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the chat input should accept files. This can be one of the\nfollowing values:

\n
    \n
  • False (default): No files are accepted and the user can only\nsubmit a message.
  • \n
  • True: The user can add a single file to their submission.
  • \n
  • "multiple": The user can add multiple files to their\nsubmission.
  • \n
  • "directory": The user can add multiple files to their\nsubmission by selecting a directory. If file_type is set,\nonly files matching those type(s) will be uploaded.
  • \n
\n

By default, uploaded files are limited to 200 MB each. You can\nconfigure this using the server.maxUploadSize config option.\nFor more information on how to set config options, see\nconfig.toml.

\n", + "default": null + }, + { + "name": "file_type", + "type_name": "str, Sequence[str], or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The allowed file types for uploaded files. This can be one of the\nfollowing values:

\n
    \n
  • None (default): All file extensions are allowed.
  • \n
  • A file extension: Only one file extension is allowed. For example,\nto only accept CSV files, use "csv" or ".csv".
  • \n
  • A MIME type: Only one MIME type is allowed. For example,\nto accept JPEG images, use "image/jpeg".
  • \n
  • A MIME wildcard: All types within a MIME media type are allowed.\nFor example, to accept all images, use "image/*".
  • \n
  • A MIME media type: This is a shortcut that is equivalent to a\nMIME wildcard. If you use "image", "audio", "video", or\n"text", Streamlit will internally append /* to create\na MIME wildcard.
  • \n
  • A sequence of strings: Use a combination of the previously listed\nstrings to accept multiple file types.
  • \n
\n

For more information about MIME types, see\nhttps://www.iana.org/assignments/media-types/media-types.xhtml.

\n
\n

Note

\n

This is a best-effort check, but doesn't provide a\nsecurity guarantee against users uploading files of other types\nor type extensions. The correct handling of uploaded files is\npart of the app developer's responsibility.

\n
\n", + "default": null + }, + { + "name": "accept_audio", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show an audio recording button in the chat input. This\ndefaults to False. If this is True, users can record and\nsubmit audio messages. Recorded audio is available as an\nUploadedFile object with MIME type audio/wav.

\n", + "default": null + }, + { + "name": "audio_sample_rate", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The target sample rate for audio recording in Hz when\naccept_audio is True. This defaults to 16000, which is\noptimal for speech recognition.

\n

The following values are supported: 8000 (telephone quality),\n11025, 16000 (speech-recognition quality), 22050,\n24000, 32000, 44100, 48000 (high-quality), or\nNone. If this is None, the widget uses the browser's\ndefault sample rate (typically 44100 or 48000 Hz).

\n", + "default": "sample" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the chat input should be disabled. This defaults to\nFalse.

\n", + "default": null + }, + { + "name": "submit_mode", + "type_name": "\"submit\", \"disable\", or \"stop\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Controls widget behavior after the user submits a message while\nthe script is running. This can be one of the following values:

\n
    \n
  • "submit" (default): The widget remains fully enabled after\nsubmission. Users can submit new messages while the script\nis running.
  • \n
  • "disable": The widget is automatically disabled after\nthe user submits a message and re-enables when the script\nrun completes. This prevents users from interrupting ongoing\noperations like LLM streaming.
  • \n
  • "stop": The submit button transforms into a stop button\nafter submission. Clicking it stops the script execution,\nsimilar to clicking "Stop" in the app's status widget. The\ntext area is disabled while the script runs.
  • \n
\n", + "default": null + }, + { + "name": "on_submit", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when the chat input's value is submitted.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chat input widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum height of the chat input widget. This can be one of\nthe following:

\n
    \n
  • "content" (default): The widget uses the default single-line\nheight and automatically expands based on the text content.
  • \n
  • "stretch": The height of the widget stretches to fill the\navailable height of the parent container. The parent container\nmust have a defined height for this to work properly.
  • \n
  • An integer specifying the minimum height in pixels: The widget\nhas a fixed minimum height but still auto-expands based on text\ncontent. The minimum recommended height is 68 pixels, which fits\na single line of text.
  • \n
\n", + "default": "single-line" + } + ], + "returns": [ + { + "type_name": "None, str, or ChatInputValue", + "is_generator": false, + "description": "

The user's submission. This is one of the following types:

\n
    \n
  • None: If the user didn't submit a message, file, or audio\nrecording in the last rerun, the widget returns None.
  • \n
  • A string: When the widget isn't configured to accept files or\naudio recordings, and the user submitted a message in the last\nrerun, the widget returns the user's message as a string.
  • \n
  • A ChatInputValue object: When the widget is configured to\naccept files or audio recordings, and the user submitted any\ncontent in the last rerun, the widget returns a ChatInputValue\nobject. This object is dictionary-like and supports both key and\nattribute notation.\nThe object always includes the text attribute, and\noptionally includes files and/or audio attributes depending\non the accept_file and accept_audio parameters.
  • \n
\n

To use ChatInputValue or UploadedFile in an annotation,\nimport them from streamlit.typing.

\n

When the widget is configured to accept files or audio recordings,\nand the user submitted content in the last rerun, you can access\nthe user's submission with key or attribute notation from the\ndict-like object. This is shown in Example 3 below.

\n
    \n
  • The text attribute holds a string that is the user's message.\nThis is an empty string if the user only submitted one or more\nfiles or audio recordings.
  • \n
  • The files attribute is only present when accept_file\nisn't False. When present, it holds a list of\nUploadedFile objects. The list is empty if the user only\nsubmitted a message or audio recording. Unlike\nst.file_uploader, this attribute always returns a list, even\nwhen the widget is configured to accept only one file at a time.
  • \n
  • The audio attribute is only present when accept_audio is\nTrue. When present, it holds an UploadedFile object if\naudio was recorded or None if no audio was recorded.
  • \n
\n

The UploadedFile class is a subclass of BytesIO and\ntherefore is "file-like". This means you can pass an instance of it\nanywhere a file is expected.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/chat.py#L624" + }, + "streamlit.chat_message": { + "name": "chat_message", + "signature": "st.chat_message(name, *, avatar=None, width=\"stretch\")", + "examples": "

You can use with notation to insert any element into an expander

\n
\nimport streamlit as st\nimport numpy as np\n\nwith st.chat_message("user"):\n    st.write("Hello \ud83d\udc4b")\n    st.line_chart(np.random.randn(30, 3))\n
\n

Or you can just call methods directly in the returned objects:

\n
\nimport streamlit as st\nimport numpy as np\n\nmessage = st.chat_message("assistant")\nmessage.write("Hello human")\nmessage.bar_chart(np.random.randn(30, 3))\n
\n", + "description": "

Insert a chat message container.

\n

To add elements to the returned container, you can use with notation\n(preferred) or just call methods directly on the returned object. See the\nexamples below.

\n
\n

Note

\n

To follow best design practices and maintain a good appearance on\nall screen sizes, don't nest chat message containers.

\n
\n", + "args": [ + { + "name": "name", + "type_name": "\"user\", \"assistant\", \"ai\", \"human\", or str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The name of the message author. Can be "human"/"user" or\n"ai"/"assistant" to enable preset styling and avatars.

\n

Currently, the name is not shown in the UI but is only set as an\naccessibility label. For accessibility reasons, you should not use\nan empty string.

\n", + "default": null + }, + { + "name": "avatar", + "type_name": "Anything supported by st.image (except list), str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The avatar shown next to the message.

\n

If avatar is None (default), the icon will be determined\nfrom name as follows:

\n
    \n
  • If name is "user" or "human", the message will have a\ndefault user icon.
  • \n
  • If name is "ai" or "assistant", the message will have\na default bot icon.
  • \n
  • For all other values of name, the message will show the first\nletter of the name.
  • \n
\n

In addition to the types supported by st.image (except list),\nthe following strings are valid:

\n
    \n
  • A single-character emoji. For example, you can set avatar="\ud83e\uddd1\u200d\ud83d\udcbb"\nor avatar="\ud83e\udd96". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": "user" + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chat message container. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the container matches the\nwidth of the parent container.
  • \n
  • "content": The width of the container matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The container has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the container matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Container", + "is_generator": false, + "description": "

A single container that can hold multiple elements.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/chat.py#L416" + }, + "streamlit.checkbox": { + "name": "checkbox", + "signature": "st.checkbox(label, value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", width=\"content\", wrap=None, bind=None, persist_state=None)", + "examples": "
\nimport streamlit as st\n\nagree = st.checkbox("I agree")\n\nif agree:\n    st.write("Great!")\n
\n", + "description": "

Display a checkbox widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this checkbox is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Preselect the checkbox when it first renders. This will be\ncast to bool internally.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this checkbox's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the checkbox if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the checkbox widget. This can be one of the following:

\n
    \n
  • "content" (default): The width of the widget matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the widget matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the checkbox label can wrap onto multiple lines. This can be\none of the following:

\n
    \n
  • None (default): Streamlit decides based on the surrounding\nlayout. Inside a horizontal container, the checkbox keeps its\nstandard, single-row height and truncates an overflowing label\nwith an ellipsis; in other layouts, the label wraps onto\nadditional lines.
  • \n
  • True: If the label is too wide for the checkbox, it wraps onto\nadditional lines and the widget grows taller.
  • \n
  • False: The checkbox keeps its standard, single-row height. A\nlabel that is too wide is truncated with an ellipsis.
  • \n
\n

When the checkbox keeps a single-row label, hovering the label\nreveals the full label in a tooltip, including when help is set.\nThe checkbox indicator and help icon remain visible.

\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "

Whether or not the checkbox is checked.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/checkbox.py#L65" + }, + "streamlit.code": { + "name": "code", + "signature": "st.code(body, language=\"python\", *, line_numbers=False, wrap_lines=False, height=\"content\", width=\"stretch\")", + "examples": "
\nimport streamlit as st\n\ncode = '''def hello():\n    print("Hello, Streamlit!")'''\nst.code(code, language="python")\n
\n
\nimport streamlit as st\ncode = '''Is it a crown or boat?\n                        ii\n                      iiiiii\nWWw                 .iiiiiiii.                ...:\n WWWWWWw          .iiiiiiiiiiii.         ........\n  WWWWWWWWWWw    iiiiiiiiiiiiiiii    ...........\n   WWWWWWWWWWWWWWwiiiiiiiiiiiiiiiii............\n    WWWWWWWWWWWWWWWWWWwiiiiiiiiiiiiii.........\n     WWWWWWWWWWWWWWWWWWWWWWwiiiiiiiiii.......\n      WWWWWWWWWWWWWWWWWWWWWWWWWWwiiiiiii....\n       WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwiiii.\n          -MMMWWWWWWWWWWWWWWWWWWWWWWMMM-\n'''\nst.code(code, language=None)\n
\n", + "description": "

Display a code block with optional syntax highlighting.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The string to display as code or monospace text.

\n", + "default": null + }, + { + "name": "language", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The language that the code is written in, for syntax highlighting.\nThis defaults to "python". If this is None, the code will\nbe plain, monospace text.

\n

For a list of available language values, see\nreact-syntax-highlighter\non GitHub.

\n", + "default": null + }, + { + "name": "line_numbers", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean indicating whether to show line numbers to the\nleft of the code block. This defaults to False.

\n", + "default": null + }, + { + "name": "wrap_lines", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean indicating whether to wrap lines. This defaults\nto False.

\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the code block element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n
\n

Note

\n

Use scrolling containers sparingly. If you use scrolling\ncontainers, avoid heights that exceed 500 pixels. Otherwise,\nthe scroll surface of the container might cover the majority of\nthe screen on mobile devices, which makes it hard to scroll the\nrest of the app.

\n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the code block element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/code.py#L31" + }, + "streamlit.color_picker": { + "name": "color_picker", + "signature": "st.color_picker(label, value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", width=\"content\", bind=None, persist_state=None)", + "examples": "
\nimport streamlit as st\n\ncolor = st.color_picker("Pick A Color", "#00f900")\nst.write("The current color is", color)\n
\n", + "description": "

Display a color picker widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The hex value of this widget when it first renders. If None,\ndefaults to black.

\n", + "default": "black" + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this color_picker's value\nchanges.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the color picker if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the color picker widget. This can be one of the\nfollowing:

\n
    \n
  • "content" (default): The width of the widget matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the widget matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "str", + "is_generator": false, + "description": "

The selected color as a hex string.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/color_picker.py#L85" + }, + "streamlit.columns": { + "name": "columns", + "signature": "st.columns(spec, *, gap=\"small\", vertical_alignment=\"top\", border=False, width=\"stretch\", wrap=True)", + "examples": "

Example 1: Use context management

\n

You can use the with statement to insert any element into a column:

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\n\nwith col1:\n    st.header("A cat")\n    st.image("https://static.streamlit.io/examples/cat.jpg")\n\nwith col2:\n    st.header("A dog")\n    st.image("https://static.streamlit.io/examples/dog.jpg")\n\nwith col3:\n    st.header("An owl")\n    st.image("https://static.streamlit.io/examples/owl.jpg")\n
\n

Example 2: Use commands as container methods

\n

You can just call methods directly on the returned objects:

\n
\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = rng(0).standard_normal((10, 1))\ncol1, col2 = st.columns([3, 1])\n\ncol1.subheader("A wide column with a chart")\ncol1.line_chart(df)\n\ncol2.subheader("A narrow column with the data")\ncol2.write(df)\n
\n

Example 3: Align widgets

\n

Use vertical_alignment="bottom" to align widgets.

\n
\nimport streamlit as st\n\nleft, middle, right = st.columns(3, vertical_alignment="bottom")\n\nleft.text_input("Write something")\nmiddle.button("Click me", use_container_width=True)\nright.checkbox("Check me")\n
\n

Example 4: Use vertical alignment to create grids

\n

Adjust vertical alignment to customize your grid layouts.

\n
\nimport streamlit as st\n\nvertical_alignment = st.selectbox(\n    "Vertical alignment", ["top", "center", "bottom"], index=2\n)\n\nleft, middle, right = st.columns(3, vertical_alignment=vertical_alignment)\nleft.image("https://static.streamlit.io/examples/cat.jpg")\nmiddle.image("https://static.streamlit.io/examples/dog.jpg")\nright.image("https://static.streamlit.io/examples/owl.jpg")\n
\n

Example 5: Add borders

\n

Add borders to your columns instead of nested containers for consistent\nheights.

\n
\nimport streamlit as st\n\nleft, middle, right = st.columns(3, border=True)\n\nleft.markdown("Lorem ipsum " * 10)\nmiddle.markdown("Lorem ipsum " * 5)\nright.markdown("Lorem ipsum ")\n
\n

Example 6: Disable wrapping for a thumbnail row

\n

Use wrap=False to keep columns in one row and scroll horizontally\nwhen they do not fit.

\n
\nimport streamlit as st\n\nimages = [\n    "https://static.streamlit.io/examples/cat.jpg",\n    "https://static.streamlit.io/examples/dog.jpg",\n    "https://static.streamlit.io/examples/owl.jpg",\n    "https://static.streamlit.io/examples/cat.jpg",\n    "https://static.streamlit.io/examples/dog.jpg",\n    "https://static.streamlit.io/examples/owl.jpg",\n]\nthumbnail_columns = st.columns(6, gap="xsmall", wrap=False)\nfor column, image in zip(thumbnail_columns, images):\n    column.image(image)\n
\n", + "description": "

Insert containers laid out as side-by-side columns.

\n

Inserts a number of multi-element containers laid out side-by-side and\nreturns a list of container objects.

\n

To add elements to the returned containers, you can use the with notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n
\n

Note

\n

To follow best design practices and maintain a good appearance on\nall screen sizes, don't nest columns more than once.

\n
\n", + "args": [ + { + "name": "spec", + "type_name": "int or Iterable of numbers", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Controls the number and width of columns to insert. Can be one of:

\n
    \n
  • An integer that specifies the number of columns. All columns have equal\nwidth in this case.
  • \n
  • An Iterable of numbers (int or float) that specify the relative width of\neach column. E.g. [0.7, 0.3] creates two columns where the first\none takes up 70% of the available with and the second one takes up 30%.\nOr [1, 2, 3] creates three columns where the second one is two times\nthe width of the first one, and the third one is three times that width.
  • \n
\n", + "default": null + }, + { + "name": "gap", + "type_name": "\"xxsmall\", \"xsmall\", \"small\", \"medium\", \"large\", \"xlarge\", \"xxlarge\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The size of the gap between the columns. This can be one of the\nfollowing:

\n
    \n
  • "xxsmall": 0.25rem gap between the columns.
  • \n
  • "xsmall": 0.5rem gap between the columns.
  • \n
  • "small" (default): 1rem gap between the columns.
  • \n
  • "medium": 2rem gap between the columns.
  • \n
  • "large": 4rem gap between the columns.
  • \n
  • "xlarge": 6rem gap between the columns.
  • \n
  • "xxlarge": 8rem gap between the columns.
  • \n
  • A non-negative integer specifying the gap in pixels. For\nexample, gap=20 sets a 20-pixel gap.
  • \n
  • None: No gap between the columns.
  • \n
\n

The rem unit is relative to the theme.baseFontSize\nconfiguration option.

\n", + "default": null + }, + { + "name": "vertical_alignment", + "type_name": "\"top\", \"center\", or \"bottom\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The vertical alignment of the content inside the columns. The\ndefault is "top".

\n", + "default": "is" + }, + { + "name": "border", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show a border around the column containers. If this is\nFalse (default), no border is shown. If this is True, a\nborder is shown around each column.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the column group. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the column group matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The column group has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the column group matches the\nwidth of the parent container.
  • \n
\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether columns may stack vertically on narrow viewports. If this\nis True (default), columns stack when the viewport is at most\n640px wide. If this is False, stacking is disabled and\ncolumns stay in a single row. Columns shrink until a usable\nminimum width, then the column group scrolls horizontally instead\nof overflowing the page.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "list of containers", + "is_generator": false, + "description": "

A list of container objects.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/layouts.py#L442" + }, + "streamlit.connection": { + "name": "connection", + "signature": "st.connection(name, type=None, max_entries=None, ttl=None, **kwargs)", + "examples": "

Example 1: Inferred connection type

\n

The easiest way to create a first-party (SQL or Snowflake) connection is to use\nits default name and define the corresponding section in your secrets.toml file.\nThe following example creates a "sql"-type connection.

\n
\n[connections.sql]\ndialect = "xxx"\nhost = "xxx"\nusername = "xxx"\npassword = "xxx"\n
\n
\nimport streamlit as st\n\nconn = st.connection("sql")\n
\n

Example 2: Named connections

\n

Creating a connection with a custom name requires you to explicitly\nspecify the type. If type is not passed as a keyword argument, it must\nbe set in the appropriate section of secrets.toml. The following\nexample creates two "sql"-type connections, each with their own\ncustom name. The first defines type in the st.connection command;\nthe second defines type in secrets.toml.

\n
\n[connections.first_connection]\ndialect = "xxx"\nhost = "xxx"\nusername = "xxx"\npassword = "xxx"\n\n[connections.second_connection]\ntype = "sql"\ndialect = "yyy"\nhost = "yyy"\nusername = "yyy"\npassword = "yyy"\n
\n
\nimport streamlit as st\n\nconn1 = st.connection("first_connection", type="sql")\nconn2 = st.connection("second_connection")\n
\n

Example 3: Using a path to the connection class

\n

Passing the full module path to the connection class can be useful,\nespecially when working with a custom connection. Although this is not the\ntypical way to create first party connections, the following example\ncreates the same type of connection as one with type="sql". Note that\ntype is a string path.

\n
\n[connections.my_sql_connection]\nurl = "xxx+xxx://xxx:xxx@xxx:xxx/xxx"\n
\n
\nimport streamlit as st\n\nconn = st.connection(\n    "my_sql_connection", type="streamlit.connections.SQLConnection"\n)\n
\n

Example 4: Importing the connection class

\n

You can pass the connection class directly to the st.connection\ncommand. Doing so allows static type checking tools such as mypy to\ninfer the exact return type of st.connection. The following example\ncreates the same connection as in Example 3.

\n
\n[connections.my_sql_connection]\nurl = "xxx+xxx://xxx:xxx@xxx:xxx/xxx"\n
\n
\nimport streamlit as st\nfrom streamlit.connections import SQLConnection\n\nconn = st.connection("my_sql_connection", type=SQLConnection)\n
\n", + "description": "

Create a new connection to a data store or API, or return an existing one.

\n

Configuration options, credentials, and secrets for connections are\ncombined from the following sources:

\n
    \n
  • The keyword arguments passed to this command.
  • \n
  • The app's secrets.toml files.
  • \n
  • Any connection-specific configuration files.
  • \n
\n

The connection returned from st.connection is internally cached with\nst.cache_resource. Connection types with a scope of "global" will be shared\nbetween sessions.

\n", + "args": [ + { + "name": "name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The connection name used for secrets lookup in secrets.toml.\nStreamlit uses secrets under [connections.<name>] for the\nconnection. type will be inferred if name is one of the\nfollowing: "snowflake", "snowflake-callers-rights", or\n"sql".

\n", + "default": null + }, + { + "name": "type", + "type_name": "str, connection class, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The type of connection to create. This can be one of the following:

\n
    \n
  • None (default): Streamlit will infer the connection type from\nname. If the type is not inferable from name, the type must\nbe specified in secrets.toml instead.
  • \n
  • "snowflake": Streamlit will initialize a connection with\nSnowflakeConnection.
  • \n
  • "snowflake-callers-rights": Streamlit will initialize a\n"snowflake"-type connection, except the connection uses the\ncurrent viewer's identity tokens instead of the app's connection\nconfiguration.
  • \n
  • "sql": Streamlit will initialize a connection with\nSQLConnection.
  • \n
  • A string path to an importable class: This must be a dot-separated\nmodule path ending in the importable class. Streamlit will import the\nclass and initialize a connection with it. The class must extend\nst.connections.BaseConnection.
  • \n
  • An imported class reference: Streamlit will initialize a connection\nwith the referenced class, which must extend\nst.connections.BaseConnection.
  • \n
\n
\n

Important

\n

Connections of type "snowflake-callers-rights" only work when\nthey run in a Snowflake Snowpark Container Services environment. If\nthey are used in a local environment, they will raise exceptions.

\n

For local development, use an environment variable or secret to\nlogically switch between a "snowflake" and\n"snowflake-callers-rights" connection depending on the runtime\nenvironment.

\n
\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The maximum number of connections to keep in the cache.\nIf this is None (default), the cache is unbounded. Otherwise, when\na new entry is added to a full cache, the oldest cached entry is\nremoved.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The maximum number of seconds to keep results in the cache.\nIf this is None (default), cached results do not expire with time.

\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Connection-specific keyword arguments that are passed to the\nconnection's ._connect() method. **kwargs are typically\ncombined with (and take precedence over) key-value pairs in\nsecrets.toml. To learn more, see the specific connection's\ndocumentation.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Subclass of BaseConnection", + "is_generator": false, + "description": "

An initialized connection object of the specified type.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/connection_factory.py#L229" + }, + "streamlit.container": { + "name": "container", + "signature": "st.container(*, border=None, key=None, width=\"stretch\", height=\"content\", horizontal=False, wrap=True, horizontal_alignment=\"left\", vertical_alignment=\"top\", gap=\"small\", autoscroll=None)", + "examples": "

Example 1: Inserting elements using ``with`` notation

\n

You can use the with statement to insert any element into a\ncontainer.

\n
\nimport streamlit as st\n\nwith st.container():\n    st.write("This is inside the container")\n\n    # You can call any Streamlit command, including custom components:\n    st.bar_chart(np.random.randn(50, 3))\n\nst.write("This is outside the container")\n
\n

Example 2: Inserting elements out of order

\n

When you create a container, its position in the app remains fixed and\nyou can add elements to it at any time. This allows you to insert\nelements out of order in your app. You can also write to the container\nby calling commands directly on the container object.

\n
\nimport streamlit as st\n\ncontainer = st.container(border=True)\ncontainer.write("This is inside the container")\nst.write("This is outside the container")\n\ncontainer.write("This is inside too")\n
\n

Example 3: Grid layout with columns and containers

\n

You can create a grid with a fixed number of elements per row by using\ncolumns and containers.

\n
\nimport streamlit as st\n\nrow1 = st.columns(3)\nrow2 = st.columns(3)\n\nfor col in row1 + row2:\n    tile = col.container(height=120)\n    tile.title(":balloon:")\n
\n

Example 4: Vertically scrolling container

\n

You can create a vertically scrolling container by setting a fixed\nheight.

\n
\nimport streamlit as st\n\nlong_text = "Lorem ipsum. " * 1000\n\nwith st.container(height=300):\n    st.markdown(long_text)\n
\n

Example 5: Horizontal container

\n

You can create a row of widgets using a horizontal container. Use\nhorizontal_alignment to specify the alignment of the elements.

\n
\nimport streamlit as st\n\nflex = st.container(horizontal=True, horizontal_alignment="right")\n\nfor card in range(3):\n    flex.button(f"Button {card + 1}")\n
\n

Example 6: No-wrap horizontal container (toolbar)

\n

Use wrap=False to keep a horizontal container's elements in a single\nrow. When the elements don't fit, the container scrolls horizontally\ninstead of wrapping onto additional rows.

\n
\nimport streamlit as st\n\nwith st.container(horizontal=True, wrap=False):\n    for label in ("Edit", "Duplicate", "Archive", "Delete"):\n        st.button(label)\n
\n", + "description": "

Insert a multi-element container.

\n

Inserts an invisible container into your app that can be used to hold\nmultiple elements. This allows you to, for example, insert multiple\nelements into your app out of order.

\n

To add elements to the returned container, you can use the with\nnotation (preferred) or just call commands directly on the returned\nobject. See examples below.

\n", + "args": [ + { + "name": "border", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show a border around the container. If None (default), a\nborder is shown if the container is set to a fixed height and not\nshown otherwise.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string to give this element a stable identity. If\nthis is None (default), the element's identity will be\ndetermined based on the values of the other parameters.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the container. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the container matches the\nwidth of the parent container.
  • \n
  • "content": The width of the container matches the width of\nits content.
  • \n
  • An integer specifying the width in pixels: The container has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the container matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the container. This can be one of the following:

\n
    \n
  • "content" (default): The height of the container matches the\nheight of its content.
  • \n
  • "stretch": The height of the container matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the container is not in a parent container, the height\nof the container matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The container has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n
\n

Note

\n

Use scrolling containers sparingly. If you use scrolling\ncontainers, avoid heights that exceed 500 pixels. Otherwise,\nthe scroll surface of the container might cover the majority of\nthe screen on mobile devices, which makes it hard to scroll the\nrest of the app.

\n
\n", + "default": null + }, + { + "name": "horizontal", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to use horizontal flexbox layout. If this is False\n(default), the container's elements are laid out vertically. If\nthis is True, the container's elements are laid out\nhorizontally and, by default, wrap onto additional rows if they\ndon't fit within the container's width. Use wrap to instead\nkeep the elements in a single, horizontally scrolling row.

\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the elements in a horizontal container can wrap onto\nadditional rows. This only applies when horizontal is True.\nThis can be one of the following:

\n
    \n
  • True (default): The elements wrap onto additional rows when\nthey don't fit within the container's width.
  • \n
  • False: The elements stay in a single row. If they don't fit\nwithin the container's width, the container scrolls horizontally\ninstead of wrapping.
  • \n
\n

Setting wrap=False with horizontal=False raises an\nexception, since there is no horizontal row of elements to keep in a\nsingle, scrolling row.

\n", + "default": null + }, + { + "name": "horizontal_alignment", + "type_name": "\"left\", \"center\", \"right\", or \"distribute\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of the elements inside the container. This\ncan be one of the following:

\n
    \n
  • "left" (default): Elements are aligned to the left side of\nthe container.

    \n
  • \n
  • "center": Elements are horizontally centered inside the\ncontainer.

    \n
  • \n
  • "right": Elements are aligned to the right side of the\ncontainer.

    \n
  • \n
  • "distribute": Elements are distributed evenly in the\ncontainer. This increases the horizontal gap between elements to\nfill the width of the container. A standalone element is aligned\nto the left.

    \n

    When horizontal is False, "distribute" aligns the\nelements the same as "left".

    \n
  • \n
\n", + "default": null + }, + { + "name": "vertical_alignment", + "type_name": "\"top\", \"center\", \"bottom\", or \"distribute\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The vertical alignment of the elements inside the container. This\ncan be one of the following:

\n
    \n
  • "top" (default): Elements are aligned to the top of the\ncontainer.

    \n
  • \n
  • "center": Elements are vertically centered inside the\ncontainer.

    \n
  • \n
  • "bottom": Elements are aligned to the bottom of the\ncontainer.

    \n
  • \n
  • "distribute": Elements are distributed evenly in the\ncontainer. This increases the vertical gap between elements to\nfill the height of the container. A standalone element is aligned\nto the top.

    \n

    When horizontal is True, "distribute" aligns the\nelements the same as "top".

    \n
  • \n
\n", + "default": null + }, + { + "name": "gap", + "type_name": "\"xxsmall\", \"xsmall\", \"small\", \"medium\", \"large\", \"xlarge\", \"xxlarge\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum gap size between the elements inside the container.\nThis can be one of the following:

\n
    \n
  • "xxsmall": 0.25rem gap between the elements.
  • \n
  • "xsmall": 0.5rem gap between the elements.
  • \n
  • "small" (default): 1rem gap between the elements.
  • \n
  • "medium": 2rem gap between the elements.
  • \n
  • "large": 4rem gap between the elements.
  • \n
  • "xlarge": 6rem gap between the elements.
  • \n
  • "xxlarge": 8rem gap between the elements.
  • \n
  • A non-negative integer specifying the gap in pixels. For\nexample, gap=20 sets a 20-pixel gap.
  • \n
  • None: No gap between the elements.
  • \n
\n

The rem unit is relative to the theme.baseFontSize\nconfiguration option.

\n

The minimum gap applies to both the vertical and horizontal gaps\nbetween the elements. Elements may have larger gaps in one\ndirection if you use a distributed horizontal alignment or fixed\nheight.

\n", + "default": null + }, + { + "name": "autoscroll", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to automatically scroll to the bottom when new content is\nadded. This only has an effect when the container has a fixed\nheight (scrolling enabled). If this is None (default),\nauto-scroll is enabled when the container has a fixed height and\ncontains st.chat_message elements. If this is True,\nauto-scroll is always enabled for containers with fixed height.\nIf this is False, auto-scroll is always disabled.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/layouts.py#L103" + }, + "streamlit.data_editor": { + "name": "data_editor", + "signature": "st.data_editor(data, *, width=\"stretch\", height=\"auto\", use_container_width=None, hide_index=None, column_order=None, column_config=None, num_rows=\"fixed\", disabled=False, key=None, on_change=None, args=None, kwargs=None, row_height=None, placeholder=None)", + "examples": "

Example 1: Basic usage

\n
\nimport pandas as pd\nimport streamlit as st\n\ndf = pd.DataFrame(\n    [\n        {"command": "st.selectbox", "rating": 4, "is_widget": True},\n        {"command": "st.balloons", "rating": 5, "is_widget": False},\n        {"command": "st.time_input", "rating": 3, "is_widget": True},\n    ]\n)\nedited_df = st.data_editor(df)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n
\n

Example 2: Allowing users to add and delete rows

\n

You can allow your users to add and delete rows by setting num_rows\nto "dynamic":

\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    [\n        {"command": "st.selectbox", "rating": 4, "is_widget": True},\n        {"command": "st.balloons", "rating": 5, "is_widget": False},\n        {"command": "st.time_input", "rating": 3, "is_widget": True},\n    ]\n)\nedited_df = st.data_editor(df, num_rows="dynamic")\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n
\n

Example 3: Data editor configuration

\n

You can customize the data editor via column_config, hide_index,\ncolumn_order, or disabled:

\n
\nimport pandas as pd\nimport streamlit as st\n\ndf = pd.DataFrame(\n    [\n        {"command": "st.selectbox", "rating": 4, "is_widget": True},\n        {"command": "st.balloons", "rating": 5, "is_widget": False},\n        {"command": "st.time_input", "rating": 3, "is_widget": True},\n    ]\n)\nedited_df = st.data_editor(\n    df,\n    column_config={\n        "command": "Streamlit Command",\n        "rating": st.column_config.NumberColumn(\n            "Your rating",\n            help="How much do you like this command (1-5)?",\n            min_value=1,\n            max_value=5,\n            step=1,\n            format="%d \u2b50",\n        ),\n        "is_widget": "Widget ?",\n    },\n    disabled=["command", "is_widget"],\n    hide_index=True,\n)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n
\n", + "description": "

Display a data editor widget.

\n

The data editor widget allows you to edit dataframes and many other data structures in a table-like UI.

\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The data to edit in the data editor.

\n
\n

Note

\n
    \n
  • Styles from pandas.Styler will only be applied to non-editable columns.
  • \n
  • Text and number formatting from column_config always takes\nprecedence over text and number formatting from pandas.Styler.
  • \n
  • If your dataframe starts with an empty column, you should set\nthe column datatype in the underlying dataframe to ensure your\nintended datatype, especially for integers versus floats.
  • \n
  • Mixing data types within a column can make the column uneditable.
  • \n
  • Additionally, the following data types are not yet supported for editing:\ncomplex, tuple, bytes, bytearray,\nmemoryview, dict, set, frozenset,\nfractions.Fraction, pandas.Interval, and\npandas.Period.
  • \n
  • To prevent overflow in JavaScript, columns containing\ndatetime.timedelta and pandas.Timedelta values will\ndefault to uneditable, but this can be changed through column\nconfiguration.
  • \n
\n
\n", + "default": "to" + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the data editor. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the editor matches the\nwidth of the parent container.
  • \n
  • "content": The width of the editor matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The editor has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the editor matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"auto\", \"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the data editor. This can be one of the following:

\n
    \n
  • "auto" (default): Streamlit sets the height to show at most\nten rows.
  • \n
  • "content": The height of the editor matches the height of\nits content. The height is capped at 10,000 pixels to prevent\nperformance issues with very large dataframes.
  • \n
  • "stretch": The height of the editor expands to fill the\navailable vertical space in its parent container. When multiple\nelements with stretch height are in the same container, they\nshare the available vertical space evenly. The editor will\nmaintain a minimum height to display up to three rows, but\notherwise won't exceed the available height in its parent\ncontainer.
  • \n
  • An integer specifying the height in pixels: The editor has a\nfixed height.
  • \n
\n

Vertical scrolling within the editor is enabled when the height\ndoes not accommodate all rows.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override width with the width of the parent\ncontainer. If this is True (default), Streamlit sets the width\nof the data editor to match the width of the parent container. If\nthis is False, Streamlit sets the data editor's width according\nto width.

\n", + "default": null + }, + { + "name": "hide_index", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to hide the index column(s). If hide_index is None\n(default), the visibility of index columns is automatically\ndetermined based on the data.

\n", + "default": null + }, + { + "name": "column_order", + "type_name": "Iterable[str] or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The ordered list of columns to display. If this is None\n(default), Streamlit displays all columns in the order inherited\nfrom the underlying data structure. If this is a list, the\nindicated columns will display in the order they appear within the\nlist. Columns may be omitted or repeated within the list.

\n

For example, column_order=("col2", "col1") will display\n"col2" first, followed by "col1", and will hide all other\nnon-index columns.

\n

column_order does not accept positional column indices and\ncan't move the index column(s).

\n
\n

Note

\n

Columns omitted from column_order are hidden by default\nbut can still be shown by the user via the column visibility\nmenu in the table toolbar. If a column contains sensitive data\nthat should not be exposed to the user, remove it from the\ndata before passing it to the function.

\n
\n", + "default": "but" + }, + { + "name": "column_config", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Configuration to customize how columns are displayed. If this is\nNone (default), columns are styled based on the underlying data\ntype of each column.

\n

Column configuration can modify column names, visibility, type,\nwidth, format, editing properties like min/max, and more. If this\nis a dictionary, the keys are column names (strings) and/or\npositional column indices (integers), and the values are one of the\nfollowing:

\n
    \n
  • None to hide the column. Hidden columns can still be shown\nby the user via the table toolbar.
  • \n
  • A string to set the display label of the column.
  • \n
  • One of the column types defined under st.column_config. For\nexample, to show a column as dollar amounts, use\nst.column_config.NumberColumn("Dollar values", format="$ %d").\nSee more info on the available column types and config options\nhere.
  • \n
\n

To configure the index column(s), use "_index" as the column\nname, or use a positional column index where 0 refers to the\nfirst index column.

\n", + "default": null + }, + { + "name": "num_rows", + "type_name": "\"fixed\", \"dynamic\", \"add\", or \"delete\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies if the user can add and/or delete rows in the data editor.

\n
    \n
  • "fixed" (default): The user can't add or delete rows.
  • \n
  • "dynamic": The user can add and delete rows, and column\nsorting is disabled.
  • \n
  • "add": The user can only add rows (no deleting), and column\nsorting is disabled.
  • \n
  • "delete": The user can only delete rows (no adding), and\ncolumn sorting remains enabled.
  • \n
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or Iterable[str | int]", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Controls the editing of columns. This can be one of the following:

\n
    \n
  • False (default): All columns that support editing are editable.
  • \n
  • True: All columns are disabled for editing.
  • \n
  • An Iterable of column names and/or positional indices: The\nspecified columns are disabled for editing while the remaining\ncolumns are editable where supported. For example,\ndisabled=["col1", "col2"] will disable editing for the\ncolumns named "col1" and "col2".
  • \n
\n

To disable editing for the index column(s), use "_index" as the\ncolumn name, or use a positional column index where 0 refers to\nthe first index column.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key.

\n

A key lets you access the widget's value via\nst.session_state[key] (read-only). For more details, see\nWidget behavior.

\n

The value in Session State is a DataEditorState object that\ndescribes the pending edits. To use this type in an annotation,\nimport it from streamlit.typing.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n
\n

Note

\n

Assigning a key stabilizes the widget's identity and preserves\nedits across reruns when the data's values change. This\napplies only with num_rows="fixed" and only while the data's\nstructure stays the same; edits reset when the columns, column\ntypes, row count, or index labels change. Edits are matched by\nrow position, so use a meaningful index if edits should follow\nspecific rows when the data is reordered. Omit key to reset\nall edits whenever the data changes.

\n
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when this data_editor's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "row_height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of each row in the data editor in pixels. If row_height\nis None (default), Streamlit will use a default row height,\nwhich fits one line of text.

\n", + "default": "row" + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The text that should be shown for missing values. If this is\nNone (default), missing values are displayed as "None". To\nleave a cell empty, use an empty string (""). Other common\nvalues are "null", "NaN" and "-".

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame, pandas.Series, pyarrow.Table, numpy.ndarray, list, set, tuple, or dict.", + "is_generator": false, + "description": "

The edited data. The edited data is returned in its original data type if\nit corresponds to any of the supported return types. All other data types\nare returned as a pandas.DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/data_editor.py#L783" + }, + "streamlit.dataframe": { + "name": "dataframe", + "signature": "st.dataframe(data=None, width=\"stretch\", height=\"auto\", *, use_container_width=None, hide_index=None, column_order=None, column_config=None, key=None, on_select=\"ignore\", selection_mode=\"multi-row\", selection_default=None, row_height=None, placeholder=None, lazy=None)", + "examples": "

Example 1: Display a dataframe

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    rng(0).standard_normal((50, 20)), columns=("col %d" % i for i in range(20))\n)\n\nst.dataframe(df)\n
\n

Example 2: Use Pandas Styler

\n

You can also pass a Pandas Styler object to change the style of\nthe rendered DataFrame:

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    rng(0).standard_normal((10, 20)), columns=("col %d" % i for i in range(20))\n)\n\nst.dataframe(df.style.highlight_max(axis=0))\n
\n

Example 3: Use column configuration

\n

You can customize a dataframe via column_config, hide_index, or column_order.

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    {\n        "name": ["Roadmap", "Extras", "Issues"],\n        "url": [\n            "https://roadmap.streamlit.app",\n            "https://extras.streamlit.app",\n            "https://issues.streamlit.app",\n        ],\n        "stars": rng(0).integers(0, 1000, size=3),\n        "views_history": rng(0).integers(0, 5000, size=(3, 30)).tolist(),\n    }\n)\n\nst.dataframe(\n    df,\n    column_config={\n        "name": "App name",\n        "stars": st.column_config.NumberColumn(\n            "Github Stars",\n            help="Number of stars on GitHub",\n            format="%d \u2b50",\n        ),\n        "url": st.column_config.LinkColumn("App URL"),\n        "views_history": st.column_config.LineChartColumn(\n            "Views (past 30 days)", y_min=0, y_max=5000\n        ),\n    },\n    hide_index=True,\n)\n
\n

Example 4: Customize your index

\n

You can use column configuration to format your index.

\n
\nfrom datetime import datetime, date\nimport numpy as np\nimport pandas as pd\nimport streamlit as st\n\n@st.cache_data\ndef load_data():\n    year = datetime.now().year\n    df = pd.DataFrame(\n        {\n            "Date": [date(year, month, 1) for month in range(1, 4)],\n            "Total": np.random.randint(1000, 5000, size=3),\n        }\n    )\n    df.set_index("Date", inplace=True)\n    return df\n\ndf = load_data()\nconfig = {\n    "_index": st.column_config.DateColumn("Month", format="MMM YYYY"),\n    "Total": st.column_config.NumberColumn("Total ($)"),\n}\n\nst.dataframe(df, column_config=config)\n
\n", + "description": "

Display a dataframe as an interactive table.

\n

This command works with a wide variety of collection-like and\ndataframe-like object types.

\n

To disable data export (CSV download and clipboard copy), set the\nclient.disableDataExport configuration option to True.

\n", + "args": [ + { + "name": "data", + "type_name": "dataframe-like, collection-like, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The data to display.

\n

Dataframe-like objects include dataframe and series objects from\npopular libraries like Dask, Modin, Numpy, pandas, Polars, PyArrow,\nSnowpark, Xarray, and more. You can use database cursors and\nclients that comply with the\nPython Database API Specification v2.0 (PEP 249). Additionally, you can use\nanything that supports the Python dataframe interchange protocol.

\n

For example, you can use the following:

\n
    \n
  • pandas.DataFrame, pandas.Series, pandas.Index,\npandas.Styler, and pandas.Array
  • \n
  • polars.DataFrame, polars.LazyFrame, and polars.Series
  • \n
  • snowflake.snowpark.dataframe.DataFrame,\nsnowflake.snowpark.table.Table
  • \n
\n

If a data type is not recognized, Streamlit will convert the object\nto a pandas.DataFrame or pyarrow.Table using a\n.to_pandas() or .to_arrow() method, respectively, if\navailable.

\n

If data is a pandas.Styler, it will be used to style its\nunderlying pandas.DataFrame. Streamlit supports custom cell\nvalues, colors, and font weights. It does not support some of the\nmore exotic styling options, like bar charts, hovering, and\ncaptions. For these styling options, use column configuration\ninstead. Text and number formatting from column_config always\ntakes precedence over text and number formatting from pandas.Styler.

\n

Collection-like objects include all Python-native Collection\ntypes, such as dict, list, and set.

\n

If data is None, Streamlit renders an empty table.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The width of the dataframe element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"auto\", \"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The height of the dataframe element. This can be one of the following:

\n
    \n
  • "auto" (default): Streamlit sets the height to show at most\nten rows.
  • \n
  • "content": The height of the element matches the height of\nits content. The height is capped at 10,000 pixels to prevent\nperformance issues with very large dataframes.
  • \n
  • "stretch": The height of the element expands to fill the\navailable vertical space in its parent container. When multiple\nelements with stretch height are in the same container, they\nshare the available vertical space evenly. The dataframe will\nmaintain a minimum height to display up to three rows, but\notherwise won't exceed the available height in its parent\ncontainer.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height.
  • \n
\n

Vertical scrolling within the dataframe element is enabled when the\nheight does not accommodate all rows.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override width with the width of the parent\ncontainer. If this is True (default), Streamlit sets the width\nof the dataframe to match the width of the parent container. If\nthis is False, Streamlit sets the dataframe's width according\nto width.

\n", + "default": null + }, + { + "name": "hide_index", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to hide the index column(s). If hide_index is None\n(default), the visibility of index columns is automatically\ndetermined based on the data and other configurations.

\n", + "default": null + }, + { + "name": "column_order", + "type_name": "Iterable[str] or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The ordered list of columns to display. If this is None\n(default), Streamlit displays all columns in the order inherited\nfrom the underlying data structure. If this is a list, the\nindicated columns will display in the order they appear within the\nlist. Columns may be omitted or repeated within the list.

\n

For example, column_order=("col2", "col1") will display\n"col2" first, followed by "col1", and will hide all other\nnon-index columns.

\n

column_order does not accept positional column indices and\ncan't move the index column(s).

\n
\n

Note

\n

Columns omitted from column_order are hidden by default\nbut can still be shown by the user via the column visibility\nmenu in the table toolbar. If a column contains sensitive data\nthat should not be exposed to the user, remove it from the\ndata before passing it to the function.

\n
\n", + "default": "but" + }, + { + "name": "column_config", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Configuration to customize how columns are displayed. If this is\nNone (default), columns are styled based on the underlying data\ntype of each column.

\n

Column configuration can modify column names, visibility, type,\nwidth, format, and more. If this is a dictionary, the keys are\ncolumn names (strings) and/or positional column indices (integers),\nand the values are one of the following:

\n
    \n
  • None to hide the column. Hidden columns can still be shown\nby the user via the table toolbar.
  • \n
  • A string to set the display label of the column.
  • \n
  • One of the column types defined under st.column_config. For\nexample, to show a column as dollar amounts, use\nst.column_config.NumberColumn("Dollar values", format="$ %d").\nSee more info on the available column types and config options\nhere.
  • \n
\n

To configure the index column(s), use "_index" as the column\nname, or use a positional column index where 0 refers to the\nfirst index column.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string to use for giving this element a stable\nidentity. If this is None (default), the element's identity\nwill be determined based on the values of the other parameters.

\n

If selections are activated, a key lets you read or update the\nselection state via st.session_state[key]. The value in\nSession State must be a dictionary consistent with the\nDataframeState schema. For more details, see Widget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\" or \"rerun\" or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the dataframe should respond to user selection events. This\ncontrols whether or not the dataframe behaves like an input widget.\non_select can be one of the following:

\n
    \n
  • "ignore" (default): Streamlit will not react to any selection\nevents in the dataframe. The dataframe will not behave like an\ninput widget.
  • \n
  • "rerun": Streamlit will rerun the app when the user selects\nrows, columns, or cells in the dataframe. In this case,\nst.dataframe will return the selection data as a dictionary.
  • \n
  • A callable: Streamlit will rerun the app and execute the\ncallable as a callback function before the rest of the app.\nIn this case, st.dataframe will return the selection data\nas a dictionary.
  • \n
\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "\"single-row\", \"single-row-required\", \"multi-row\", \"single-column\", \"multi-column\", \"single-cell\", \"multi-cell\", or Iterable of these", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The types of selections Streamlit should allow when selections are\nenabled with on_select. This can be one of the following:

\n
    \n
  • "multi-row" (default): Multiple rows can be selected at a time.
  • \n
  • "single-row": Only one row can be selected at a time.
  • \n
  • "single-row-required": Exactly one row must always be selected\n(radio-like behavior). Auto-selects the first row if no default\nis given.
  • \n
  • "multi-column": Multiple columns can be selected at a time.
  • \n
  • "single-column": Only one column can be selected at a time.
  • \n
  • "multi-cell": A rectangular range of cells can be selected.
  • \n
  • "single-cell": Only one cell can be selected at a time.
  • \n
  • An Iterable of the above options: The table will allow\nselection based on the modes specified. For example, to allow the\nuser to select multiple rows and multiple cells, use\n["multi-row", "multi-cell"].
  • \n
\n

When column selections are enabled, column sorting is disabled.

\n", + "default": "given" + }, + { + "name": "selection_default", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The default selection state to apply on first render when selections\nare activated and no prior selection is stored. This uses the same\nschema as st.session_state[key] for selections, for example:\n{"selection": {"rows": [0, 2]}}.

\n

selection_default is only applied when on_select is not\n"ignore". It does not override user selections on subsequent\nruns, and multi-cell selections cannot be set programmatically.

\n", + "default": "selection" + }, + { + "name": "row_height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of each row in the dataframe in pixels. If row_height\nis None (default), Streamlit will use a default row height,\nwhich fits one line of text.

\n", + "default": "row" + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The text that should be shown for missing values. If this is\nNone (default), missing values are displayed as "None". To\nleave a cell empty, use an empty string (""). Other common\nvalues are "null", "NaN" and "-".

\n", + "default": null + }, + { + "name": "lazy", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to load rows lazily from the app server instead of sending\nthe full dataset to the browser. When rows are loaded lazily,\nStreamlit sends only the rows the user is viewing and fetches more\nas they scroll or sort. This is useful for datasets that are too\nlarge to send to the browser all at once. It can also make your app\nfaster on reruns, since far less data needs to be transferred from\nthe app server to the client (browser). This can be one of the\nfollowing:

\n
    \n
  • None (default): Streamlit chooses automatically. In-memory\npandas and polars dataframes and pyarrow.Table objects\nare loaded lazily when they have more than 150,000 rows.\nUnevaluated objects, such as a Polars LazyFrame, are loaded\nlazily when they have more than 10,000 rows. Everything else is\nloaded eagerly, including the capped preview for unsupported\nunevaluated objects.
  • \n
  • True: Always load rows lazily. For inputs that support lazy\naccess natively (for example, a Polars LazyFrame), Streamlit\nreads rows directly from the source. Other supported inputs are\nheld in the app server's memory and served in chunks. Small\ndatasets (1,000 rows or fewer) are still loaded eagerly as an\noptimization. If lazy loading is incompatible with the data or the\nother parameters (for example, dataframes with multi-level,\nMultiIndex, column headers), Streamlit raises a\nStreamlitAPIException.
  • \n
  • False: Never load rows lazily. Streamlit loads data eagerly\nand uses the capped preview for unevaluated data objects.
  • \n
\n
\n

Note

\n

When rows are loaded lazily, search, CSV download, selections\n(on_select), and pandas.Styler styling are not\nsupported. Server-side sorting is supported. To use these\nfeatures, set lazy=False.

\n
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or DataframeState", + "is_generator": false, + "description": "

If on_select is "ignore" (default), this command returns an\ninternal placeholder for the dataframe element. Otherwise, this\ncommand returns a DataframeState object. This object is\ndictionary-like and supports both key and attribute notation. To\nuse this type in an annotation, import it from\nstreamlit.typing.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/arrow.py#L655" + }, + "streamlit.date_input": { + "name": "date_input", + "signature": "st.date_input(label, value=\"today\", min_value=None, max_value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, format=\"YYYY/MM/DD\", disabled=False, label_visibility=\"visible\", width=\"stretch\", bind=None, persist_state=None)", + "examples": "

Example 1: Basic usage

\n
\nimport datetime\nimport streamlit as st\n\nd = st.date_input("When's your birthday", datetime.date(2019, 7, 6))\nst.write("Your birthday is:", d)\n
\n

Example 2: Date range

\n
\nimport datetime\nimport streamlit as st\n\ntoday = datetime.datetime.now()\nnext_year = today.year + 1\njan_1 = datetime.date(next_year, 1, 1)\ndec_31 = datetime.date(next_year, 12, 31)\n\nd = st.date_input(\n    "Select your vacation for next year",\n    (jan_1, datetime.date(next_year, 1, 7)),\n    jan_1,\n    dec_31,\n    format="MM.DD.YYYY",\n)\nd\n
\n

Example 3: Empty initial value

\n

To initialize an empty date input, use None as the value:

\n
\nimport datetime\nimport streamlit as st\n\nd = st.date_input("When's your birthday", value=None)\nst.write("Your birthday is:", d)\n
\n", + "description": "

Display a date input widget.

\n

The date input widget can be configured to accept a single date or a\ndate range. The first day of the week is determined from the user's\nlocale in their browser.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this date input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "\"today\", datetime.date, datetime.datetime, str, list/tuple of these, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value of this widget when it first renders. This can be one of\nthe following:

\n
    \n
  • "today" (default): The widget initializes with the current date.
  • \n
  • A datetime.date or datetime.datetime object: The widget\ninitializes with the given date, ignoring any time if included.
  • \n
  • An ISO-formatted date (YYYY-MM-DD) or datetime\n(YYYY-MM-DD hh:mm:ss) string: The widget initializes with the\ngiven date, ignoring any time if included.
  • \n
  • A list or tuple with up to two of the above: The widget will\ninitialize with the given date interval and return a tuple of the\nselected interval. You can pass an empty list to initialize the\nwidget with an empty interval or a list with one value to\ninitialize only the beginning date of the iterval.
  • \n
  • None: The widget initializes with no date and returns\nNone until the user selects a date.
  • \n
\n", + "default": null + }, + { + "name": "min_value", + "type_name": "\"today\", datetime.date, datetime.datetime, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The minimum selectable date. This can be any of the date types\naccepted by value, except list or tuple.

\n

If this is None (default), the minimum selectable date is ten\nyears before the initial value. If the initial value is an\ninterval, the minimum selectable date is ten years before the start\ndate of the interval. If no initial value is set, the minimum\nselectable date is ten years before today.

\n", + "default": null + }, + { + "name": "max_value", + "type_name": "\"today\", datetime.date, datetime.datetime, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The maximum selectable date. This can be any of the date types\naccepted by value, except list or tuple.

\n

If this is None (default), the maximum selectable date is ten\nyears after the initial value. If the initial value is an interval,\nthe maximum selectable date is ten years after the end date of the\ninterval. If no initial value is set, the maximum selectable date\nis ten years after today.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing format resets the widget even when a key is\nprovided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this date_input's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A format string controlling how the interface should display dates.\nSupports "YYYY/MM/DD" (default), "DD/MM/YYYY", or "MM/DD/YYYY".\nYou may also use a period (.) or hyphen (-) as separators.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the date input if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the date input widget. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

Dates use ISO 8601 format (YYYY-MM-DD) in the URL. Invalid\nquery parameter values are ignored and removed from the URL.\nIf value is None, an empty query parameter (e.g.,\n?vacation=) clears the widget. Date ranges use repeated\nparameters (e.g.,\n?vacation=2025-01-01&vacation=2025-01-31).

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "datetime.date or a tuple with 0-2 dates or None", + "is_generator": false, + "description": "

The current value of the date input widget or None if no date has been\nselected.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/time_widgets.py#L1604" + }, + "streamlit.datetime_input": { + "name": "datetime_input", + "signature": "st.datetime_input(label, value=\"now\", min_value=None, max_value=None, *, key=None, help=None, on_change=None, args=None, kwargs=None, format=\"YYYY/MM/DD\", step=0:15:00, disabled=False, label_visibility=\"visible\", width=\"stretch\", bind=None, persist_state=None)", + "examples": "

Example 1: Basic usage

\n
\nimport datetime\nimport streamlit as st\n\nevent_time = st.datetime_input(\n    "Schedule your event",\n    datetime.datetime(2025, 11, 19, 16, 45),\n)\nst.write("Event scheduled for", event_time)\n
\n

Example 2: Empty initial value

\n

To initialize an empty datetime input, use None as the value:

\n
\nimport datetime\nimport streamlit as st\n\nevent_time = st.datetime_input("Schedule your event", value=None)\nst.write("Event scheduled for", event_time)\n
\n", + "description": "

Display a date and time input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this datetime input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "\"now\", datetime.datetime, datetime.date, datetime.time, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value of this widget when it first renders. This can be one of\nthe following:

\n
    \n
  • "now" (default): The widget initializes with the current date and time.
  • \n
  • A datetime.datetime object: The widget initializes with the given\ndatetime, stripping any timezone information.
  • \n
  • A datetime.date object: The widget initializes with the given date\nat 00:00.
  • \n
  • A datetime.time object: The widget initializes with today's date\nand the provided time.
  • \n
  • An ISO-formatted datetime (YYYY-MM-DD hh:mm[:ss]) or date/time\nstring: The widget initializes with the parsed value.
  • \n
  • None: The widget initializes with no value and returns None\nuntil the user selects a datetime.
  • \n
\n", + "default": null + }, + { + "name": "min_value", + "type_name": "\"now\", datetime.datetime, datetime.date, datetime.time, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The minimum selectable datetime. This can be any of the datetime\ntypes accepted by value.

\n

If this is None (default), the minimum selectable datetime is\nten years before the initial value. If no initial value is set, the\nminimum selectable datetime is ten years before today at 00:00.

\n", + "default": null + }, + { + "name": "max_value", + "type_name": "\"now\", datetime.datetime, datetime.date, datetime.time, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The maximum selectable datetime. This can be any of the datetime\ntypes accepted by value.

\n

If this is None (default), the maximum selectable datetime is\nten years after the initial value. If no initial value is set, the\nmaximum selectable datetime is ten years after today at 23:59.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing format or step resets the widget even\nwhen a key is provided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when this datetime_input's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A format string controlling how the interface displays dates.\nSupports "YYYY/MM/DD" (default), "DD/MM/YYYY", or "MM/DD/YYYY".\nYou may also use a period (.) or hyphen (-) as separators. This\ndoesn't affect the time format.

\n", + "default": null + }, + { + "name": "step", + "type_name": "int or timedelta", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The stepping interval in seconds. This defaults to 900 (15\nminutes). You can also pass a datetime.timedelta object. The\nvalue must be between 60 seconds and 23 hours.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the widget if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the widget. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the widget matches the width\nof the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a fixed\nwidth. If the specified width is greater than the width of the\nparent container, the widget matches the container width.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

Datetimes use ISO 8601 format (YYYY-MM-DDThh:mm) in the URL.\nInvalid query parameter values are ignored and removed from\nthe URL. If value is None, an empty query parameter\n(e.g., ?my_key=) clears the widget.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "datetime.datetime or None", + "is_generator": false, + "description": "

The current value of the datetime input widget (without timezone)\nor None if no value has been selected.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/time_widgets.py#L1129" + }, + "streamlit.dialog": { + "name": "dialog", + "signature": "st.dialog(title, *, width=\"small\", dismissible=True, icon=None, on_dismiss=\"ignore\")", + "examples": "

The following example demonstrates the basic usage of @st.dialog.\nIn this app, clicking "A" or "B" will open a modal dialog and prompt you\nto enter a reason for your vote. In the modal dialog, click "Submit" to record\nyour vote into Session State and rerun the app. This will close the modal dialog\nsince the dialog function is not called during the full-script rerun.

\n
\nimport streamlit as st\n\n@st.dialog("Cast your vote")\ndef vote(item):\n    st.write(f"Why is {item} your favorite?")\n    reason = st.text_input("Because...")\n    if st.button("Submit"):\n        st.session_state.vote = {"item": item, "reason": reason}\n        st.rerun()\n\nif "vote" not in st.session_state:\n    st.write("Vote for your favorite")\n    if st.button("A"):\n        vote("A")\n    if st.button("B"):\n        vote("B")\nelse:\n    f"You voted for {st.session_state.vote['item']} because {st.session_state.vote['reason']}"\n
\n", + "description": "

Function decorator to create a modal dialog.

\n

A function decorated with @st.dialog becomes a dialog\nfunction. When you call a dialog function, Streamlit inserts a modal dialog\ninto your app. Streamlit element commands called within the dialog function\nrender inside the modal dialog.

\n

The dialog function can accept arguments that can be passed when it is\ncalled. Any values from the dialog that need to be accessed from the wider\napp should generally be stored in Session State.

\n

If a dialog is dismissible, a user can dismiss it by clicking outside of\nit, clicking the "X" in its upper-right corner, or pressing ESC on\ntheir keyboard. You can configure whether this triggers a rerun of the app\nby setting the on_dismiss parameter.

\n

If a dialog is not dismissible, it must be closed programmatically by\ncalling st.rerun() inside the dialog function. This is useful when you\nwant to ensure that the dialog is always closed programmatically, such as\nwhen the dialog contains a form that must be submitted before closing.

\n

st.dialog inherits behavior from st.fragment.\nWhen a user interacts with an input widget created inside a dialog function,\nStreamlit only reruns the dialog function instead of the full script.

\n

Calling st.sidebar in a dialog function is not supported.

\n

Dialog code can interact with Session State, imported modules, and other\nStreamlit elements created outside the dialog. Note that these interactions\nare additive across multiple dialog reruns. You are responsible for\nhandling any side effects of that behavior.

\n
\n

Warning

\n

Only one dialog function may be called in a script run, which means\nthat only one dialog can be open at any given time.

\n
\n", + "args": [ + { + "name": "title", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The title to display at the top of the modal dialog. It cannot be empty.

\n

The title can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the modal dialog. This can be one of the following:

\n
    \n
  • "small" (default): The modal dialog will be a maximum of 500\npixels wide.
  • \n
  • "medium": The modal dialog will be up to 750 pixels wide.
  • \n
  • "large": The modal dialog will be up to 1280 pixels wide.
  • \n
\n", + "default": null + }, + { + "name": "dismissible", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the modal dialog can be dismissed by the user. If this is\nTrue (default), the user can dismiss the dialog by clicking\noutside of it, clicking the "X" in its upper-right corner, or\npressing ESC on their keyboard. If this is False, the "X"\nin the upper-right corner is hidden and the dialog must be closed\nprogrammatically by calling st.rerun() inside the dialog function.

\n
\n

Note

\n

Setting dismissible to False does not guarantee that all\ninteractions in the main app are blocked. Don't rely on\ndismissible for security-critical checks.

\n
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the dialog title. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "on_dismiss", + "type_name": "\"ignore\", \"rerun\", or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the dialog should respond to dismissal events.\nThis can be one of the following:

\n
    \n
  • "ignore" (default): Streamlit will not rerun the app when the\nuser dismisses the dialog.
  • \n
  • "rerun": Streamlit will rerun the app when the user dismisses\nthe dialog.
  • \n
  • A callable: Streamlit will rerun the app when the user dismisses\nthe dialog and execute the callable as a callback function\nbefore the rest of the app.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/dialog_decorator.py#L142" + }, + "streamlit.divider": { + "name": "divider", + "signature": "st.divider(*, width=\"stretch\")", + "examples": "
\nimport streamlit as st\n\nst.divider()\n
\n", + "description": "

Display a horizontal rule.

\n
\n

Note

\n

You can achieve the same effect with st.write("---") or\neven just "---" in your script (via magic).

\n
\n", + "args": [ + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the divider element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/markdown.py#L418" + }, + "streamlit.download_button": { + "name": "download_button", + "signature": "st.download_button(label, data, file_name=None, mime=None, key=None, help=None, on_click=\"rerun\", args=None, kwargs=None, *, type=\"secondary\", icon=None, icon_position=\"left\", disabled=False, use_container_width=None, width=\"content\", shortcut=None, wrap=None)", + "examples": "

Example 1: Download a dataframe as a CSV file

\n

When working with a large dataframe, it's recommended to fetch your\ndata with a cached function. When working with a download button, it's\nsimilarly recommended to convert your data into a downloadable format\nwith a cached function. Caching ensures that the app reruns\nefficiently.

\n
\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\n@st.cache_data\ndef get_data():\n    df = pd.DataFrame(\n        np.random.randn(50, 20), columns=("col %d" % i for i in range(20))\n    )\n    return df\n\n@st.cache_data\ndef convert_for_download(df):\n    return df.to_csv().encode("utf-8")\n\ndf = get_data()\ncsv = convert_for_download(df)\n\nst.download_button(\n    label="Download CSV",\n    data=csv,\n    file_name="data.csv",\n    mime="text/csv",\n    icon=":material/download:",\n)\n
\n

Example 2: Download a string as a text file

\n

If you pass a string to the data argument, Streamlit will\nautomatically use the "text/plain" MIME type.

\n

When you have a widget (like a text area) affecting the value of your\ndownload, it's recommended to use another button to prepare the\ndownload. In this case, use on_click="ignore" in your download\nbutton to prevent the download button from rerunning your app. This\nturns the download button into a frontend-only element that can be\nnested in another button.

\n

Without a preparation button, a user can type something into the text\narea and immediately click the download button. Because a download is\ninitiated concurrently with the app rerun, this can create a race-like\ncondition where the user doesn't see the updated data in their\ndownload.

\n
\n

Important

\n

Even when you prevent your download button from triggering a rerun,\nanother widget with a pending change can still trigger a rerun. For\nexample, if a text area has a pending change when a user clicks a\ndownload button, the text area will trigger a rerun.

\n
\n
\nimport streamlit as st\n\nmessage = st.text_area("Message", value="Lorem ipsum.\\nStreamlit is cool.")\n\nif st.button("Prepare download"):\n    st.download_button(\n        label="Download text",\n        data=message,\n        file_name="message.txt",\n        on_click="ignore",\n        type="primary",\n        icon=":material/download:",\n    )\n
\n

Example 3: Download a file

\n

Use a context manager to open and read a local file on your Streamlit\nserver. Pass the io.BufferedReader object directly to data.\nRemember to specify the MIME type if you don't want the default\ntype of "application/octet-stream" for generic binary data. In the\nexample below, the MIME type is set to "image/png" for a PNG file.

\n
\nimport streamlit as st\n\nwith open("flower.png", "rb") as file:\n    st.download_button(\n        label="Download image",\n        data=file,\n        file_name="flower.png",\n        mime="image/png",\n    )\n
\n

Example 4: Generate the data on-click with a callable

\n

Pass a callable to data to generate the bytes lazily when the user\nclicks the button. Streamlit commands inside this callable are ignored.\nThe callable can't accept any arguments and must return a file-like\nobject.

\n
\nimport streamlit as st\nimport time\n\ndef make_report():\n    time.sleep(1)\n    return "col1,col2\\n1,2\\n3,4".encode("utf-8")\n\nst.download_button(\n    label="Download report",\n    data=make_report,\n    file_name="report.csv",\n    mime="text/csv",\n)\n
\n", + "description": "

Display a download button widget.

\n

This is useful when you would like to provide a way for your users\nto download a file directly from your app.

\n

If you pass the data directly to the data parameter, then the data\nis stored in-memory while the user is connected. It's a good idea to\nkeep file sizes under a couple hundred megabytes to conserve memory or\nuse deferred data generation by passing a callable to the data\nparameter.

\n

If you want to prevent your app from rerunning when a user clicks the\ndownload button, wrap the download button in a fragment.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this button is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "data", + "type_name": "str, bytes, file-like, or callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The contents of the file to be downloaded or a callable that\nreturns the contents of the file.

\n

File contents can be a string, bytes, or file-like object.\nFile-like objects include io.BytesIO, io.StringIO, or any\nclass that implements the abstract base class io.RawIOBase.

\n

If a callable is passed, it is executed when the user clicks\nthe download button and runs on a separate thread from the\nresulting script rerun. This deferred generation is helpful for\nlarge files to avoid blocking the page script. The callable can't\naccept any arguments. If any Streamlit commands are executed inside\nthe callable, they will be ignored.

\n

To prevent unnecessary recomputation, use caching when converting\nyour data for download. For more information, see the Example 1\nbelow.

\n", + "default": null + }, + { + "name": "file_name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string to use as the name of the file to be downloaded,\nsuch as "my_file.csv". If not specified, the name will be\nautomatically generated.

\n", + "default": null + }, + { + "name": "mime", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The MIME type of the data. If this is None (default), Streamlit\nsets the MIME type depending on the value of data as follows:

\n
    \n
  • If data is a file object with a string name attribute\n(e.g. a file opened with open()), Streamlit first tries to\nguess the MIME type from the file name (file_name if\nspecified, otherwise data.name).
  • \n
  • If data is a string or textual file (i.e. str or\nio.TextIOWrapper object), Streamlit uses the "text/plain"\nMIME type.
  • \n
  • If data is a binary file or bytes (i.e. bytes,\nio.BytesIO, io.BufferedReader, or io.RawIOBase\nobject), Streamlit uses the "application/octet-stream" MIME type.
  • \n
\n

For more information about MIME types, see\nhttps://www.iana.org/assignments/media-types/media-types.xhtml.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you access the widget's value via\nst.session_state[key] (read-only). For more details, see\nWidget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed when the button is hovered over. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable, \"rerun\", \"ignore\", or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

How the button should respond to user interaction. This controls\nwhether or not the button triggers a rerun and if a callback\nfunction is called. This can be one of the following values:

\n
    \n
  • "rerun" (default): The user downloads the file and the app\nreruns. No callback function is called.
  • \n
  • "ignore": The user downloads the file and the app doesn't\nrerun. No callback function is called.
  • \n
  • A callable: The user downloads the file and app reruns. The\ncallable is called before the rest of the app.
  • \n
  • None: This is same as on_click="rerun". This value exists\nfor backwards compatibility and shouldn't be used.
  • \n
\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string that specifies the button type. This can be one\nof the following:

\n
    \n
  • "primary": The button's background is the app's primary color\nfor additional emphasis.
  • \n
  • "secondary" (default): The button's background coordinates\nwith the app's background color for normal emphasis.
  • \n
  • "tertiary": The button is plain text without a border or\nbackground for subtlety.
  • \n
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "icon_position", + "type_name": "\"left\" or \"right\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The position of the icon relative to the button label. This\ndefaults to "left".

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the download button if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch". For use_container_width=False, use\nwidth="content".

\n" + }, + "description": "

Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its contents. If use_container_width is\nTrue, the width of the button matches its parent container.

\n

In both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the download button. This can be one of the following:

\n
    \n
  • "content" (default): The width of the button matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the button matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The button has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the button matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "shortcut", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional keyboard shortcut that triggers the button. This can be\none of the following strings:

\n
    \n
  • A single alphanumeric key like "K" or "4".
  • \n
  • A function key like "F11".
  • \n
  • A special key like "Enter", "Esc", or "Tab".
  • \n
  • Any of the above combined with modifiers. For example, you can use\n"Ctrl+K" or "Cmd+Shift+O".
  • \n
\n
\n

Important

\n

The keys "C" and "R" are reserved and can't be used,\neven with modifiers. Punctuation keys like "." and ","\naren't currently supported. Some combinations such as\n"Ctrl+T", "Ctrl+W", "Ctrl+PageUp",\n"Ctrl+PageDown", and "F11" are reserved by the browser\nor operating system and may never reach Streamlit.

\n
\n

For a list of supported keys and modifiers, see the documentation\nfor st.button.

\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the button label can wrap onto multiple lines. This can be\none of the following:

\n
    \n
  • None (default): Streamlit decides based on the surrounding\nlayout. Inside a horizontal container, the button keeps its\nstandard, single-row height and truncates an overflowing label\nwith an ellipsis; in other layouts, the label wraps onto\nadditional lines.
  • \n
  • True: If the label is too wide for the button, it wraps onto\nadditional lines and the button grows taller.
  • \n
  • False: The button keeps its standard, single-row height. A\nlabel that is too wide is truncated with an ellipsis.
  • \n
\n

When the button keeps a single-row label and no help is set,\nhovering reveals the full label. Icons and keyboard shortcuts\nremain visible.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "

True if the button was clicked on the last run of the app,\nFalse otherwise.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/button.py#L417" + }, + "streamlit.echo": { + "name": "echo", + "signature": "st.echo(code_location=\"above\")", + "examples": "
\nimport streamlit as st\n\nwith st.echo():\n    st.write('This code will be printed')\n
\n", + "description": "

Use in a with block to draw some code on the app, then execute it.

\n", + "args": [ + { + "name": "code_location", + "type_name": "\"above\" or \"below\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Whether to show the echoed code before or after the results of the\nexecuted code block.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/commands/echo.py#L33" + }, + "streamlit.empty": { + "name": "empty", + "signature": "st.empty()", + "examples": "

Inside a with st.empty(): block, each displayed element will\nreplace the previous one.

\n
\nimport streamlit as st\nimport time\n\nwith st.empty():\n    for seconds in range(10):\n        st.write(f"\u23f3 {seconds} seconds have passed")\n        time.sleep(1)\n    st.write(":material/check: 10 seconds over!")\nst.button("Rerun")\n
\n

You can use an st.empty to replace multiple elements in\nsuccession. Use st.container inside st.empty to display (and\nlater replace) a group of elements.

\n
\nimport streamlit as st\nimport time\n\nst.button("Start over")\n\nplaceholder = st.empty()\nplaceholder.markdown("Hello")\ntime.sleep(1)\n\nplaceholder.progress(0, "Wait for it...")\ntime.sleep(1)\nplaceholder.progress(50, "Wait for it...")\ntime.sleep(1)\nplaceholder.progress(100, "Wait for it...")\ntime.sleep(1)\n\nwith placeholder.container():\n    st.line_chart({"data": [1, 5, 2, 6]})\n    time.sleep(1)\n    st.markdown("3...")\n    time.sleep(1)\n    st.markdown("2...")\n    time.sleep(1)\n    st.markdown("1...")\n    time.sleep(1)\n\nplaceholder.markdown("Poof!")\ntime.sleep(1)\n\nplaceholder.empty()\n
\n", + "description": "

Insert a single-element container.

\n

Inserts a container into your app that can be used to hold a single element.\nThis allows you to, for example, remove elements at any point, or replace\nseveral elements at once (using a child multi-element container).

\n

To insert/replace/clear an element on the returned container, you can\nuse with notation or just call methods directly on the returned object.\nSee examples below.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/empty.py#L27" + }, + "streamlit.error": { + "name": "error", + "signature": "st.error(body, *, icon=None, width=\"stretch\", title=None)", + "examples": "
\nimport streamlit as st\n\nst.error('This is an error', icon="\ud83d\udea8")\n
\n", + "description": "

Display error message.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

If icon is None, and body begins with an emoji or\nMaterial icon shortcode, Streamlit will extract it and display it\nslightly enlarged, as if it were passed to icon. If body\ncontains multiple icons, or you want to override this behavior,\nyou can insert a null Markdown directive like :red[] before\nyour leading icon.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the alert. If icon\nis None (default), Streamlit attempts to extract a leading\nemoji or Material icon shortcode from body. If found, the icon\nis displayed and removed from the body text. If no leading icon is\nfound, no icon is displayed. If icon is a string, it takes\nprecedence over any icon in the body, and the following options\nare valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the alert element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "title", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional title to display above the body text. If None\n(default), no title is displayed. The title is rendered with bold\nstyling and can optionally contain GitHub-flavored Markdown of the\nfollowing types: Italics, Strikethroughs, Inline Code, Links, and\nImages. Images display like icons, with a max height equal to the\nfont height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display elements are not supported.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/alert.py#L59" + }, + "streamlit.exception": { + "name": "exception", + "signature": "st.exception(exception, width=\"stretch\")", + "examples": "
\nimport streamlit as st\n\ne = RuntimeError("This is an exception of type RuntimeError")\nst.exception(e)\n
\n", + "description": "

Display an exception.

\n

When accessing the app through localhost, in the lower-right corner\nof the exception, Streamlit displays links to Google and ChatGPT that\nare prefilled with the contents of the exception message.

\n", + "args": [ + { + "name": "exception", + "type_name": "Exception", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The exception to display.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The width of the exception element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/exception.py#L52" + }, + "streamlit.expander": { + "name": "expander", + "signature": "st.expander(label, expanded=False, *, key=None, icon=None, type=\"default\", width=\"stretch\", on_change=\"ignore\", args=None, kwargs=None)", + "examples": "

Example 1: Use context management\nYou can use the with notation to insert any element into an expander

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nwith st.expander("See explanation"):\n    st.write('''\n        The chart above shows some numbers I picked for you.\n        I rolled actual dice for these, so they're *guaranteed* to\n        be random.\n    ''')\n    st.image("https://static.streamlit.io/examples/dice.jpg")\n
\n

Example 2: Call methods directly

\n

You can call methods directly on the returned object:

\n
\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nexpander = st.expander("See explanation")\nexpander.write('''\n    The chart above shows some numbers I picked for you.\n    I rolled actual dice for these, so they're *guaranteed* to\n    be random.\n''')\nexpander.image("https://static.streamlit.io/examples/dice.jpg")\n
\n

Example 3: Programmatically control the expander state

\n

You can use a key to programmatically control the expander state or\naccess the state in callbacks. You must set the on_change parameter\nfor the expander to track state.

\n
\nimport streamlit as st\n\ndef toggle_expander():\n    st.session_state.summary = not st.session_state.summary\n\ndef on_expander_change():\n    if st.session_state.summary:\n        st.toast("You opened the expander.")\n    else:\n        st.toast("You closed the expander.")\n\nwith st.expander("Open expander", on_change=on_expander_change, key="summary"):\n    st.write("This is the expander")\n\nst.button("Toggle expander", on_click=toggle_expander)\n
\n", + "description": "

Insert a multi-element container that can be expanded/collapsed.

\n

Inserts a container into your app that can be used to hold multiple elements\nand can be expanded or collapsed by the user. When collapsed, all that is\nvisible is the provided label.

\n

To add elements to the returned container, you can use the with notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.

\n

By default, all content within the expander is computed and sent to the\nfrontend, even if the expander is closed. To enable lazy execution\nwhere content only runs when the expander is open, use\non_change="rerun" or pass a callable to on_change. The .open\nproperty indicates whether the expander is currently open, letting you\nconditionally render expensive content.

\n
\n

Note

\n

To follow best design practices and maintain a good appearance on\nall screen sizes, don't nest expanders.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A string to use as the header for the expander. The label can optionally\ncontain GitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

If True, initializes the expander in "expanded" state. Defaults to\nFalse (collapsed).

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key.

\n

When on_change is set to "rerun" or a callable, setting a\nkey lets you read or update the expanded state via\nst.session_state[key]. For more details, see Widget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the expander label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "type", + "type_name": "\"default\" or \"compact\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visual style of the expander. If "default" (default), the\nexpander is displayed with a border and background. If "compact",\nthe expander is rendered as a minimal inline toggle, ideal for\ndisplaying AI reasoning, thoughts, or collapsible metadata without\nvisual clutter.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the expander container. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the container matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The container has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the container matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "on_change", + "type_name": "\"ignore\", \"rerun\", or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the expander should respond when the user expands or\ncollapses it. This controls whether the expander tracks state\nand triggers reruns. on_change can be one of the following:

\n
    \n
  • "ignore" (default): The expander doesn't track state. All\nexpander content runs regardless of whether the expander is open\nor closed. The .open attribute of the expander container\nreturns None.
  • \n
  • "rerun": The expander tracks state. Streamlit reruns the app\nwhen the user expands or collapses the expander. The .open\nattribute of the expander container returns the current state,\nwhich is True if the expander is open and False if it's\nclosed. This lets you skip expensive work when the expander is\nclosed.
  • \n
  • A callable: The expander tracks state. Streamlit executes the\ncallable as a callback function and reruns the app when the user\nexpands or collapses the expander. The .open attribute of the\nexpander container returns its state like when\non_change="rerun". If you need to access the current state\ninside your callback, fetch it through Session State.
  • \n
\n

When the expander tracks state, it can't be used inside Streamlit\ncache-decorated functions.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the on_change\ncallback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the on_change\ncallback.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "ExpanderContainer", + "is_generator": false, + "description": "

An ExpanderContainer object with an .open property to return\nthe current state of the expander if the expander tracks state.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/layouts.py#L1098" + }, + "streamlit.feedback": { + "name": "feedback", + "signature": "st.feedback(options=\"thumbs\", *, key=None, default=None, disabled=False, on_change=None, args=None, kwargs=None, width=\"content\")", + "examples": "

Display a feedback widget with stars, and show the selected sentiment:

\n
\nimport streamlit as st\n\nsentiment_mapping = ["one", "two", "three", "four", "five"]\nselected = st.feedback("stars")\nif selected is not None:\n    st.markdown(f"You selected {sentiment_mapping[selected]} star(s).")\n
\n

Display a feedback widget with thumbs, and show the selected sentiment:

\n
\nimport streamlit as st\n\nsentiment_mapping = [":material/thumb_down:", ":material/thumb_up:"]\nselected = st.feedback("thumbs")\nif selected is not None:\n    st.markdown(f"You selected: {sentiment_mapping[selected]}")\n
\n", + "description": "

Display a feedback widget.

\n

A feedback widget is an icon-based button group available in three\nstyles, as described in options. It is commonly used in chat and AI\napps to allow users to rate responses.

\n", + "args": [ + { + "name": "options", + "type_name": "\"thumbs\", \"faces\", or \"stars\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The feedback options displayed to the user. options can be one\nof the following:

\n
    \n
  • "thumbs" (default): Streamlit displays a thumb-up and\nthumb-down button group.
  • \n
  • "faces": Streamlit displays a row of five buttons with\nfacial expressions depicting increasing satisfaction from left to\nright.
  • \n
  • "stars": Streamlit displays a row of star icons, allowing the\nuser to select a rating from one to five stars.
  • \n
\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing options resets the widget even when a key is\nprovided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "default", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Default feedback value. This must be consistent with the feedback\ntype in options:

\n
    \n
  • 0 or 1 if options="thumbs".
  • \n
  • Between 0 and 4, inclusive, if options="faces" or\noptions="stars".
  • \n
\n", + "default": "feedback" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the feedback widget if set\nto True. The default is False.

\n", + "default": "is" + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when this feedback widget's value\nchanges.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the feedback widget. This can be one of the following:

\n
    \n
  • "content" (default): The width of the widget matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the widget matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "int or None", + "is_generator": false, + "description": "

An integer indicating the user's selection, where 0 is the\nlowest feedback. Higher values indicate more positive feedback.\nIf no option was selected, the widget returns None.

\n
    \n
  • For options="thumbs", a return value of 0 indicates\nthumbs-down, and 1 indicates thumbs-up.
  • \n
  • For options="faces" and options="stars", return values\nrange from 0 (least satisfied) to 4 (most satisfied).
  • \n
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/feedback.py#L135" + }, + "streamlit.file_uploader": { + "name": "file_uploader", + "signature": "st.file_uploader(label, type=None, accept_multiple_files=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, max_upload_size=None, disabled=False, label_visibility=\"visible\", width=\"stretch\")", + "examples": "

Example 1: Accept a single file at a time

\n
\nimport streamlit as st\nimport pandas as pd\nfrom io import StringIO\n\nuploaded_file = st.file_uploader("Choose a file")\nif uploaded_file is not None:\n    # To read file as bytes:\n    bytes_data = uploaded_file.getvalue()\n    st.write(bytes_data)\n\n    # To convert to a string based IO:\n    stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))\n    st.write(stringio)\n\n    # To read file as string:\n    string_data = stringio.read()\n    st.write(string_data)\n\n    # Can be used wherever a "file-like" object is accepted:\n    dataframe = pd.read_csv(uploaded_file)\n    st.write(dataframe)\n
\n

Example 2: Accept multiple files at a time

\n
\nimport pandas as pd\nimport streamlit as st\n\nuploaded_files = st.file_uploader(\n    "Upload data", accept_multiple_files=True, type="csv"\n)\nfor uploaded_file in uploaded_files:\n    df = pd.read_csv(uploaded_file)\n    st.write(df)\n
\n

Example 3: Accept an entire directory

\n
\nimport streamlit as st\n\nuploaded_files = st.file_uploader(\n    "Upload images", accept_multiple_files="directory", type=["jpg", "png"]\n)\nfor uploaded_file in uploaded_files:\n    st.image(uploaded_file)\n
\n", + "description": "

Display a file uploader widget.

\n

By default, uploaded files are limited to 200 MB each. You can\nconfigure this globally using the server.maxUploadSize configuration\noption. For more information on how to set configuration options, see\nconfig.toml. Additionally, you can set a per-widget limit using the\nmax_upload_size parameter.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this file uploader is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "type", + "type_name": "str, list of str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The allowed file types for uploaded files. This can be one of the\nfollowing values:

\n
    \n
  • None (default): All file extensions are allowed.
  • \n
  • A file extension: Only one file extension is allowed. For example,\nto only accept CSV files, use "csv" or ".csv".
  • \n
  • A MIME type: Only one MIME type is allowed. For example,\nto accept JPEG images, use "image/jpeg".
  • \n
  • A MIME wildcard: All types within a MIME media type are allowed.\nFor example, to accept all images, use "image/*".
  • \n
  • A MIME media type: This is a shortcut that is equivalent to a\nMIME wildcard. If you use "image", "audio", "video", or\n"text", Streamlit will internally append /* to create\na MIME wildcard.
  • \n
  • A sequence of strings: Use a combination of the previously listed\nstrings to accept multiple file types.
  • \n
\n

For more information about MIME types, see\nhttps://www.iana.org/assignments/media-types/media-types.xhtml.

\n
\n

Note

\n

This is a best-effort check, but doesn't provide a\nsecurity guarantee against users uploading files of other types\nor type extensions. The correct handling of uploaded files is\npart of the app developer's responsibility.

\n
\n", + "default": null + }, + { + "name": "max_upload_size", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum allowed size of each uploaded file in megabytes.

\n

If this is None (default), the maximum file size is set by the\nserver.maxUploadSize configuration option in your\nconfig.toml file. If this is an integer, it must be positive\nand will override the server.maxUploadSize configuration option.

\n", + "default": null + }, + { + "name": "accept_multiple_files", + "type_name": "bool or \"directory\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Whether to accept more than one file in a submission. This can be one\nof the following values:

\n
    \n
  • False (default): The user can only submit one file at a time.
  • \n
  • True: The user can upload multiple files at the same time.
  • \n
  • "directory": The user can select a directory to upload all\nfiles in the directory and its subdirectories. If type is\nset, only files matching those type(s) will be uploaded.
  • \n
\n

When this is True or "directory", the return value will be\na list and a user can additively select files if they click the\nbrowse button on the widget multiple times.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing type, accept_multiple_files, or\nmax_upload_size resets the widget even when a key is\nprovided.

\n
\n

A key lets you access the widget's value via\nst.session_state[key] (read-only). For more details, see\nWidget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this file_uploader's value\nchanges.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the file uploader if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the file uploader widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "None, UploadedFile, or list of UploadedFile", + "is_generator": false, + "description": "
    \n
  • If accept_multiple_files is False, returns either None or\nan UploadedFile object.
  • \n
  • If accept_multiple_files is True or "directory", returns\na list with the uploaded files as UploadedFile objects. If no\nfiles were uploaded, returns an empty list.
  • \n
\n

The UploadedFile class is a subclass of BytesIO, and\ntherefore is "file-like". This means you can pass an instance of it\nanywhere a file is expected. To use this type in an annotation,\nimport it from streamlit.typing.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/file_uploader.py#L250" + }, + "streamlit.form": { + "name": "form", + "signature": "st.form(key, clear_on_submit=False, *, enter_to_submit=True, border=True, width=\"stretch\", height=\"content\")", + "examples": "

Inserting elements using with notation:

\n
\nimport streamlit as st\n\nwith st.form("my_form"):\n    st.write("Inside the form")\n    slider_val = st.slider("Form slider")\n    checkbox_val = st.checkbox("Form checkbox")\n\n    # Every form must have a submit button.\n    submitted = st.form_submit_button("Submit")\n    if submitted:\n        st.write("slider", slider_val, "checkbox", checkbox_val)\nst.write("Outside the form")\n
\n

Inserting elements out of order:

\n
\nimport streamlit as st\n\nform = st.form("my_form")\nform.slider("Inside the form")\nst.slider("Outside the form")\n\n# Now add a submit button to the form:\nform.form_submit_button("Submit")\n
\n", + "description": "

Create a form that batches elements together with a "Submit" button.

\n

A form is a container that visually groups other elements and\nwidgets together, and contains a Submit button. When the form's\nSubmit button is pressed, all widget values inside the form will be\nsent to Streamlit in a batch.

\n

To add elements to a form object, you can use with notation\n(preferred) or just call methods directly on the form. See\nexamples below.

\n

Forms have a few constraints:

\n
    \n
  • Every form must contain at least one st.form_submit_button.\nWithout a submit button, there is no way to submit the form, so the\nvalues of the widgets inside it are never sent to your app and the\nform is non-functional.
  • \n
  • st.button and st.download_button cannot be added to a form.
  • \n
  • Forms can appear anywhere in your app (sidebar, columns, etc),\nbut they cannot be embedded inside other forms.
  • \n
  • Within a form, the only widget that can have a callback function is\nst.form_submit_button.
  • \n
\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A string that identifies the form. Each form must have its own\nkey. (This key is not displayed to the user in the interface.)

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "clear_on_submit", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

If True, all widgets inside the form will be reset to their default\nvalues after the user presses the Submit button. Defaults to False.\n(Note that Custom Components are unaffected by this flag, and\nwill not be reset to their defaults on form submission.)

\n", + "default": "values" + }, + { + "name": "enter_to_submit", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to submit the form when a user presses Enter while\ninteracting with a widget inside the form.

\n

If this is True (default), pressing Enter while interacting\nwith a form widget is equivalent to clicking the first\nst.form_submit_button in the form.

\n

If this is False, the user must click an\nst.form_submit_button to submit the form.

\n

If the first st.form_submit_button in the form is disabled,\nthe form will override submission behavior with\nenter_to_submit=False.

\n", + "default": null + }, + { + "name": "border", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show a border around the form. Defaults to True.

\n
\n

Note

\n

Not showing a border can be confusing to viewers since interacting with a\nwidget in the form will do nothing. You should only remove the border if\nthere's another border (e.g. because of an expander) or the form is small\n(e.g. just a text input and a submit button).

\n
\n", + "default": "True" + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the form container. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the container matches the\nwidth of the parent container.
  • \n
  • "content": The width of the container matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The container has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the container matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the form container. This can be one of the following:

\n
    \n
  • "content" (default): The height of the container matches the\nheight of its content.
  • \n
  • "stretch": The height of the container matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the container is not in a parent container, the height\nof the container matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The container has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n
\n

Note

\n

Use scrolling containers sparingly. If you use scrolling\ncontainers, avoid heights that exceed 500 pixels. Otherwise,\nthe scroll surface of the container might cover the majority of\nthe screen on mobile devices, which makes it hard to scroll the\nrest of the app.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/form.py#L75" + }, + "streamlit.form_submit_button": { + "name": "form_submit_button", + "signature": "st.form_submit_button(label=\"Submit\", help=None, on_click=None, args=None, kwargs=None, *, key=None, type=\"secondary\", icon=None, icon_position=\"left\", disabled=False, use_container_width=None, width=\"content\", shortcut=None, wrap=None)", + "description": "

Display a form submit button.

\n

When this button is clicked, all widget values inside the form will be\nsent from the user's browser to your Streamlit server in a batch.

\n

Every form must have at least one st.form_submit_button. It is the\nonly way to submit a form: without it, the widget values inside the\nform are never sent to your app, so the form is non-functional. An\nst.form_submit_button cannot exist outside of a form.

\n

For more information about forms, check out our docs.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this button is for. This\ndefaults to "Submit". The label can optionally contain\nGitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed when the button is hovered over. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this button is clicked.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you access the widget's value via\nst.session_state[key] (read-only). For more details, see\nWidget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string that specifies the button type. This can be one\nof the following:

\n
    \n
  • "primary": The button's background is the app's primary color\nfor additional emphasis.
  • \n
  • "secondary" (default): The button's background coordinates\nwith the app's background color for normal emphasis.
  • \n
  • "tertiary": The button is plain text without a border or\nbackground for subtlety.
  • \n
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "icon_position", + "type_name": "\"left\" or \"right\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The position of the icon relative to the button label. This\ndefaults to "left".

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to disable the button. If this is False (default), the\nuser can interact with the button. If this is True, the button\nis grayed-out and can't be clicked.

\n

If the first st.form_submit_button in the form is disabled,\nthe form will override submission behavior with\nenter_to_submit=False.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch". For use_container_width=False, use\nwidth="content".

\n" + }, + "description": "

Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its contents. If use_container_width is\nTrue, the width of the button matches its parent container.

\n

In both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the button. This can be one of the following:

\n
    \n
  • "content" (default): The width of the button matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the button matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The button has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the button matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "shortcut", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional keyboard shortcut that triggers the button. This can be\none of the following strings:

\n
    \n
  • A single alphanumeric key like "K" or "4".
  • \n
  • A function key like "F11".
  • \n
  • A special key like "Enter", "Esc", or "Tab".
  • \n
  • Any of the above combined with modifiers. For example, you can use\n"Ctrl+K" or "Cmd+Shift+O".
  • \n
\n
\n

Important

\n

The keys "C" and "R" are reserved and can't be used,\neven with modifiers. Punctuation keys like "." and ","\naren't currently supported. Some combinations such as\n"Ctrl+T", "Ctrl+W", "Ctrl+PageUp",\n"Ctrl+PageDown", and "F11" are reserved by the browser\nor operating system and may never reach Streamlit.

\n
\n

For a list of supported keys and modifiers, see the documentation\nfor st.button.

\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the button label can wrap onto multiple lines. This can be\none of the following:

\n
    \n
  • None (default): Streamlit decides based on the surrounding\nlayout. Inside a horizontal container, the button keeps its\nstandard, single-row height and truncates an overflowing label\nwith an ellipsis; in other layouts, the label wraps onto\nadditional lines.
  • \n
  • True: If the label is too wide for the button, it wraps onto\nadditional lines and the button grows taller.
  • \n
  • False: The button keeps its standard, single-row height. A\nlabel that is too wide is truncated with an ellipsis.
  • \n
\n

When the button keeps a single-row label and no help is set,\nhovering reveals the full label. Icons and keyboard shortcuts\nremain visible.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "

True if the button was clicked.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/form.py#L245" + }, + "streamlit.fragment": { + "name": "fragment", + "signature": "st.fragment(func=None, *, run_every=None, parallel=False)", + "examples": "

The following example demonstrates basic usage of\n@st.fragment. As an analogy, "inflating balloons" is a slow process that happens\noutside of the fragment. "Releasing balloons" is a quick process that happens inside\nof the fragment.

\n
\nimport streamlit as st\nimport time\n\n@st.fragment\ndef release_the_balloons():\n    st.button("Release the balloons", help="Fragment rerun")\n    st.balloons()\n\nwith st.spinner("Inflating balloons..."):\n    time.sleep(5)\nrelease_the_balloons()\nst.button("Inflate more balloons", help="Full rerun")\n
\n

This next example demonstrates how elements both inside and outside of a\nfragment update with each app or fragment rerun. In this app, clicking\n"Rerun full app" will increment both counters and update all values\ndisplayed in the app. In contrast, clicking "Rerun fragment" will only\nincrement the counter within the fragment. In this case, the st.write\ncommand inside the fragment will update the app's frontend, but the two\nst.write commands outside the fragment will not update the frontend.

\n
\nimport streamlit as st\n\nif "app_runs" not in st.session_state:\n    st.session_state.app_runs = 0\n    st.session_state.fragment_runs = 0\n\n@st.fragment\ndef my_fragment():\n    st.session_state.fragment_runs += 1\n    st.button("Rerun fragment")\n    st.write(f"Fragment says it ran {st.session_state.fragment_runs} times.")\n\nst.session_state.app_runs += 1\nmy_fragment()\nst.button("Rerun full app")\nst.write(f"Full app says it ran {st.session_state.app_runs} times.")\nst.write(f"Full app sees that fragment ran {st.session_state.fragment_runs} times.")\n
\n

You can also trigger an app rerun from inside a fragment by calling\nst.rerun.

\n
\nimport streamlit as st\n\nif "clicks" not in st.session_state:\n    st.session_state.clicks = 0\n\n@st.fragment\ndef count_to_five():\n    if st.button("Plus one!"):\n        st.session_state.clicks += 1\n        if st.session_state.clicks % 5 == 0:\n            st.rerun()\n    return\n\ncount_to_five()\nst.header(f"Multiples of five clicks: {st.session_state.clicks // 5}")\n\nif st.button("Check click count"):\n    st.toast(f"## Total clicks: {st.session_state.clicks}")\n
\n", + "description": "

Decorator to turn a function into a fragment which can rerun independently of the full app.

\n

When a user interacts with an input widget created inside a fragment,\nStreamlit only reruns the fragment instead of the full app. If\nrun_every is set, Streamlit will also rerun the fragment at the\nspecified interval while the session is active, even if the user is not\ninteracting with your app.

\n

To trigger an app rerun from inside a fragment, call st.rerun()\ndirectly. To trigger a fragment rerun from within itself, call\nst.rerun(scope="fragment"). Any values from the fragment that need to\nbe accessed from the wider app should generally be stored in Session State.

\n

When Streamlit element commands are called directly in a fragment, the\nelements are cleared and redrawn on each fragment rerun, just like all\nelements are redrawn on each app rerun. The rest of the app is persisted\nduring a fragment rerun.

\n

A fragment can also write elements and widgets into a container created\noutside of it, including directly to st.sidebar or st.bottom. The\nfragment's writes to that outside container are cleared and redrawn in\nplace on each fragment rerun, while content written to the same container\noutside of the fragment keeps its position and is unaffected. Interacting\nwith a widget that a fragment rendered into an outside container reruns the\nwriting fragment, not the full app.

\n

To populate an outside container from a fragment, the container must first\nreceive at least one write during the initial full app run.

\n

Fragment code can interact with Session State, imported modules, and\nother Streamlit elements created outside the fragment. Note that these\ninteractions are additive across multiple fragment reruns. You are\nresponsible for handling any side effects of that behavior.

\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The function to turn into a fragment.

\n", + "default": null + }, + { + "name": "run_every", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The time interval between automatic fragment reruns. This can be one of\nthe following:

\n
\n\n
\n

If run_every is None, the fragment will only rerun from\nuser-triggered events.

\n", + "default": null + }, + { + "name": "parallel", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to execute the fragment in parallel during full app reruns.\nIf True, the fragment is dispatched to a thread pool and may execute\nconcurrently with other parallel fragments and the rest of the app script.\nIf False (default), the fragment executes inline on the main thread.

\n

Parallel fragments are useful for independent, slow operations that\nshould not block overall app throughput. Full app reruns may overlap\nseveral parallel fragments with the main script; reruns confined to a\nsingle fragment (such as those triggered after widget interactions)\nremain sequential so state updates stay deterministic.

\n

During the initial parallel run, some Streamlit commands are\nrestricted because they are not safe to call from concurrent\nthreads. These include st.dialog, st.switch_page, and\nwriting to containers created outside the fragment. These\ncommands work normally during sequential fragment reruns\n(e.g., after a widget interaction).

\n
\n

Warning

\n

Fragments dispatched in parallel can run concurrently. Avoid\nunsynchronized mutations of shared mutable resources across fragments\nunless you coordinate access explicitly.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/fragment.py#L677" + }, + "streamlit.get_option": { + "name": "get_option", + "signature": "st.get_option(key)", + "examples": "
\nimport streamlit as st\n\ncolor = st.get_option("theme.primaryColor")\n
\n", + "description": "

Return the current value of a given Streamlit configuration option.

\n

Run streamlit config show in a terminal to see all available options.

\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show in a terminal.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/config.py#L204" + }, + "streamlit.graphviz_chart": { + "name": "graphviz_chart", + "signature": "st.graphviz_chart(figure_or_dot, use_container_width=None, *, width=\"content\", height=\"content\")", + "examples": "
\nimport streamlit as st\nimport graphviz\n\n# Create a graphlib graph object\ngraph = graphviz.Digraph()\ngraph.edge("run", "intr")\ngraph.edge("intr", "runbl")\ngraph.edge("runbl", "run")\ngraph.edge("run", "kernel")\ngraph.edge("kernel", "zombie")\ngraph.edge("kernel", "sleep")\ngraph.edge("kernel", "runmem")\ngraph.edge("sleep", "swap")\ngraph.edge("swap", "runswap")\ngraph.edge("runswap", "new")\ngraph.edge("runswap", "runmem")\ngraph.edge("new", "runmem")\ngraph.edge("sleep", "runmem")\n\nst.graphviz_chart(graph)\n
\n

Or you can render the chart from the graph using GraphViz's Dot\nlanguage:

\n
\nst.graphviz_chart('''\n    digraph {\n        run -> intr\n        intr -> runbl\n        runbl -> run\n        run -> kernel\n        kernel -> zombie\n        kernel -> sleep\n        kernel -> runmem\n        sleep -> swap\n        swap -> runswap\n        runswap -> new\n        runswap -> runmem\n        new -> runmem\n        sleep -> runmem\n    }\n''')\n
\n", + "description": "

Display a graph using the dagre-d3 library.

\n
\n

Important

\n

You must install graphviz>=0.19.0 to use this command. You can\ninstall all charting dependencies as an extra with\nStreamlit:

\n
\npip install streamlit[charts]\n
\n
\n", + "args": [ + { + "name": "figure_or_dot", + "type_name": "graphviz.dot.Graph, graphviz.dot.Digraph, graphviz.sources.Source, str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The Graphlib graph object or dot string to display

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch". For use_container_width=False, use\nwidth="content".

\n" + }, + "description": "

Whether to override the figure's native width with the width of\nthe parent container. If use_container_width is False\n(default), Streamlit sets the width of the chart to fit its contents\naccording to the plotting library, up to the width of the parent\ncontainer. If use_container_width is True, Streamlit sets\nthe width of the figure to match the width of the parent container.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "content" (default): The width of the element matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the element matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/graphviz_chart.py#L44" + }, + "streamlit.header": { + "name": "header", + "signature": "st.header(body, anchor=None, *, help=None, divider=False, width=\"stretch\", text_alignment=\"left\")", + "examples": "
\nimport streamlit as st\n\nst.header("_Streamlit_ is :blue[cool] :sunglasses:")\nst.header("This is a header with a divider", divider="gray")\nst.header("These headers have rotating dividers", divider=True)\nst.header("One", divider=True)\nst.header("Two", divider=True)\nst.header("Three", divider=True)\nst.header("Four", divider=True)\n
\n", + "description": "

Display text in header formatting.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the header. If this is\nNone (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "divider", + "type_name": "bool, \"blue\", \"green\", \"orange\", \"red\", \"violet\", \"yellow\", \"gray\"/\"grey\", or \"rainbow\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Shows a colored divider below the header. If this is True,\nsuccessive headers will cycle through divider colors, except gray\nand rainbow. That is, the first header will have a blue line, the\nsecond header will have a green line, and so on. If this is a\nstring, the color can be set to one of the following: blue, green,\norange, red, violet, yellow, gray/grey, or rainbow.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the header element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "text_alignment", + "type_name": "\"left\", \"center\", \"right\", or \"justify\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of the text within the element. This can\nbe one of the following:

\n
    \n
  • "left" (default): Text is aligned to the left edge.
  • \n
  • "center": Text is centered.
  • \n
  • "right": Text is aligned to the right edge.
  • \n
  • "justify": Text is justified (stretched to fill the available\nwidth with the last line left-aligned).
  • \n
\n
\n

Note

\n

For text alignment to have a visible effect, the element's\nwidth must be wider than its content. If you use\nwidth="content" with short text, the alignment may not be\nnoticeable.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/heading.py#L43" + }, + "streamlit.help": { + "name": "help", + "signature": "st.help(obj=, *, width=\"stretch\")", + "examples": "

Don't remember how to initialize a dataframe? Try this:

\n
\nimport streamlit as st\nimport pandas\n\nst.help(pandas.DataFrame)\n
\n

Want to quickly check what data type is output by a certain function?\nTry:

\n
\nimport streamlit as st\n\nx = my_poorly_documented_function()\nst.help(x)\n
\n

Want to quickly inspect an object? No sweat:

\n
\nclass Dog:\n  '''A typical dog.'''\n\n  def __init__(self, breed, color):\n    self.breed = breed\n    self.color = color\n\n  def bark(self):\n    return 'Woof!'\n\n\nfido = Dog("poodle", "white")\n\nst.help(fido)\n
\n

And if you're using Magic, you can get help for functions, classes,\nand modules without even typing st.help:

\n
\nimport streamlit as st\nimport pandas\n\n# Get help for Pandas read_csv:\npandas.read_csv\n\n# Get help for Streamlit itself:\nst\n
\n", + "description": "

Display help and other information for a given object.

\n

Depending on the type of object that is passed in, this displays the\nobject's name, type, value, signature, docstring, and member variables,\nmethods \u2014 as well as the values/docstring of members and methods.

\n", + "args": [ + { + "name": "obj", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The object whose information should be displayed. If left\nunspecified, this call will display help for Streamlit itself.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the help element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/help.py#L47" + }, + "streamlit.html": { + "name": "html", + "signature": "st.html(body, *, width=\"stretch\", unsafe_allow_javascript=False)", + "examples": "
\nimport streamlit as st\n\nst.html(\n    "<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>"\n)\n
\n", + "description": "

Insert HTML into your app.

\n

Adding custom HTML to your app impacts safety, styling, and\nmaintainability. We sanitize HTML with DOMPurify, but inserting HTML remains a\ndeveloper risk. Passing untrusted code to st.html or dynamically\nloading external code can increase the risk of vulnerabilities in your\napp.

\n

st.html content is not iframed. By default, JavaScript is\nignored. To execute JavaScript contained in your HTML, set\nunsafe_allow_javascript=True. Use this with caution and never pass\nuntrusted input.

\n", + "args": [ + { + "name": "body", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The HTML code to insert. This can be one of the following:

\n
    \n
  • A string of HTML code.
  • \n
  • A pathlib.Path object pointing to a local file with HTML\ncode. Paths can be absolute or relative to the working directory\n(where you execute streamlit run). Local file paths passed\nas strings are treated as HTML content.
  • \n
  • Any object. If body is not a string or path, Streamlit will\nconvert the object to a string. body._repr_html_() takes\nprecedence over str(body) when available.
  • \n
\n

If the resulting HTML content is empty, Streamlit will raise an\nerror.

\n

If body is a Path to a CSS file, Streamlit will wrap the\nCSS content in <style> tags automatically. When the resulting\nHTML content only contains style tags, Streamlit will send the\ncontent to the event container instead of the main container to\navoid taking up space in the app.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the HTML element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "unsafe_allow_javascript", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to execute JavaScript contained in your HTML. If this is\nFalse (default), JavaScript is ignored. If this is True,\nJavaScript is executed. Use this with caution and never pass\nuntrusted input.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/html.py#L45" + }, + "streamlit.iframe": { + "name": "iframe", + "signature": "st.iframe(src, *, width=\"stretch\", height=\"content\", tab_index=None)", + "examples": "

Embed an external website:

\n
\nimport streamlit as st\nst.iframe("https://docs.streamlit.io", height=600)\n
\n

Embed HTML content directly:

\n
\nimport streamlit as st\nst.iframe(\n    '''\n    <style>body { font-family: sans-serif; padding: 1rem; }</style>\n    <p>This is <strong>embedded HTML</strong>.</p>\n    ''',\n    height=100,\n)\n
\n

Embed a local HTML file:

\n
\nimport streamlit as st\nfrom pathlib import Path\nst.iframe(Path("reports/dashboard.html"), height=800)\n
\n", + "description": "

Embed content in an iframe.

\n

st.iframe embeds external URLs, HTML content, or local files in an\niframe. It handles the input based on its type and URL pattern.

\n
\n

Warning

\n

HTML strings, local HTML files, and same-origin relative URLs are\nembedded as-is in an iframe that allows JavaScript execution and\nsame-origin access to the Streamlit app. Never pass untrusted HTML\nor untrusted src values from users, query parameters, databases,\nuploaded files, LLM output, or other external sources to\nst.iframe. Use st.html for sanitized HTML snippets that\ndon't need full iframe behavior.

\n
\n", + "args": [ + { + "name": "src", + "type_name": "str or Path", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The content to embed. This can be one of the following:

\n
    \n
  • Absolute URL: A URL starting with http://, https://,\nor data:. The URL is loaded directly in the iframe.
  • \n
  • Relative URL: A path starting with /, such as\n/app/static/report.html. Useful for referencing files served\nvia Streamlit's static file serving.
  • \n
  • Local file path: A pathlib.Path object pointing to a\nlocal file. HTML files (.html, .htm, .xhtml) are read\nand embedded directly. Other files (PDF, images, SVG, etc.) are\nuploaded to Streamlit's media storage and rendered using the\nbrowser's native viewer. Strings are interpreted only as URLs or\nHTML content, never as local file paths.
  • \n
  • HTML string: If src doesn't match any of the above\npatterns, it's treated as raw HTML and embedded directly in the\niframe.
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "int, \"stretch\", or \"content\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the iframe. This can be one of the following:

\n
    \n
  • "stretch" (default): The iframe fills the width of its\ncontainer.
  • \n
  • "content": The iframe matches the width of its content.
  • \n
  • An int: A fixed width in CSS pixels.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "int, \"stretch\", or \"content\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the iframe. This can be one of the following:

\n
    \n
  • "content" (default): The iframe automatically sizes to match\nits content height. For HTML strings and local HTML files,\nStreamlit measures the content height. For external URLs and\nnon-HTML files, this falls back to 400px due to cross-origin\nrestrictions.
  • \n
  • "stretch": The iframe fills the available vertical space.\nWorks best inside containers with defined heights.
  • \n
  • An int: A fixed height in CSS pixels.
  • \n
\n", + "default": null + }, + { + "name": "tab_index", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Controls keyboard navigation focus. This can be one of the\nfollowing:

\n
    \n
  • None (default): Browser default behavior.
  • \n
  • -1: Removes from tab order but allows programmatic focus.
  • \n
  • 0: Adds to tab order in document position.
  • \n
  • Positive int: Adds to tab order at specified priority.
  • \n
\n

For more information, see the tabindex\ndocumentation on MDN.

\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/iframe.py#L260" + }, + "streamlit.image": { + "name": "image", + "signature": "st.image(image, caption=None, width=\"content\", clamp=False, channels=\"RGB\", output_format=\"auto\", *, use_container_width=None, link=None)", + "examples": "
\nimport streamlit as st\nst.image("sunrise.jpg", caption="Sunrise by the mountains")\n
\n", + "description": "

Display an image or list of images.

\n", + "args": [ + { + "name": "image", + "type_name": "numpy.ndarray, BytesIO, str, Path, or list of these", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The image to display. This can be one of the following:

\n
    \n
  • A URL (string) for a hosted image. Also supports\n/app/static/<asset> URLs for files served via\nstatic file serving.
  • \n
  • A path to a local image file. The path can be a str\nor Path object. Paths can be absolute or relative to the\nworking directory (where you execute streamlit run).
  • \n
  • An SVG string like <svg xmlns=...</svg>.
  • \n
  • A byte array defining an image. This includes monochrome images of\nshape (w,h) or (w,h,1), color images of shape (w,h,3), or RGBA\nimages of shape (w,h,4), where w and h are the image width and\nheight, respectively.
  • \n
  • A list of any of the above. Streamlit displays the list as a\nrow of images that overflow to additional rows as needed.
  • \n
\n", + "default": null + }, + { + "name": "caption", + "type_name": "str or list of str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Image caption(s). If this is None (default), no caption is\ndisplayed. If image is a list of multiple images, caption\nmust be a list of captions (one caption for each image) or\nNone.

\n

Captions can optionally contain GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The width of the image element. This can be one of the following:

\n
    \n
  • "content" (default): The width of the element matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the element matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n

When using an SVG image without a default width, use "stretch"\nor an integer.

\n", + "default": "width" + }, + { + "name": "clamp", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Whether to clamp image pixel values to a valid range (0-255 per\nchannel). This is only used for byte array images; the parameter is\nignored for image URLs and files. If this is False (default)\nand an image has an out-of-range value, a RuntimeError will be\nraised.

\n", + "default": null + }, + { + "name": "channels", + "type_name": "\"RGB\" or \"BGR\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The color format when image is an nd.array. This is ignored\nfor other image types. If this is "RGB" (default),\nimage[:, :, 0] is the red channel, image[:, :, 1] is the\ngreen channel, and image[:, :, 2] is the blue channel. For\nimages coming from libraries like OpenCV, you should set this to\n"BGR" instead.

\n", + "default": null + }, + { + "name": "output_format", + "type_name": "\"JPEG\", \"PNG\", or \"auto\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The output format to use when transferring the image data. If this\nis "auto" (default), Streamlit identifies the compression type\nbased on the type and format of the image. Photos should use the\n"JPEG" format for lossy compression while diagrams should use\nthe "PNG" format for lossless compression.

\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch". For use_container_width=False, use\nwidth="content".

\n" + }, + "description": "

Whether to override width with the width of the parent\ncontainer. If use_container_width is False (default),\nStreamlit sets the image's width according to width. If\nuse_container_width is True, Streamlit sets the width of\nthe image to match the width of the parent container.

\n", + "default": null + }, + { + "name": "link", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The URL to open when a user clicks on the image. This can be an\nexternal URL like "https://streamlit.io" or a relative path\nlike "/my_page". If link is None (default), the\nimage will not include a hyperlink.

\n

This parameter is only supported when displaying a single image.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/image.py#L47" + }, + "streamlit.info": { + "name": "info", + "signature": "st.info(body, *, icon=None, width=\"stretch\", title=None)", + "examples": "
\nimport streamlit as st\n\nst.info('This is a purely informational message', icon="\u2139\ufe0f")\n
\n", + "description": "

Display an informational message.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

If icon is None, and body begins with an emoji or\nMaterial icon shortcode, Streamlit will extract it and display it\nslightly enlarged, as if it were passed to icon. If body\ncontains multiple icons, or you want to override this behavior,\nyou can insert a null Markdown directive like :red[] before\nyour leading icon.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the alert. If icon\nis None (default), Streamlit attempts to extract a leading\nemoji or Material icon shortcode from body. If found, the icon\nis displayed and removed from the body text. If no leading icon is\nfound, no icon is displayed. If icon is a string, it takes\nprecedence over any icon in the body, and the following options\nare valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the info element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "title", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional title to display above the body text. If None\n(default), no title is displayed. The title is rendered with bold\nstyling and can optionally contain GitHub-flavored Markdown of the\nfollowing types: Italics, Strikethroughs, Inline Code, Links, and\nImages. Images display like icons, with a max height equal to the\nfont height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display elements are not supported.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/alert.py#L276" + }, + "streamlit.json": { + "name": "json", + "signature": "st.json(body, *, expanded=True, width=\"stretch\")", + "examples": "
\nimport streamlit as st\n\nst.json(\n    {\n        "foo": "bar",\n        "stuff": [\n            "stuff 1",\n            "stuff 2",\n            "stuff 3",\n        ],\n        "level1": {"level2": {"level3": {"a": "b"}}},\n    },\n    expanded=2,\n)\n
\n", + "description": "

Display an object or string as a pretty-printed, interactive JSON string.

\n", + "args": [ + { + "name": "body", + "type_name": "object or str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The object to print as JSON. All referenced objects should be\nserializable to JSON as well. If object is a string, we assume it\ncontains serialized JSON.

\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The initial expansion state of the JSON element. This can be one\nof the following:

\n
    \n
  • True (default): The element is fully expanded.
  • \n
  • False: The element is fully collapsed.
  • \n
  • An integer: The element is expanded to the depth specified. The\ninteger must be non-negative. expanded=0 is equivalent to\nexpanded=False.
  • \n
\n

Regardless of the initial expansion state, users can collapse or\nexpand any key-value pair to show or hide any part of the object.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the JSON element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/json.py#L48" + }, + "streamlit.latex": { + "name": "latex", + "signature": "st.latex(body, *, help=None, width=\"stretch\")", + "examples": "
\nimport streamlit as st\n\nst.latex(r'''\n    a + ar + a r^2 + a r^3 + \\cdots + a r^{n-1} =\n    \\sum_{k=0}^{n-1} ar^k =\n    a \\left(\\frac{1-r^{n}}{1-r}\\right)\n    ''')\n
\n", + "description": "

Display mathematical expressions formatted as LaTeX.

\n

Supported LaTeX functions are listed at\nhttps://katex.org/docs/supported.html.

\n", + "args": [ + { + "name": "body", + "type_name": "str or SymPy expression", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The string or SymPy expression to display as LaTeX. If str, it's\na good idea to use raw Python strings since LaTeX uses backslashes\na lot.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the LaTeX expression. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the LaTeX element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/markdown.py#L349" + }, + "streamlit.line_chart": { + "name": "line_chart", + "signature": "st.line_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, width=\"stretch\", height=\"content\", use_container_width=None)", + "examples": "

Example 1: Basic line chart from a dataframe

\n

If you don't use any of the optional parameters, Streamlit plots each\ncolumn as a separate line, uses the index as the x values, and labels\neach series with the column name:

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((20, 3)), columns=["a", "b", "c"])\n\nst.line_chart(df)\n
\n

Example 2: Line chart from specific dataframe columns

\n

You can choose different columns to use for the x and y values. If your\ndataframe is in long format (all y-values in one column), you can set\nthe line colors from another column.

\n

If the column contains color strings, the colors will be applied\ndirectly and the series will be unlabeled. If the column contains other\nvalues, those values will label each line, and the line colors will be\nselected from the default color palette. You can configure this color\npalette in the theme.chartCategoryColors configuration option.

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    {\n        "col1": list(range(20)) * 3,\n        "col2": rng(0).standard_normal(60),\n        "col3": ["a"] * 20 + ["b"] * 20 + ["c"] * 20,\n    }\n)\n\nst.line_chart(df, x="col1", y="col2", color="col3")\n
\n

Example 3: Line chart from wide-format dataframe

\n

If your dataframe is in wide format (y-values are in multiple columns),\nyou can pass a list of columns to the y parameter. Each column\nname becomes a series label. To override the default colors, pass a\nlist of colors to the color parameter, one for each series:

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((20, 3)), columns=["a", "b", "c"])\n\nst.line_chart(\n    df,\n    x="a",\n    y=["b", "c"],\n    color=["#FF0000", "#0000FF"],\n)\n
\n", + "description": "

Display a line chart.

\n

This is syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.

\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Data to be plotted.

\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column name or key associated to the x-axis data. If x is\nNone (default), Streamlit uses the data index for the x-axis\nvalues.

\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column name(s) or key(s) associated to the y-axis data. If this is\nNone (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a Sequence of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.

\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The label for the x-axis. If this is None (default), Streamlit\nwill use the column name specified in x if available, or else\nno label will be displayed.

\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The label for the y-axis. If this is None (default), Streamlit\nwill use the column name(s) specified in y if available, or\nelse no label will be displayed.

\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color to use for different lines in this chart.

\n

For a line chart with just one line, this can be:

\n
    \n
  • None, to use the default color.
  • \n
  • A hex string like "#ffaa00" or "#ffaa0088".
  • \n
  • An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.
  • \n
  • A built-in color name: "red", "orange", "yellow", "green",\n"blue", "violet", "gray"/"grey", or "primary". These map to\ntheme colors that you can customize using theme.<color>Color\nconfiguration options.
  • \n
\n

For a line chart with multiple lines, where the dataframe is in\nlong format (that is, y is None or just one column), this can be:

\n
    \n
  • None, to use the default colors.

    \n
  • \n
  • The name of a column in the dataset. Data points will be grouped\ninto lines of the same color based on the value of this column.\nIn addition, if the values in this column match one of the color\nformats above (hex string or color tuple), then that color will\nbe used.

    \n

    For example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints will be grouped into three lines whose colors will be\nautomatically selected from the default palette.

    \n

    But, if for the same 1000-row dataset, this column contained\nthe values "#ffaa00", "#f0f", "#0000ff", then then those 1000\ndatapoints would still be grouped into three lines, but their\ncolors would be "#ffaa00", "#f0f", "#0000ff" this time around.

    \n
  • \n
\n

For a line chart with multiple lines, where the dataframe is in\nwide format (that is, y is a Sequence of columns), this can be:

\n
    \n
  • None, to use the default colors.
  • \n
  • A list of string colors or color tuples to be used for each of\nthe lines in the chart. This list should have the same length\nas the number of y values (e.g. color=["#fd0", "#f0f", "#04f"]\nfor three lines). You can also use built-in color names in the\nlist (e.g. color=["red", "blue", "green"]).
  • \n
\n

You can set the default colors in the theme.chartCategoryColors\nconfiguration option.

\n", + "default": "color" + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override the chart's native width with the width of\nthe parent container. This can be one of the following:

\n
    \n
  • None (default): Streamlit will use the chart's default behavior.
  • \n
  • True: Streamlit sets the width of the chart to match the\nwidth of the parent container.
  • \n
  • False: Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of\nthe parent container.
  • \n
\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/vega_charts.py#L672" + }, + "streamlit.link_button": { + "name": "link_button", + "signature": "st.link_button(label, url, *, key=None, on_click=\"ignore\", args=None, kwargs=None, help=None, type=\"secondary\", icon=None, icon_position=\"left\", disabled=False, use_container_width=None, width=\"content\", shortcut=None, wrap=None)", + "examples": "
\nimport streamlit as st\n\nst.link_button("Go to gallery", "https://streamlit.io/gallery")\n
\n", + "description": "

Display a link button element.

\n

When clicked, a new tab will be opened to the specified URL. This will\ncreate a new session for the user if directed within the app.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this button is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "url", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The URL to open on user click.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string to use for giving this element a stable\nidentity. If this is None (default), the element's identity\nwill be determined based on the values of the other parameters.

\n

If on_click enables widget behavior and key is provided,\nStreamlit will register the key in Session State to store the button state.\nThe button state is read-only. For more details, see Widget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable, \"rerun\", or \"ignore\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the button should respond to user interaction. This controls\nwhether or not the button behaves like an input widget. This can\nbe one of the following values:

\n
    \n
  • "ignore" (default): Streamlit opens the link in a new tab\nand doesn't rerun the app. The button won't behave like an\ninput widget.
  • \n
  • "rerun": Streamlit opens the link in a new tab and reruns\nthe app. In this case, st.link_button returns a Boolean value\nlike st.button.
  • \n
  • A callable: Streamlit opens the link in a new tab, reruns\nthe app, and executes the callable at the beginning of the rerun.\nIn this case, st.link_button returns a Boolean value.
  • \n
\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback when\non_click is a callable. If on_click isn't a callable,\nthis is ignored.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback when\non_click is a callable. If on_click isn't a callable,\nthis is ignored.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when the button is hovered over. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string that specifies the button type. This can be one\nof the following:

\n
    \n
  • "primary": The button's background is the app's primary color\nfor additional emphasis.
  • \n
  • "secondary" (default): The button's background coordinates\nwith the app's background color for normal emphasis.
  • \n
  • "tertiary": The button is plain text without a border or\nbackground for subtlety.
  • \n
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "icon_position", + "type_name": "\"left\" or \"right\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The position of the icon relative to the button label. This\ndefaults to "left".

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the link button if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch". For use_container_width=False, use\nwidth="content".

\n" + }, + "description": "

Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its contents. If use_container_width is\nTrue, the width of the button matches its parent container.

\n

In both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the link button. This can be one of the following:

\n
    \n
  • "content" (default): The width of the button matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the button matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The button has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the button matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "shortcut", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional keyboard shortcut that triggers the button. This can be\none of the following strings:

\n
    \n
  • A single alphanumeric key like "K" or "4".
  • \n
  • A function key like "F11".
  • \n
  • A special key like "Enter", "Esc", or "Tab".
  • \n
  • Any of the above combined with modifiers. For example, you can use\n"Ctrl+K" or "Cmd+Shift+O".
  • \n
\n
\n

Important

\n

The keys "C" and "R" are reserved and can't be used,\neven with modifiers. Punctuation keys like "." and ","\naren't currently supported. Some combinations such as\n"Ctrl+T", "Ctrl+W", "Ctrl+PageUp",\n"Ctrl+PageDown", and "F11" are reserved by the browser\nor operating system and may never reach Streamlit.

\n
\n

For a list of supported keys and modifiers, see the documentation\nfor st.button.

\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the button label can wrap onto multiple lines. This can be\none of the following:

\n
    \n
  • None (default): Streamlit decides based on the surrounding\nlayout. Inside a horizontal container, the button keeps its\nstandard, single-row height and truncates an overflowing label\nwith an ellipsis; in other layouts, the label wraps onto\nadditional lines.
  • \n
  • True: If the label is too wide for the button, it wraps onto\nadditional lines and the button grows taller.
  • \n
  • False: The button keeps its standard, single-row height. A\nlabel that is too wide is truncated with an ellipsis.
  • \n
\n

When the button keeps a single-row label and no help is set,\nhovering reveals the full label. Icons and keyboard shortcuts\nremain visible.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or bool", + "is_generator": false, + "description": "

If on_click is "ignore" (default), this command returns an internal\nplaceholder for the button element. Otherwise, this command returns a Boolean\nvalue in the same manner as st.button: True if the button was clicked\non the last rerun and False if it wasn't.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/button.py#L899" + }, + "streamlit.login": { + "name": "login", + "signature": "st.login(provider=None)", + "examples": "

Example 1: Use an unnamed default identity provider

\n

If you do not specify a name for your provider, specify all settings within\nthe [auth] dictionary of your secrets.toml file. The following\nexample configures Google as the default provider. For information about\nusing OIDC with Google, see Google Identity.

\n
\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://accounts.google.com/.well-known/openid-configuration"  # fmt: skip\n
\n
\nimport streamlit as st\n\nif not st.user.is_logged_in:\n    if st.button("Log in"):\n        st.login()\nelse:\n    if st.button("Log out"):\n        st.logout()\n    st.write(f"Hello, {st.user.name}!")\n
\n

Example 2: Use a named identity provider

\n

If you specify a name for your provider, save the shared settings in the\n[auth] dictionary of your secrets.toml file, and save the other\nsettings in an [auth.{provider}] dictionary, where {provider} is\nthe name of your provider. The following example configures Microsoft as\nthe provider. The example uses provider="microsoft", but you can use\nany name. This name is internal to Streamlit and is used to match the login\ncommand to its configuration. For information about using OIDC with\nMicrosoft, see Microsoft Entra ID.\nTo configure your {tenant} value in server_metadata_url, see\nMicrosoft identity platform.

\n
\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\n\n[auth.microsoft]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration"\n
\n
\nimport streamlit as st\n\nif not st.user.is_logged_in:\n    st.login("microsoft")\nelse:\n    st.write(f"Hello, {st.user.name}!")\n
\n

Example 3: Use multiple, named providers

\n

If you want to give your users a choice of authentication methods,\nconfigure multiple providers and give them each a unique name. The\nfollowing example lets users choose between Okta and Microsoft to log in.\nAlways check with your identity provider to understand the structure of\ntheir identity tokens because the returned fields may differ. Remember to\nset {tenant} and {subdomain} in server_metadata_url for\nMicrosoft and Okta, respectively.

\n
\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\n\n[auth.microsoft]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration"\n\n[auth.okta]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://{subdomain}.okta.com/.well-known/openid-configuration"\n
\n
\nimport streamlit as st\n\nif not st.user.is_logged_in:\n    st.header("Log in:")\n    if st.button("Microsoft"):\n        st.login("microsoft")\n    if st.button("Okta"):\n        st.login("okta")\nelse:\n    if st.button("Log out"):\n        st.logout()\n    st.write(f"Hello, {st.user.name}!")\n
\n

Example 4: Change the default connection settings

\n

prompt="select_account" may be treated differently by some\nproviders when a user is already logged into their account. If a user is\nlogged into their Google or Microsoft account from a previous session, the\nprovider will prompt them to select the account they want to use, even if\nit's the only one. However, if the user is logged into their Okta or Auth0\naccount from a previous session, the account will automatically be\nselected. st.logout() does not clear a user's related cookies. To force\nusers to log in every time, use prompt="login" as described in Auth0's\nCustomize Signup and Login Prompts.

\n
\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\n\n[auth.auth0]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://{account}.{region}.auth0.com/.well-known/openid-configuration"\nclient_kwargs = { "prompt" = "login" }\n
\n
\nimport streamlit as st\n\nif st.button("Log in"):\n    st.login("auth0")\nif st.user.is_logged_in:\n    if st.button("Log out"):\n        st.logout()\n    st.write(f"Hello, {st.user.name}!)\n
\n", + "description": "

Initiate the login flow for the given provider.

\n

This command redirects the user to an OpenID Connect (OIDC) provider. After\nthe user authenticates their identity, they are redirected back to the\nhome page of your app. Streamlit stores a cookie with the user's identity\ninformation in the user's browser . You can access the identity information\nthrough st.user. Call st.logout() to remove the cookie\nand start a new session.

\n

You can use any OIDC provider, including Google, Microsoft, Okta, and more.\nYou must configure the provider through secrets management. Although OIDC\nis an extension of OAuth 2.0, you can't use generic OAuth providers.\nStreamlit parses the user's identity token and surfaces its attributes in\nst.user. If the provider returns an access token, that\ntoken is ignored unless you explicitly expose it.

\n

For all providers, there are three shared settings, redirect_uri,\ncookie_secret, and expose_tokens, which you must specify in an\n[auth] dictionary in secrets.toml. Other settings must be defined\nas described in the provider parameter.

\n
    \n
  • redirect_uri is your app's absolute URL with the pathname\noauth2callback. For local development using the default port, this is\nhttp://localhost:8501/oauth2callback.
  • \n
  • cookie_secret should be a strong, randomly generated secret.
  • \n
  • expose_tokens is a list of token types to expose. The supported token\ntypes are "id" and "access". This is an optional setting, and no\ntokens are exposed by default. For information and examples about exposing\ntokens, see st.user.
  • \n
\n

In addition to the shared settings, the following settings are required:

\n
    \n
  • client_id
  • \n
  • client_secret
  • \n
  • server_metadata_url
  • \n
\n

For a complete list of OIDC parameters, see OpenID Connect Core and\nyour provider's documentation. By default, Streamlit sets\nscope="openid profile email" and prompt="select_account". You can\nchange these and other OIDC parameters by passing a dictionary of settings\nto client_kwargs. state and nonce, which are used for\nsecurity, are handled automatically and don't need to be specified. For\nmore information, see Example 4.

\n
\n

Important

\n
    \n
  • You must install Authlib>=1.3.2 to use this command. You can\ninstall it as an extra with Streamlit:

    \n
    \npip install streamlit[auth]\n
    \n
  • \n
  • Your authentication configuration is dependent on your host location.\nWhen you deploy your app, remember to update your redirect_uri\nwithin your app and your provider.

    \n
  • \n
  • All URLs declared in the settings must be absolute (i.e., begin with\nhttp:// or https://).

    \n
  • \n
  • Streamlit automatically enables CORS and XSRF protection when you\nconfigure authentication in secrets.toml. This takes precedence\nover configuration options in config.toml.

    \n
  • \n
  • If a user is logged into your app and opens a new tab in the same\nbrowser, they will automatically be logged in to the new session with\nthe same account.

    \n
  • \n
  • If a user closes your app without logging out, the identity cookie\nwill expire after 30 days.

    \n
  • \n
  • For security reasons, authentication is not supported for embedded\napps.

    \n
  • \n
\n
\n", + "args": [ + { + "name": "provider", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The name of your provider configuration to use for login.

\n

If provider is None (default), Streamlit will use all settings\nin the [auth] dictionary within your app's secrets.toml file.\nOtherwise, use an [auth.{provider}] dictionary for the named\nprovider, as shown in the examples that follow. When you pass a string\nto provider, Streamlit will use redirect_uri and\ncookie_secret, while ignoring any other values in the [auth]\ndictionary.

\n

Due to internal implementation details, Streamlit does not support\nusing an underscore within provider at this time.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/user_info.py#L56" + }, + "streamlit.logo": { + "name": "logo", + "signature": "st.logo(image, *, size=\"medium\", link=None, icon_image=None)", + "examples": "

A common design practice is to use a wider logo in the sidebar, and a\nsmaller, icon-styled logo in your app's main body.

\n
\nimport streamlit as st\n\nst.logo(\n    LOGO_URL_LARGE,\n    link="https://streamlit.io/gallery",\n    icon_image=LOGO_URL_SMALL,\n)\n
\n

Try switching logos around in the following example:

\n
\nimport streamlit as st\n\nHORIZONTAL_RED = "images/horizontal_red.png"\nICON_RED = "images/icon_red.png"\nHORIZONTAL_BLUE = "images/horizontal_blue.png"\nICON_BLUE = "images/icon_blue.png"\n\noptions = [HORIZONTAL_RED, ICON_RED, HORIZONTAL_BLUE, ICON_BLUE]\nsidebar_logo = st.selectbox("Sidebar logo", options, 0)\nmain_body_logo = st.selectbox("Main body logo", options, 1)\n\nst.logo(sidebar_logo, icon_image=main_body_logo)\nst.sidebar.markdown("Hi!")\n
\n", + "description": "

Renders a logo in the upper-left corner of your app and its sidebar.

\n

If st.logo is called multiple times within a page, Streamlit will\nrender the image passed in the last call. For the most consistent results,\ncall st.logo early in your page script and choose an image that works\nwell in both light and dark mode. Avoid empty margins around your image.

\n

If your logo does not work well for both light and dark mode, consider\nsetting the theme and hiding the settings menu from users with the\nconfiguration option\nclient.toolbarMode="minimal".

\n

If a user clicks the logo, they are redirected to your app's home page.

\n", + "args": [ + { + "name": "image", + "type_name": "Anything supported by st.image (except list) or str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The image to display in the upper-left corner of your app and its\nsidebar. If icon_image is also provided, then Streamlit will only\ndisplay image in the sidebar.

\n

image can be any of the types supported by st.image except\na list. Additionally, the following strings are valid:

\n
    \n
  • A single-character emoji. For example, you can set image="\ud83c\udfe0"\nor image="\ud83d\ude80". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, image=":material/home:" will display the\nHome icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
\n

Streamlit scales the image to a max height set by size and a max\nwidth to fit within the sidebar.

\n", + "default": null + }, + { + "name": "size", + "type_name": "\"small\", \"medium\", or \"large\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The size of the image displayed in the upper-left corner of the app and its\nsidebar. The possible values are as follows:

\n
    \n
  • "small": 20px max height
  • \n
  • "medium" (default): 24px max height
  • \n
  • "large": 32px max height
  • \n
\n", + "default": null + }, + { + "name": "link", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The external URL to open when a user clicks on the logo. The URL must\nstart with "http://" or "https://". If link is None (default),\nthe logo will not include a hyperlink.

\n", + "default": null + }, + { + "name": "icon_image", + "type_name": "Anything supported by st.image (except list), str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional, typically smaller image to replace image in the\nupper-left corner when the sidebar is closed. This can be any of the\ntypes allowed for the image parameter. If icon_image is\nNone (default), Streamlit will always display image in the\nupper-left corner, regardless of whether the sidebar is open or closed.\nOtherwise, Streamlit will render icon_image in the upper-left\ncorner of the app when the sidebar is closed.

\n

Streamlit scales the image to a max height set by size and a max\nwidth to fit within the sidebar. If the sidebar is closed, the max\nwidth is retained from when it was last open.

\n

For best results, pass a wide or horizontal image to image and a\nsquare image to icon_image. Or, pass a square image to image\nand leave icon_image=None.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/commands/logo.py#L86" + }, + "streamlit.logout": { + "name": "logout", + "signature": "st.logout()", + "example": "

.streamlit/secrets.toml:

\n
\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://accounts.google.com/.well-known/openid-configuration"  # fmt: skip\n
\n

Your app code:

\n
\nimport streamlit as st\n\nif not st.user.is_logged_in:\n    if st.button("Log in"):\n        st.login()\nelse:\n    if st.button("Log out"):\n        st.logout()\n    st.write(f"Hello, {st.user.name}!")\n
\n", + "description": "

Logout the current user.

\n

This command removes the user's information from st.user,\ndeletes their identity cookie, and redirects them to perform a proper\nlogout from the OAuth provider (if available) before returning to your\napp's home page. This creates a new session.

\n

If the user has multiple sessions open in the same browser,\nst.user will not be cleared in any other session.\nst.user only reads from the identity cookie at the start\nof a session. After a session is running, you must call st.login() or\nst.logout() within that session to update st.user.

\n
\n

Note

\n

If the OAuth provider supports OIDC end_session_endpoint in their\nserver metadata, the user will be logged out from the identity provider\nas well. If not available, only local logout is performed.

\n
\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/user_info.py#L311" + }, + "streamlit.map": { + "name": "map", + "signature": "st.map(data=None, *, latitude=None, longitude=None, color=None, size=None, zoom=None, width=\"stretch\", height=500, use_container_width=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    rng(0).standard_normal((1000, 2)) / [50, 50] + [37.76, -122.4],\n    columns=["lat", "lon"],\n)\n\nst.map(df)\n
\n

You can also customize the size and color of the datapoints:

\n
\nst.map(df, size=20, color="#0044ff")\n
\n

And finally, you can choose different columns to use for the latitude\nand longitude components, as well as set size and color of each\ndatapoint dynamically based on other columns:

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    {\n        "col1": rng(0).standard_normal(1000) / 50 + 37.76,\n        "col2": rng(1).standard_normal(1000) / 50 + -122.4,\n        "col3": rng(2).standard_normal(1000) * 100,\n        "col4": rng(3).standard_normal((1000, 4)).tolist(),\n    }\n)\n\nst.map(df, latitude="col1", longitude="col2", size="col3", color="col4")\n
\n", + "description": "

Display a map with a scatterplot overlaid onto it.

\n

This is a wrapper around st.pydeck_chart to quickly create\nscatterplot charts on top of a map, with auto-centering and auto-zoom.

\n

When using this command, a service called Carto provides the map tiles to render\nmap content. If you're using advanced PyDeck features you may need to obtain\nan API key from Carto first. You can do that as\npydeck.Deck(api_keys={"carto": YOUR_KEY}) or by setting the CARTO_API_KEY\nenvironment variable. See PyDeck's documentation for more information.

\n

Another common provider for map tiles is Mapbox. If you prefer to use that,\nyou'll need to create an account at https://mapbox.com and specify your Mapbox\nkey when creating the pydeck.Deck object. You can do that as\npydeck.Deck(api_keys={"mapbox": YOUR_KEY}) or by setting the MAPBOX_API_KEY\nenvironment variable.

\n

Carto and Mapbox are third-party products and Streamlit accepts no responsibility\nor liability of any kind for Carto or Mapbox, or for any content or information\nmade available by Carto or Mapbox. The use of Carto or Mapbox is governed by\ntheir respective Terms of Use.

\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The data to be plotted.

\n", + "default": null + }, + { + "name": "latitude", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The name of the column containing the latitude coordinates of\nthe datapoints in the chart.

\n

If None, the latitude data will come from any column named 'lat',\n'latitude', 'LAT', or 'LATITUDE'.

\n", + "default": null + }, + { + "name": "longitude", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The name of the column containing the longitude coordinates of\nthe datapoints in the chart.

\n

If None, the longitude data will come from any column named 'lon',\n'longitude', 'LON', or 'LONGITUDE'.

\n", + "default": null + }, + { + "name": "color", + "type_name": "str or tuple or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color of the circles representing each datapoint.

\n

Can be:

\n
    \n
  • None, to use the default color.
  • \n
  • A hex string like "#ffaa00" or "#ffaa0088".
  • \n
  • An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.
  • \n
  • The name of the column to use for the color. Cells in this column\nshould contain colors represented as a hex string or color tuple,\nas described above.
  • \n
\n", + "default": "color" + }, + { + "name": "size", + "type_name": "str or float or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The size of the circles representing each point, in meters.

\n

This can be:

\n
    \n
  • None, to use the default size.
  • \n
  • A number like 100, to specify a single size to use for all\ndatapoints.
  • \n
  • The name of the column to use for the size. This allows each\ndatapoint to be represented by a circle of a different size.
  • \n
\n", + "default": "size" + }, + { + "name": "zoom", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Zoom level as specified in\nhttps://wiki.openstreetmap.org/wiki/Zoom_levels.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled. This is 500 by default.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override the map's native width with the width of\nthe parent container. This can be one of the following:

\n
    \n
  • None (default): Streamlit will use the map's default behavior.
  • \n
  • True: Streamlit sets the width of the map to match the\nwidth of the parent container.
  • \n
  • False: Streamlit sets the width of the map to fit its\ncontents according to the plotting library, up to the width of\nthe parent container.
  • \n
\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/map.py#L87" + }, + "streamlit.markdown": { + "name": "markdown", + "signature": "st.markdown(body, unsafe_allow_html=False, *, help=None, width=\"auto\", text_alignment=\"left\", anchors=True)", + "examples": "
\nimport streamlit as st\n\nst.markdown("*Streamlit* is **really** ***cool***.")\nst.markdown('''\n    :red[Streamlit] :orange[can] :green[write] :blue[text] :violet[in]\n    :gray[pretty] :rainbow[colors] and :blue-background[highlight] text.''')\nst.markdown("Here's a bouquet &mdash;\\\n            :tulip::cherry_blossom::rose::hibiscus::sunflower::blossom:")\n\nmulti = '''If you end a line with two spaces,\na soft return is used for the next line.\n\nTwo (or more) newline characters in a row will result in a hard return.\n'''\nst.markdown(multi)\n
\n", + "description": "

Display string formatted as Markdown.

\n", + "args": [ + { + "name": "body", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.\nIf anything other than a string is passed, it will be converted\ninto a string behind the scenes using str(body).

\n

This also supports:

\n
    \n
  • Emoji shortcodes, such as :+1: and :sunglasses:.\nFor a list of all supported codes,\nsee https://share.streamlit.io/streamlit/emoji-shortcodes.

    \n
  • \n
  • Streamlit logo shortcode. Use :streamlit: to add a little\nStreamlit flair to your text.

    \n
  • \n
  • A limited set of typographical symbols. "<- -> <-> -- >= <= ~="\nbecomes "\u2190 \u2192 \u2194 \u2014 \u2265 \u2264 \u2248" when parsed as Markdown.

    \n
  • \n
  • Google Material Symbols (rounded style), using the syntax\n:material/icon_name:, where "icon_name" is the name of the\nicon in snake case. For a complete list of icons, see Google's\nMaterial Symbols\nfont library.

    \n
  • \n
  • LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat https://katex.org/docs/supported.html.

    \n
  • \n
  • Colored text and background colors for text. There are two ways\nto apply colors:

    \n
      \n
    • Streamlit color palette: Use the syntax\n:color[your text] and\n:color-background[your text], where color is one of: red,\norange, yellow, green, blue, violet, gray, grey, rainbow, or\nprimary. For example, :orange[your text] or\n:blue-background[your text]. If you use "primary", Streamlit\nwill use the default primary accent color unless you set the\ntheme.primaryColor configuration option.

      \n
    • \n
    • Custom CSS colors: Use the syntax\n:color[your text]{foreground="..." background="..."} with a\nvalid CSS color value. Both foreground and background are\noptional. Supported formats include named CSS colors, HEX, RGB(A),\nand HSL(A). For example,\n:color[warning]{foreground="#d50000"} or\n:color[note]{foreground="rgb(0,100,200)" background="hsl(60,100%,90%)"}.

      \n
      \n

      Note

      \n

      When using :color[...]{} with custom CSS colors, a named\ncolor like "red" refers to the standard CSS named color,\nnot the Streamlit palette color. RGB and HSL values must use\ncomma-separated syntax; the modern space-separated syntax\nisn't supported. Colors are parsed by color2k.

      \n
      \n
    • \n
    \n
  • \n
  • Colored badges, using the syntax :color-badge[text in the badge].\ncolor must be replaced with any of the following supported\ncolors: red, orange, yellow, green, blue, violet, gray/grey, or primary.\nFor example, you can use :orange-badge[your text here] or\n:blue-badge[your text here].

    \n
  • \n
  • Shimmer effect for loading or in-progress text, using the syntax\n:shimmer[text to shimmer]. The text fades in and out to indicate\nongoing activity. This respects the user's reduced motion preferences.

    \n
  • \n
  • Small text, using the syntax :small[text to show small].

    \n
  • \n
\n", + "default": "primary" + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Whether to render HTML within body. If this is False\n(default), any HTML tags found in body will be escaped and\ntherefore treated as raw text. If this is True, any HTML\nexpressions within body will be rendered.

\n

Adding custom HTML to your app impacts safety, styling, and\nmaintainability.

\n
\n

Note

\n

If you only want to insert HTML or CSS without Markdown text,\nwe recommend using st.html instead.

\n
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the Markdown. If this is\nNone (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"auto\", \"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the Markdown element. This can be one of the following:

\n
    \n
  • "auto" (default): The width of the element adapts based on\nthe container flex layout. In vertical containers, the element\nuses "stretch" width. In horizontal containers, the element\nuses "content" width.
  • \n
  • "stretch": The width of the element matches the width of\nthe parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "text_alignment", + "type_name": "\"left\", \"center\", \"right\", or \"justify\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of the text within the element. This can\nbe one of the following:

\n
    \n
  • "left" (default): Text is aligned to the left edge.
  • \n
  • "center": Text is centered.
  • \n
  • "right": Text is aligned to the right edge.
  • \n
  • "justify": Text is justified (stretched to fill the available\nwidth with the last line left-aligned).
  • \n
\n
\n

Note

\n

For text alignment to have a visible effect, the element's\nwidth must be wider than its content. If you use\nwidth="content" with short text, the alignment may not be\nnoticeable.

\n
\n", + "default": null + }, + { + "name": "anchors", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show clickable anchor link icons next to Markdown\nheadings (h1-h6). If this is True (default), each heading\ngets a visible link icon on hover. If this is False, the\nlink icon is not rendered. Headings still receive an id\nattribute in either case, so URL fragment deep links (e.g.,\nhttps://example.com/#my-heading) continue to work.

\n

This is useful when Markdown headings are used purely for\nstyling and the anchor link icons would be visual noise.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/markdown.py#L72" + }, + "streamlit.menu_button": { + "name": "menu_button", + "signature": "st.menu_button(label, options, *, key=None, help=None, on_click=None, args=None, kwargs=None, type=\"secondary\", icon=None, disabled=False, width=\"content\", format_func=special_internal_function, wrap=None)", + "examples": "
\nimport streamlit as st\n\naction = st.menu_button("Export", options=["CSV", "JSON", "PDF"])\nif action == "CSV":\n    st.write("Exporting as CSV...")\nelif action == "JSON":\n    st.write("Exporting as JSON...")\nelif action == "PDF":\n    st.write("Exporting as PDF...")\n
\n", + "description": "

Display a dropdown menu button widget.

\n

A menu button displays a button which, when clicked, opens a dropdown\nmenu with multiple options. Selecting an option triggers a rerun and\nreturns the selected option value. If you open and close the dropdown\nmenu without selecting an option, the app doesn't rerun.

\n

st.menu_button behaves like st.button except that it returns\none of multiple options when triggered instead of only True. Unlike\nst.selectbox, the button label remains unchanged after a selection,\nand the return value reverts to None on the next rerun, until the\nmenu button is triggered again.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this button is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display unsupported elements as literal\ncharacters by backslash-escaping them. E.g.,\n"1\\. Not an ordered list".

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Labels for the menu options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default.

\n

Labels can include markdown as described in the label parameter.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you access the widget's value via\nst.session_state[key] (read-only). For more details, see\nWidget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when the button is hovered over. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when an option is selected.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string that specifies the button type. This can be one\nof the following:

\n
    \n
  • "primary": The button's background is the app's primary color\nfor additional emphasis.
  • \n
  • "secondary" (default): The button's background coordinates\nwith the app's background color for normal emphasis.
  • \n
  • "tertiary": The button is plain text without a border or\nbackground for subtlety.
  • \n
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the button if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the menu button. This can be one of the following:

\n
    \n
  • "content" (default): The width of the button matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the button matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The button has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the button matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Function to modify the display of the menu options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe menu button.

\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the trigger label can wrap onto multiple lines. This can\nbe one of the following:

\n
    \n
  • None (default): Streamlit decides based on the surrounding\nlayout. Inside a horizontal container, the button keeps its\nstandard, single-row height and truncates an overflowing label\nwith an ellipsis; in other layouts, the label wraps onto\nadditional lines.
  • \n
  • True: If the label is too wide for the button, it wraps onto\nadditional lines and the button grows taller.
  • \n
  • False: The button keeps its standard, single-row height. A\nlabel that is too wide is truncated with an ellipsis.
  • \n
\n

When the button keeps a single-row label and no help is set,\nhovering reveals the full label. The icon and expansion arrow\nremain visible. This parameter controls only the trigger label;\nmenu option labels are unaffected.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "any or None", + "is_generator": false, + "description": "

The selected option value when an option is clicked, or None\nif no option was clicked.

\n

This is a copy of the selected option, not the original.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/menu_button.py#L106" + }, + "streamlit.mermaid_chart": { + "name": "mermaid_chart", + "signature": "st.mermaid_chart(body, *, width=\"stretch\")", + "examples": "
\nimport streamlit as st\n\nst.mermaid_chart('''\n    graph LR\n        A[Start] --> B{Decision}\n        B -->|Yes| C[OK]\n        B -->|No| D[Cancel]\n''')\n
\n", + "description": "

Display a Mermaid diagram.

\n

Mermaid is a diagramming and charting tool that uses text-based\ndefinitions to create diagrams dynamically. For more information\nabout Mermaid syntax, see https://mermaid.js.org/.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The Mermaid diagram definition as a string. This uses Mermaid's\ntext-based syntax to define flowcharts, sequence diagrams, class\ndiagrams, state diagrams, and more.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/mermaid_chart.py#L30" + }, + "streamlit.metric": { + "name": "metric", + "signature": "st.metric(label, value, delta=None, delta_color=\"normal\", *, help=None, icon=None, label_visibility=\"visible\", border=False, width=\"stretch\", height=\"content\", chart_data=None, chart_type=\"line\", delta_arrow=\"auto\", format=None, delta_description=None)", + "examples": "
\n

Example 1: Show a metric

\n
\nimport streamlit as st\n\nst.metric(label="Temperature", value="70 \u00b0F", delta="1.2 \u00b0F")\n
\n

Example 2: Create a row of metrics

\n

st.metric looks especially nice in combination with st.columns.

\n
\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\ncol1.metric("Temperature", "70 \u00b0F", "1.2 \u00b0F")\ncol2.metric("Wind", "9 mph", "-8%")\ncol3.metric("Humidity", "86%", "4%")\n
\n

Example 3: Modify the delta indicator

\n

The delta indicator color can also be inverted or turned off.

\n
\nimport streamlit as st\n\nst.metric(\n    label="Gas price", value=4, delta=-0.5, delta_color="inverse"\n)\n\nst.metric(\n    label="Active developers",\n    value=123,\n    delta=123,\n    delta_color="off",\n)\n
\n

Example 4: Create a grid of metric cards

\n

Add borders to your metrics to create a dashboard look.

\n
\nimport streamlit as st\n\na, b = st.columns(2)\nc, d = st.columns(2)\n\na.metric("Temperature", "30\u00b0F", "-9\u00b0F", border=True)\nb.metric("Wind", "4 mph", "2 mph", border=True)\n\nc.metric("Humidity", "77%", "5%", border=True)\nd.metric("Pressure", "30.34 inHg", "-2 inHg", border=True)\n
\n

Example 5: Show sparklines

\n

To show trends over time, add sparklines.

\n
\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\nchanges = list(rng(4).standard_normal(20))\ndata = [sum(changes[:i]) for i in range(20)]\ndelta = round(data[-1], 2)\n\nrow = st.container(horizontal=True)\nwith row:\n    st.metric(\n        "Line", 10, delta, chart_data=data, chart_type="line", border=True\n    )\n    st.metric(\n        "Area", 10, delta, chart_data=data, chart_type="area", border=True\n    )\n    st.metric(\n        "Bar", 10, delta, chart_data=data, chart_type="bar", border=True\n    )\n
\n

Example 6: Show an icon

\n

Add an icon before the label with the icon parameter.

\n
\nimport streamlit as st\n\nst.metric(\n    "Temperature", "70 \u00b0F", "1.2 \u00b0F", icon=":material/thermostat:"\n)\n
\n
\n", + "description": "

Display a metric in big bold font, with an optional indicator of how the metric changed.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The header or title for the metric. The label can optionally\ncontain GitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "value", + "type_name": "int, float, decimal.Decimal, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Value of the metric. None is rendered as a long dash.

\n

The value can optionally contain GitHub-flavored Markdown, subject\nto the same limitations described in the label parameter.

\n", + "default": null + }, + { + "name": "delta", + "type_name": "int, float, decimal.Decimal, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Amount or indicator of change in the metric. An arrow is shown next\nto the delta, oriented according to its sign:

\n
    \n
  • If the delta is None or an empty string, no arrow is shown.
  • \n
  • If the delta is zero, no arrow is shown and the delta is gray.
  • \n
  • If the delta is a negative number or starts with a minus sign,\nthe arrow points down and the delta is red.
  • \n
  • Otherwise, the arrow points up and the delta is green.
  • \n
\n

You can modify the display, color, and orientation of the arrow\nusing the delta_color and delta_arrow parameters.

\n

The delta can optionally contain GitHub-flavored Markdown, subject\nto the same limitations described in the label parameter.

\n", + "default": null + }, + { + "name": "delta_color", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The color of the delta and chart. This can be one of the following:

\n
    \n
  • "normal" (default): The color is red when the delta is\nnegative, green when positive, and gray when zero.
  • \n
  • "inverse": The color is green when the delta is negative and\nred when positive. Zero deltas are gray. This is useful when a\nnegative change is considered good, like a decrease in cost.
  • \n
  • "off": The color is gray regardless of the delta.
  • \n
  • A named color from the basic palette: The chart and delta are the\nspecified color regardless of their value. This can be one of the\nfollowing: "red", "orange", "yellow", "green",\n"blue", "violet", "gray"/"grey", or\n"primary".
  • \n
\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the metric label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the metric label. If\nicon is None (default), no icon is displayed. If icon\nis a string, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "border", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show a border around the metric container. If this is\nFalse (default), no border is shown. If this is True, a\nborder is shown.

\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the metric element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the metric element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "chart_data", + "type_name": "Iterable or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A sequence of numeric values to display as a sparkline chart. If\nthis is None (default), no chart is displayed. The sequence can\nbe anything supported by st.dataframe, including a list or\nset. If the sequence is dataframe-like, the first column will\nbe used. Each value will be cast to float internally by\ndefault.

\n

The chart uses the color of the delta indicator, which can be\nmodified using the delta_color parameter.

\n", + "default": null + }, + { + "name": "chart_type", + "type_name": "\"line\", \"bar\", or \"area\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The type of sparkline chart to display. This can be one of the\nfollowing:

\n
    \n
  • "line" (default): A simple sparkline.
  • \n
  • "area": A sparkline with area shading.
  • \n
  • "bar": A bar chart.
  • \n
\n", + "default": null + }, + { + "name": "delta_arrow", + "type_name": "\"auto\", \"up\", \"down\", or \"off\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Controls the direction of the delta indicator arrow. This can be\none of the following strings:

\n
    \n
  • "auto" (default): The arrow direction follows the sign of\ndelta, and no arrow is shown if delta is zero.
  • \n
  • "up" or "down": The arrow is forced to point in the\nspecified direction.
  • \n
  • "off": No arrow is shown, but the delta value remains\nvisible.
  • \n
\n", + "default": null + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A format string controlling how numbers are displayed for value\nand delta. The format is only applied if the value or delta is\nnumeric. If the value or delta is a string with non-numeric\ncharacters, the format is ignored. The format can be one of the\nfollowing values:

\n
    \n
  • None (default): No formatting is applied.
  • \n
  • "plain": Show the full number without any formatting (e.g. "1234.567").
  • \n
  • "localized": Show the number in the default locale format (e.g. "1,234.567").
  • \n
  • "percent": Show the number as a percentage (e.g. "123456.70%").
  • \n
  • "dollar": Show the number as a dollar amount (e.g. "$1,234.57").
  • \n
  • "euro": Show the number as a euro amount (e.g. "\u20ac1,234.57").
  • \n
  • "yen": Show the number as a yen amount (e.g. "\u00a51,235").
  • \n
  • "accounting": Show the number in an accounting format (e.g. "1,234.00").
  • \n
  • "bytes": Show the number in a byte format (e.g. "1.2KB").
  • \n
  • "compact": Show the number in a compact format (e.g. "1.2K").
  • \n
  • "scientific": Show the number in scientific notation (e.g. "1.235E3").
  • \n
  • "engineering": Show the number in engineering notation (e.g. "1.235E3").
  • \n
  • printf-style format string: Format the number with a printf\nspecifier, like "%d" to show a signed integer (e.g. "1234") or\n"%.2f" to show a float with 2 decimal places. Use , for\nthousand separators (e.g. "%,d" yields "1,234").
  • \n
\n", + "default": "locale" + }, + { + "name": "delta_description", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A short description displayed next to the delta value, such as\n"month over month" or "vs. last quarter". If this is None\n(default), no description is shown. The description is displayed\nin a smaller, muted font style similar to st.caption.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/metric.py#L98" + }, + "streamlit.multiselect": { + "name": "multiselect", + "signature": "st.multiselect(label, options, default=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, max_selections=None, placeholder=None, disabled=False, label_visibility=\"visible\", accept_new_options=False, filter_mode=\"fuzzy\", width=\"stretch\", wrap=None, bind=None, persist_state=None)", + "examples": "

Example 1: Use a basic multiselect widget

\n

You can declare one or more initial selections with the default\nparameter.

\n
\nimport streamlit as st\n\noptions = st.multiselect(\n    "What are your favorite colors?",\n    ["Green", "Yellow", "Red", "Blue"],\n    default=["Yellow", "Red"],\n)\n\nst.write("You selected:", options)\n
\n

Example 2: Let users to add new options

\n

To allow users to enter and select new options that aren't included in\nthe options list, use the accept_new_options parameter. To\nprevent users from adding an unbounded number of new options, use the\nmax_selections parameter.

\n
\nimport streamlit as st\n\noptions = st.multiselect(\n    "What are your favorite cat names?",\n    ["Jellybeans", "Fish Biscuit", "Madam President"],\n    max_selections=5,\n    accept_new_options=True,\n)\n\nst.write("You selected:", options)\n
\n", + "description": "

Display a multiselect widget.

\n

The multiselect widget starts as empty.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this select widget is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default.

\n", + "default": null + }, + { + "name": "default", + "type_name": "Iterable of V, V, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

List of default values. Can also be a single value.

\n", + "default": "values" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Function to modify the display of the options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe command.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing max_selections or accept_new_options\nresets the widget even when a key is provided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this widget's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "max_selections", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The max selections that can be selected at a time. If this is\nNone (default), there is no limit on the number of selections.\nIf this is an integer, it must be positive.

\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A string to display when no options are selected.\nIf this is None (default), the widget displays placeholder text\nbased on the widget's configuration:

\n
    \n
  • "Choose options" is displayed when options are available and\naccept_new_options=False.
  • \n
  • "Choose or add options" is displayed when options are available\nand accept_new_options=True.
  • \n
  • "Add options" is displayed when no options are available and\naccept_new_options=True.
  • \n
  • "No options to select" is displayed when no options are available\nand accept_new_options=False. The widget is also disabled in\nthis case.
  • \n
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the multiselect widget if set\nto True. The default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "accept_new_options", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the user can add selections that aren't included in options.\nIf this is False (default), the user can only select from the\nitems in options. If this is True, the user can enter new\nitems that don't exist in options.

\n

When a user enters and selects a new item, it is included in the\nwidget's returned list as a string. The new item is not added to\nthe widget's drop-down menu. Streamlit will use a case-insensitive\nmatch from options before adding a new item, and a new item\ncan't be added if a case-insensitive match is already selected. The\nmax_selections argument is still enforced.

\n", + "default": null + }, + { + "name": "filter_mode", + "type_name": "\"fuzzy\", \"contains\", \"prefix\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The matching mode used to filter options while the user types.\nIf this is "fuzzy" (default), options are matched by in-order\nsubsequence and sorted by match score. If this is "contains",\noptions are matched by case-insensitive substring. If this is\n"prefix", options are matched by case-insensitive prefix. If\nthis is None, typing is disabled and the options are not\nfiltered.

\n

filter_mode=None is incompatible with\naccept_new_options=True.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the multiselect widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the selected-value chips can wrap onto multiple rows. This\ncan be one of the following:

\n
    \n
  • None (default): Streamlit chooses the wrapping behavior based\non the layout. Inside a horizontal container, the chips stay in a\nsingle row and the chip area scrolls horizontally; in other\nlayouts, the chips wrap onto additional rows.
  • \n
  • True: If the selected chips are too wide for the widget, they\nwrap onto additional rows and the widget grows taller.
  • \n
  • False: The selected chips stay in a single row at a fixed\nheight. If they don't fit, the chip area scrolls horizontally\nwhile the clear and dropdown controls stay pinned.
  • \n
\n

Changing wrap only affects the layout; it does not reset the\nwidget's value.

\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

An empty query parameter (e.g., ?tags=) clears the\nwidget. Invalid query parameter values are ignored and\nremoved from the URL. Multiple selections use repeated\nparameters (e.g., ?tags=Red&tags=Blue). Duplicates are\ndeduplicated. If max_selections is set, excess values\nare truncated. When accept_new_options is True, any\nvalue is accepted.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "list", + "is_generator": false, + "description": "

A list of the selected options.

\n

The list contains copies of the selected options, not the originals.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/multiselect.py#L268" + }, + "streamlit.navigation": { + "name": "navigation", + "signature": "st.navigation(pages, *, position=\"sidebar\", expanded=False)", + "examples": "

The following examples show different possible entrypoint files, each named\nstreamlit_app.py. An entrypoint file is passed to streamlit run. It\nmanages your app's navigation and serves as a router between pages.

\n

Example 1: Use a callable or Python file as a page

\n

You can declare pages from callables or file paths. If you pass callables\nor paths to st.navigation as a page-like objects, they are internally\nconverted to Page objects using st.Page. In this case, the\npage titles, icons, and paths are inferred from the file or callable names.

\n

page_1.py (in the same directory as your entrypoint file):

\n
\nimport streamlit as st\n\nst.title("Page 1")\n
\n

streamlit_app.py:

\n
\nimport streamlit as st\n\ndef page_2():\n    st.title("Page 2")\n\npg = st.navigation(["page_1.py", page_2])\npg.run()\n
\n

Example 2: Group pages into sections and customize them with ``st.Page``

\n

You can use a dictionary to create sections within your navigation menu. In\nthe following example, each page is similar to Page 1 in Example 1, and all\npages are in the same directory. However, you can use Python files from\nanywhere in your repository. st.Page is used to give each page a custom\ntitle. For more information, see st.Page.

\n

Directory structure:

\n
\nyour_repository/\n\u251c\u2500\u2500 create_account.py\n\u251c\u2500\u2500 learn.py\n\u251c\u2500\u2500 manage_account.py\n\u251c\u2500\u2500 streamlit_app.py\n\u2514\u2500\u2500 trial.py\n
\n

streamlit_app.py:

\n
\nimport streamlit as st\n\npages = {\n    "Your account": [\n        st.Page("create_account.py", title="Create your account"),\n        st.Page("manage_account.py", title="Manage your account"),\n    ],\n    "Resources": [\n        st.Page("learn.py", title="Learn about us"),\n        st.Page("trial.py", title="Try it out"),\n    ],\n}\n\npg = st.navigation(pages)\npg.run()\n
\n

Example 3: Use top navigation

\n

You can use the position parameter to place the navigation at the top\nof the app. This is useful for apps with a lot of pages because it allows\nyou to create collapsible sections for each group of pages. The following\nexample uses the same directory structure as Example 2 and shows how to\ncreate a top navigation menu.

\n

streamlit_app.py:

\n
\nimport streamlit as st\n\npages = {\n    "Your account": [\n        st.Page("create_account.py", title="Create your account"),\n        st.Page("manage_account.py", title="Manage your account"),\n    ],\n    "Resources": [\n        st.Page("learn.py", title="Learn about us"),\n        st.Page("trial.py", title="Try it out"),\n    ],\n}\n\npg = st.navigation(pages, position="top")\npg.run()\n
\n

Example 4: Stateful widgets across multiple pages

\n

Call widget functions in your entrypoint file when you want a widget to be\nstateful across pages. Assign keys to your common widgets and access their\nvalues through Session State within your pages.

\n

streamlit_app.py:

\n
\nimport streamlit as st\n\ndef page1():\n    st.write(st.session_state.foo)\n\ndef page2():\n    st.write(st.session_state.bar)\n\n# Widgets shared by all the pages\nst.sidebar.selectbox("Foo", ["A", "B", "C"], key="foo")\nst.sidebar.checkbox("Bar", key="bar")\n\npg = st.navigation([page1, page2])\npg.run()\n
\n", + "description": "

Configure the available pages in a multipage app.

\n

Call st.navigation in your entrypoint file to define the available\npages for your app. st.navigation returns the current page, which can\nbe executed using .run() method.

\n

When using st.navigation, your entrypoint file (the file passed to\nstreamlit run) acts like a router or frame of common elements around\neach of your pages. Streamlit executes the entrypoint file with every app\nrerun. To execute the current page, you must call the .run() method on\nthe Page object returned by st.navigation.

\n

The set of available pages can be updated with each rerun for dynamic\nnavigation. By default, st.navigation displays the available pages in\nthe sidebar if there is more than one page. This behavior can be changed\nusing the position keyword argument.

\n

As soon as any session of your app executes the st.navigation command,\nyour app will ignore the pages/ directory (across all sessions).

\n", + "args": [ + { + "name": "pages", + "type_name": "Sequence[page-like], Mapping[str, Sequence[page-like]]", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The available pages for the app.

\n

To create a navigation menu with no sections or page groupings,\npages must be a list of page-like objects. Page-like objects are\nanything that can be passed to st.Page or a Page\nobject returned by st.Page.

\n

To create labeled sections or page groupings within the navigation\nmenu, pages must be a dictionary. Each key is the label of a\nsection and each value is the list of page-like objects for\nthat section. If you use position="top", each grouping will be a\ncollapsible item in the navigation menu. For top navigation, if you use\nan empty string as a section header, the pages in that section will be\ndisplayed at the beginning of the menu before the collapsible sections.\nSection labels support GitHub-flavored Markdown as described in the\ntitle parameter of st.Page.

\n

When you use a string or path as a page-like object, they are\ninternally passed to st.Page and converted to Page\nobjects. In this case, the page will have the default title, icon, and\npath inferred from its path or filename. To customize these attributes\nfor your page, initialize your page with st.Page.

\n", + "default": "title" + }, + { + "name": "position", + "type_name": "\"sidebar\", \"top\", or \"hidden\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The position of the navigation menu. If this is "sidebar"\n(default), the navigation widget appears at the top of the sidebar. If\nthis is "top", the navigation appears in the top header of the app.\nIf this is "hidden", the navigation widget is not displayed.

\n

If there is only one page in pages, the navigation will be hidden\nfor any value of position.

\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Controls whether the navigation menu is expanded and how many items\nare visible when it's collapsed.

\n

This parameter is only used when position="sidebar" and the sidebar\nhas other elements below the navigation menu. If the sidebar only\ncontains the navigation menu, it will always be fully expanded. The\nfollowing values are valid:

\n
    \n
  • False (default): The navigation menu shows a maximum\nof ten pages when there are more than twelve pages. The menu is fully\nexpanded when there are twelve or fewer pages. A collapsed menu has a\n"View X more" button at the bottom. An expanded menu that can be\ncollapsed has a "View less" button at the bottom.
  • \n
  • True: The navigation menu will always be fully expanded, and no\n"View less" button will be displayed.
  • \n
  • Positive integer: A positive integer specifies the maximum number of\npages to display when the menu is collapsed. When there are at least\nthree more pages than this integer, the menu will be collapsed.\nOtherwise, the menu will be fully expanded. expanded=10 is\nequivalent to the default, expanded=False.
  • \n
\n

If the value of expanded changes between reruns, an expanded menu\nwill stay expanded. If the change in value makes the menu newly\ncollapsible, Streamlit will only add a "View less" button at the bottom.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Page", + "is_generator": false, + "description": "

The current page selected by the user. To run the page, you must use\nthe .run() method on it.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/commands/navigation.py#L88" + }, + "streamlit.number_input": { + "name": "number_input", + "signature": "st.number_input(label, min_value=None, max_value=None, value=\"min\", step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\", icon=None, width=\"stretch\", bind=None, persist_state=None)", + "examples": "
\nimport streamlit as st\n\nnumber = st.number_input("Insert a number")\nst.write("The current number is ", number)\n
\n

To initialize an empty number input, use None as the value:

\n
\nimport streamlit as st\n\nnumber = st.number_input(\n    "Insert a number", value=None, placeholder="Type a number..."\n)\nst.write("The current number is ", number)\n
\n", + "description": "

Display a numeric input widget.

\n
\n

Note

\n

Integer values exceeding +/- (1<<53) - 1 cannot be accurately\nstored or returned by the widget due to serialization constraints\nbetween the Python server and JavaScript client. You must handle\nsuch numbers as floats, leading to a loss in precision.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "min_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The minimum permitted value.\nIf this is None (default), there will be no minimum for float\nvalues and a minimum of - (1<<53) + 1 for integer values.

\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The maximum permitted value.\nIf this is None (default), there will be no maximum for float\nvalues and a maximum of (1<<53) - 1 for integer values.

\n", + "default": null + }, + { + "name": "value", + "type_name": "int, float, \"min\" or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value of this widget when it first renders. If this is\n"min" (default), the initial value is min_value unless\nmin_value is None. If min_value is None, the widget\ninitializes with a value of 0.0 or 0.

\n

If value is None, the widget will initialize with no value\nand return None until the user provides input.

\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The stepping interval.\nDefaults to 1 if the value is an int, 0.01 otherwise.\nIf the value is not specified, the format parameter will be used.

\n", + "default": "1" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A printf-style format string controlling how the interface should\ndisplay numbers. The output must be purely numeric. This does not\nimpact the return value of the widget. For more information about\nthe formatting specification, see sprintf.js.

\n

For example, format="%0.1f" adjusts the displayed decimal\nprecision to only show one digit after the decimal.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this number_input's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string displayed when the number input is empty.\nIf None, no placeholder is displayed.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the number input if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display within the input field to the\nleft of the value. If icon is None (default), no icon is\ndisplayed. If icon is a string, the following options are\nvalid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the number input widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

Invalid query parameter values are ignored and removed\nfrom the URL. If value is None, an empty query\nparameter (e.g., ?my_key=) clears the widget.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "int or float or None", + "is_generator": false, + "description": "

The current value of the numeric input widget or None if the widget\nis empty. The return type will match the data type of the value parameter.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/number_input.py#L240" + }, + "streamlit.page_link": { + "name": "page_link", + "signature": "st.page_link(page, *, label=None, icon=None, icon_position=\"left\", help=None, disabled=False, use_container_width=None, width=\"content\", query_params=None)", + "examples": "

Example 1: Basic usage

\n

The following example shows how to create page links in a multipage app\nthat uses the pages/ directory:

\n
\nyour-repository/\n\u251c\u2500\u2500 pages/\n\u2502   \u251c\u2500\u2500 page_1.py\n\u2502   \u2514\u2500\u2500 page_2.py\n\u2514\u2500\u2500 your_app.py\n
\n
\nimport streamlit as st\n\nst.page_link("your_app.py", label="Home", icon="\ud83c\udfe0")\nst.page_link("pages/page_1.py", label="Page 1", icon="1\ufe0f\u20e3")\nst.page_link("pages/page_2.py", label="Page 2", icon="2\ufe0f\u20e3", disabled=True)\nst.page_link("http://www.google.com", label="Google", icon="\ud83c\udf0e")\n
\n

The default navigation is shown here for comparison, but you can hide\nthe default navigation using the client.showSidebarNavigation\nconfiguration option. This allows you to create custom, dynamic\nnavigation menus for your apps!

\n

Example 2: Passing query parameters

\n

The following example shows how to pass query parameters when creating a\npage link in a multipage app:

\n
\nyour-repository/\n\u251c\u2500\u2500 page_2.py\n\u2514\u2500\u2500 your_app.py\n
\n
\nimport streamlit as st\n\ndef page_1():\n    st.title("Page 1")\n    st.page_link("page_2.py", query_params={"utm_source": "page_1"})\n\npg = st.navigation([page_1, "page_2.py"])\npg.run()\n
\n", + "description": "

Display a link to another page in a multipage app or to an external page.

\n

If another page in a multipage app is specified, clicking st.page_link\nstops the current page execution and runs the specified page as if the\nuser clicked on it in the sidebar navigation.

\n

If an external page is specified, clicking st.page_link opens a new\ntab to the specified page. The current script run will continue if not\ncomplete.

\n", + "args": [ + { + "name": "page", + "type_name": "str, Path, or Page", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The page to switch to on user click. This can be one of the\nfollowing values:

\n
    \n
  • Path to a Python file: The path can be a string or\npathlib.Path object. It can be absolute or relative to the\nentrypoint file. The Python file must be the source of a page in\nst.navigation.

    \n

    If you are using the pages/ directory instead of\nst.navigation, the Python file must be your entrypoint file\nor a file in the pages/ directory.

    \n
  • \n
  • Page: The source of the Page and its\nurl_path must match a page defined in st.navigation.\nUse st.Page to create a Page object.

    \n
  • \n
  • URL: The URL must contain an HTTP or HTTPS scheme, like\n"https://docs.streamlit.io". When a user clicks a\nURL-defined page link, the URL opens in a new tab and the app\ndoesn't rerun. If the page link is defined by a URL, then the\nlabel parameter is required.

    \n
  • \n
\n

To link to a page defined by a callable, you must use a\nPage object.

\n", + "default": null + }, + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The label for the page link. Labels are required for external pages.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the link label. If\nicon is None (default), the icon is inferred from the\nPage object or no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "icon_position", + "type_name": "\"left\" or \"right\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The position of the icon relative to the link label. This\ndefaults to "left".

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when the link is hovered over. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the page link if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch". For use_container_width=False, use\nwidth="content".

\n" + }, + "description": "

Whether to expand the link's width to fill its parent container.\nThe default is True for page links in the sidebar and False\nfor those in the main app.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the page-link button. This can be one of the following:

\n
    \n
  • "content" (default): The width of the button matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the button matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The button has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the button matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "query_params", + "type_name": "dict, list of tuples, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Query parameters to apply when navigating to the target page.\nThis can be a dictionary or an iterable of key-value tuples. Values can\nbe strings or iterables of strings (for repeated keys). When this is\nNone (default), all non-embed query parameters are cleared during\nnavigation.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/button.py#L1149" + }, + "streamlit.pagination": { + "name": "pagination", + "signature": "st.pagination(num_pages, *, default=1, max_visible_pages=7, width=\"content\", key=None, on_change=None, args=None, kwargs=None, disabled=False, bind=None, persist_state=None)", + "examples": "

Basic usage with paginated content:

\n
\nimport streamlit as st\n\npage = st.pagination(num_pages=10)\nst.write(f"Showing page {page}")\n
\n

Paginated dataframe:

\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame({"A": range(100), "B": range(100, 200)})\nrows_per_page = 10\ntotal_pages = (len(df) + rows_per_page - 1) // rows_per_page\n\n# Use placeholders to show dataframe above pagination\ndataframe_slot = st.empty()\nwith st.container(horizontal_alignment="right"):\n    page = st.pagination(num_pages=total_pages)\n\nstart_idx = (page - 1) * rows_per_page\nend_idx = start_idx + rows_per_page\ndataframe_slot.dataframe(df.iloc[start_idx:end_idx])\n
\n", + "description": "

Display a pagination widget for navigating through pages of content.

\n

The widget displays numbered page buttons with previous/next arrows and\nintelligent truncation for large page counts. One page is always selected,\nand the widget returns the currently selected page number (1-indexed).

\n", + "args": [ + { + "name": "num_pages", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Total number of pages. Must be at least 1.

\n", + "default": null + }, + { + "name": "default", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Initial selected page (1-indexed). Must be between 1 and num_pages.\nThe default is 1.

\n", + "default": "is" + }, + { + "name": "max_visible_pages", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Target number of page buttons to display (excluding prev/next arrows).\nThe actual number may be slightly higher in certain edge cases to ensure\nthe first and last pages are always visible for navigation context.\nThe widget auto-adapts to available width and may show fewer pages to\nprevent wrapping. The default is 7.

\n
    \n
  • Set to None to remove the explicit page-count cap (all pages are\neligible to be shown; responsive auto-adaptation may still hide some).
  • \n
  • Set to 0 to show only prev/next arrows (no page numbers).
  • \n
\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the pagination widget. This can be one of the following:

\n
    \n
  • "content" (default): The width of the widget matches the width\nof its content, but doesn't exceed the width of the parent container.
  • \n
  • "stretch": The width of the widget matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The widget has a fixed\nwidth. If the specified width is greater than the width of the parent\ncontainer, the width of the widget matches the width of the parent\ncontainer.
  • \n
\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when the selected page changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the pagination widget if set\nto True. The default is False.

\n", + "default": "is" + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Bind the widget's value to st.query_params so that the widget's\nvalue is synced to the URL query string. If this is "query-params"\n(default is None), the widget's value will be read from and\nwritten to the URL using the key parameter as the query\nparameter name. This enables shareable URLs that preserve the\nwidget's state. If bind is set, key is required.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "int", + "is_generator": false, + "description": "

The currently selected page (1-indexed).

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/pagination.py#L68" + }, + "streamlit.pdf": { + "name": "pdf", + "signature": "st.pdf(data, *, height=500, key=None)", + "examples": "
\nst.pdf("https://example.com/sample.pdf")\nst.pdf("https://example.com/sample.pdf", height=600)\n
\n", + "description": "

Display a PDF viewer.

\n
\n

Important

\n

You must install streamlit-pdf to use this command. You can\ninstall it as an extra with Streamlit:

\n
\npip install streamlit[pdf]\n
\n
\n", + "args": [ + { + "name": "data", + "type_name": "str, Path, BytesIO, or bytes", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The PDF file to show. This can be one of the following:

\n
    \n
  • A URL (string) for a hosted PDF file.
  • \n
  • A path to a local PDF file. If you use a relative path, it must\nbe relative to the current working directory.
  • \n
  • A file-like object. For example, this can be an UploadedFile\nfrom st.file_uploader, or this can be a local file opened\nwith open().
  • \n
  • Raw bytes data.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "int or \"stretch\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the PDF viewer. This can be one of the following:

\n
    \n
  • An integer specifying the height in pixels: The viewer has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled. This is 500 by default.
  • \n
  • "stretch": The height of the viewer matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the viewer is not in a parent container, the height\nof the viewer matches the height of its content.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/pdf.py#L51" + }, + "streamlit.pills": { + "name": "pills", + "signature": "st.pills(label, options, *, selection_mode=\"single\", default=None, required=False, format_func=None, key=None, help=None, on_change=None, args=None, kwargs=None, disabled=False, label_visibility=\"visible\", width=\"content\", bind=None, persist_state=None)", + "examples": "

Example 1: Multi-select pills

\n

Display a multi-select pills widget, and show the selection:

\n
\nimport streamlit as st\n\noptions = ["North", "East", "South", "West"]\nselection = st.pills("Directions", options, selection_mode="multi")\nst.markdown(f"Your selected options: {selection}.")\n
\n

Example 2: Single-select pills with icons

\n

Display a single-select pills widget with icons:

\n
\nimport streamlit as st\n\noption_map = {\n    0: ":material/add:",\n    1: ":material/zoom_in:",\n    2: ":material/zoom_out:",\n    3: ":material/zoom_out_map:",\n}\nselection = st.pills(\n    "Tool",\n    options=option_map.keys(),\n    format_func=lambda option: option_map[option],\n    selection_mode="single",\n)\nst.write(\n    "Your selected option: "\n    f"{None if selection is None else option_map[selection]}"\n)\n
\n", + "description": "

Display a pills widget.

\n

A pills widget is similar to a st.selectbox or st.multiselect\nwhere the options are displayed as pill-buttons instead of a\ndrop-down list.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this widget is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable of V", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default and can\noptionally contain GitHub-flavored Markdown, including the Markdown\ndirectives described in the body parameter of st.markdown.

\n", + "default": "and" + }, + { + "name": "selection_mode", + "type_name": "\"single\" or \"multi\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The selection mode for the widget. If this is "single"\n(default), only one option can be selected. If this is "multi",\nmultiple options can be selected.

\n", + "default": null + }, + { + "name": "default", + "type_name": "Iterable of V, V, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The value of the widget when it first renders. If the\nselection_mode is multi, this can be a list of values, a\nsingle value, or None. If the selection_mode is\n"single", this can be a single value or None.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether a selection is required. If this is True and\nselection_mode="single", users cannot deselect an option once\none is selected. Clicking an already-selected option does nothing.\nThe default is False.

\n

If required=True is used with selection_mode="multi", an\nexception is raised.

\n", + "default": "is" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Function to modify the display of the options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe command. The output can optionally contain GitHub-flavored\nMarkdown, including the Markdown directives described in the\nbody parameter of st.markdown.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing selection_mode resets the widget even when a\nkey is provided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when this widget's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the widget if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the pills widget. This can be one of the following:

\n
    \n
  • "content" (default): The width of the widget matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the widget matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

An empty query parameter (e.g., ?tags=) clears the\nwidget. Invalid query parameter values are ignored and removed from\nthe URL. For selection_mode="multi", multiple selections use\nrepeated parameters (e.g., ?tags=Red&tags=Blue) and duplicates\nare deduplicated.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "list of V, V, or None", + "is_generator": false, + "description": "

If the selection_mode is multi, this is a list of selected\noptions or an empty list. If the selection_mode is\n"single", this is a selected option or None.

\n

This contains copies of the selected options, not the originals.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/button_group.py#L409" + }, + "streamlit.plotly_chart": { + "name": "plotly_chart", + "signature": "st.plotly_chart(figure_or_data, use_container_width=None, *, width=\"stretch\", height=\"content\", theme=\"streamlit\", key=None, on_select=\"ignore\", selection_mode=('points', 'box', 'lasso'), config=None)", + "examples": "

Example 1: Basic Plotly chart

\n

The example below comes from the examples at https://plot.ly/python.\nNote that plotly.figure_factory requires scipy to run.

\n
\nimport plotly.figure_factory as ff\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\nhist_data = [\n    rng(0).standard_normal(200) - 2,\n    rng(1).standard_normal(200),\n    rng(2).standard_normal(200) + 2,\n]\ngroup_labels = ["Group 1", "Group 2", "Group 3"]\n\nfig = ff.create_distplot(\n    hist_data, group_labels, bin_size=[0.1, 0.25, 0.5]\n)\n\nst.plotly_chart(fig)\n
\n

Example 2: Plotly Chart with configuration

\n

By default, Plotly charts have scroll zoom enabled. If you have a\nlonger page and want to avoid conflicts between page scrolling and\nzooming, you can use Plotly's configuration options to disable scroll\nzoom. In the following example, scroll zoom is disabled, but the zoom\nbuttons are still enabled in the modebar.

\n
\nimport plotly.graph_objects as go\nimport streamlit as st\n\nfig = go.Figure()\nfig.add_trace(\n    go.Scatter(\n        x=[1, 2, 3, 4, 5],\n        y=[1, 3, 2, 5, 4]\n    )\n)\n\nst.plotly_chart(fig, config = {'scrollZoom': False})\n
\n", + "description": "

Display an interactive Plotly chart.

\n

Plotly is a charting library for Python.

\n

To show Plotly charts in Streamlit, pass a Plotly Figure or\nData object to st.plotly_chart.

\n
\n

Important

\n

You must install plotly>=4.0.0 to use this command. Your app's\nperformance may be enhanced by installing orjson as well. You\ncan install all charting dependencies as an extra\nwith Streamlit:

\n
\npip install streamlit[charts]\n
\n
\n", + "args": [ + { + "name": "figure_or_data", + "type_name": "plotly.graph_objs.Figure, plotly.graph_objs.Data, or dict/list of plotly.graph_objs.Figure/Data", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The Plotly Figure or Data object to render. See\nhttps://plot.ly/python/ for examples of graph descriptions.

\n
\n

Note

\n

If your chart contains more than 1000 data points, Plotly will\nuse a WebGL renderer to display the chart. Different browsers\nhave different limits on the number of WebGL contexts per page.\nIf you have multiple WebGL contexts on a page, you may need to\nswitch to SVG rendering mode. You can do this by setting\nrender_mode="svg" within the figure. For example, the\nfollowing code defines a Plotly Express line chart that will\nrender in SVG mode when passed to st.plotly_chart:\npx.line(df, x="x", y="y", render_mode="svg").

\n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": false, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override the figure's native width with the width of\nthe parent container. This can be one of the following:

\n
    \n
  • None (default): Streamlit will use the value of width.
  • \n
  • True: Streamlit sets the width of the figure to match the\nwidth of the parent container.
  • \n
  • False: Streamlit sets the width of the figure to fit its\ncontents according to the plotting library, up to the width of\nthe parent container.
  • \n
\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The theme of the chart. If theme is "streamlit" (default),\nStreamlit uses its own design default. If theme is None,\nStreamlit falls back to the default behavior of the library.

\n

The "streamlit" theme can be partially customized through the\nconfiguration options theme.chartCategoricalColors and\ntheme.chartSequentialColors. Font configuration options are\nalso applied.

\n", + "default": "behavior" + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string to use for giving this element a stable\nidentity. If this is None (default), the element's identity\nwill be determined based on the values of the other parameters.

\n

If selections are activated and key is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only. For more\ndetails, see Widget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\" or \"rerun\" or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the figure should respond to user selection events. This\ncontrols whether or not the figure behaves like an input widget.\non_select can be one of the following:

\n
    \n
  • "ignore" (default): Streamlit will not react to any selection\nevents in the chart. The figure will not behave like an input\nwidget.
  • \n
  • "rerun": Streamlit will rerun the app when the user selects\ndata in the chart. In this case, st.plotly_chart will return\nthe selection data as a dictionary.
  • \n
  • A callable: Streamlit will rerun the app and execute the\ncallable as a callback function before the rest of the app.\nIn this case, st.plotly_chart will return the selection data\nas a dictionary.
  • \n
\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "\"points\", \"box\", \"lasso\" or an Iterable of these", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The selection mode of the chart. This can be one of the following:

\n
    \n
  • "points": The chart will allow selections based on individual\ndata points.
  • \n
  • "box": The chart will allow selections based on rectangular\nareas.
  • \n
  • "lasso": The chart will allow selections based on freeform\nareas.
  • \n
  • An Iterable of the above options: The chart will allow\nselections based on the modes specified.
  • \n
\n

All selections modes are activated by default.

\n", + "default": null + }, + { + "name": "config", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A dictionary of Plotly configuration options. This is passed to\nPlotly's show() function. For more information about Plotly\nconfiguration options, see Plotly's documentation on Configuration\nin Python.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or PlotlyState", + "is_generator": false, + "description": "

If on_select is "ignore" (default), this command returns an\ninternal placeholder for the chart element. Otherwise, this command\nreturns a PlotlyState object. This object is dictionary-like\nand supports both key and attribute notation. To use this type in\nan annotation, import it from streamlit.typing.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/plotly_chart.py#L456" + }, + "streamlit.popover": { + "name": "popover", + "signature": "st.popover(label, *, type=\"secondary\", help=None, icon=None, disabled=False, use_container_width=None, width=\"content\", wrap=None, key=None, on_change=\"ignore\", args=None, kwargs=None)", + "examples": "

Example 1: Use context management\nYou can use the with notation to insert any element into a popover:

\n
\nimport streamlit as st\n\nwith st.popover("Open popover"):\n    st.markdown("Hello World \ud83d\udc4b")\n    name = st.text_input("What's your name?")\n\nst.write("Your name:", name)\n
\n

Example 2: Call methods directly

\n

You can call methods directly on the returned object:

\n
\nimport streamlit as st\n\npopover = st.popover("Filter items")\nred = popover.checkbox("Show red items.", True)\nblue = popover.checkbox("Show blue items.", True)\n\nif red:\n    st.write(":red[This is a red item.]")\nif blue:\n    st.write(":blue[This is a blue item.]")\n
\n

Example 3: Programmatically control the popover state

\n

You can use a key to programmatically control the popover state or\naccess the state in callbacks. You must set the on_change parameter\nfor the popover to track state.

\n
\nimport streamlit as st\n\ndef toggle_popover():\n    st.session_state.drawer = not st.session_state.drawer\n\ndef on_popover_change():\n    if st.session_state.drawer:\n        st.toast("You opened the popover.")\n    else:\n        st.toast("You closed the popover.")\n\nwith st.popover("Open popover", on_change=on_popover_change, key="drawer"):\n    st.write("This is the popover")\n    st.button("Close popover", on_click=toggle_popover)\n\nst.button("Open popover", on_click=toggle_popover)\n
\n", + "description": "

Insert a popover container.

\n

Inserts a multi-element container as a popover. It consists of a button-like\nelement and a container that opens when the button is clicked.

\n

To add elements to the returned container, you can use the "with"\nnotation (preferred) or just call methods directly on the returned object.\nSee examples below.

\n

Interacting with widgets inside of an open popover will rerun the app\nwhile keeping the popover open. Clicking outside of the popover will\nclose it.

\n

By default, all content within the popover is computed and sent to the\nfrontend, and the app doesn't rerun when the popover is opened or\nclosed. To enable lazy execution where content only runs when the\npopover is open, use on_change="rerun" or pass a callable to\non_change. The .open property indicates whether the popover is\ncurrently open, letting you conditionally render expensive content.

\n
\n

Note

\n

To follow best design practices, don't nest popovers.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label of the button that opens the popover container.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when the popover button is hovered\nover. If this is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string that specifies the button type. This can be one\nof the following:

\n
    \n
  • "primary": The button's background is the app's primary color\nfor additional emphasis.
  • \n
  • "secondary" (default): The button's background coordinates\nwith the app's background color for normal emphasis.
  • \n
  • "tertiary": The button is plain text without a border or\nbackground for subtlety.
  • \n
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the button label. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the popover button if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch". For use_container_width=False, use\nwidth="content".

\n" + }, + "description": "

Whether to expand the button's width to fill its parent container.\nIf use_container_width is False (default), Streamlit sizes\nthe button to fit its content. If use_container_width is\nTrue, the width of the button matches its parent container.

\n

In both cases, if the content of the button is wider than the\nparent container, the content will line wrap.

\n

The popover container's minimum width matches the width of its\nbutton. The popover container may be wider than its button to fit\nthe container's content.

\n", + "default": null + }, + { + "name": "width", + "type_name": "int, \"stretch\", or \"content\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the button. This can be one of the following:

\n
    \n
  • "content" (default): The width of the button matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the button matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The button has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the button matches the width\nof the parent container.
  • \n
\n

The popover container's minimum width matches the width of its\nbutton. The popover container may be wider than its button to fit\nthe container's contents.

\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the popover button's label can wrap onto multiple lines.\nThis can be one of the following:

\n
    \n
  • None (default): Streamlit decides based on the surrounding\nlayout. Inside a horizontal container, the button keeps its\nstandard, single-row height and truncates an overflowing label\nwith an ellipsis; in other layouts, the label wraps onto\nadditional lines.
  • \n
  • True: If the label is too wide for the button, it wraps onto\nadditional lines and the button grows taller.
  • \n
  • False: The button keeps its standard, single-row height. A\nlabel that is too wide is truncated with an ellipsis.
  • \n
\n

When the button keeps a single-row label and no help is set,\nhovering reveals the full label. The icon and chevron remain\nvisible.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key.

\n

When on_change is set to "rerun" or a callable, setting a\nkey lets you read or update the open/closed state via\nst.session_state[key]. For more details, see Widget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "\"ignore\", \"rerun\", or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the popover should respond when the user opens or closes it.\nThis controls whether the popover tracks state and triggers\nreruns. on_change can be one of the following values:

\n
    \n
  • "ignore" (default): The popover doesn't track state. All\npopover content runs regardless of whether the popover is open or\nclosed. The .open attribute of the popover container returns\nNone.
  • \n
  • "rerun": The popover tracks state. Streamlit reruns the app\nwhen the user opens or closes the popover. The .open\nattribute of the popover container returns the current state,\nwhich is True if the popover is open and False if it's\nclosed. This lets you skip expensive work when the popover is\nclosed.
  • \n
  • A callable: The popover tracks state. Streamlit executes the\ncallable as a callback function and reruns the app when the user\nopens or closes the popover. The .open attribute of the\npopover container returns its state like when\non_change="rerun". If you need to access the current state\ninside your callback, fetch it through Session State.
  • \n
\n

When the popover tracks state, it can't be used inside Streamlit\ncache-decorated functions.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the on_change\ncallback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the on_change callback.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "PopoverContainer", + "is_generator": false, + "description": "

A PopoverContainer object with an .open property to return\nthe current state of the popover if the popover tracks state.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/layouts.py#L1431" + }, + "streamlit.progress": { + "name": "progress", + "signature": "st.progress(value, text=None, width=\"stretch\")", + "examples": "

Here is an example of a progress bar increasing over time and disappearing when it reaches completion:

\n
\nimport streamlit as st\nimport time\n\nprogress_text = "Operation in progress. Please wait."\nmy_bar = st.progress(0, text=progress_text)\n\nfor percent_complete in range(100):\n    time.sleep(0.01)\n    my_bar.progress(percent_complete + 1, text=progress_text)\ntime.sleep(1)\nmy_bar.empty()\n\nst.button("Rerun")\n
\n", + "description": "

Display a progress bar.

\n", + "args": [ + { + "name": "value", + "type_name": "int or float", + "is_optional": false, + "is_kwarg_only": false, + "description": "

0 <= value <= 100 for int

\n

0.0 <= value <= 1.0 for float

\n", + "default": null + }, + { + "name": "text", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A message to display above the progress bar. The text can optionally\ncontain GitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The width of the progress element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/progress.py#L92" + }, + "streamlit.pydeck_chart": { + "name": "pydeck_chart", + "signature": "st.pydeck_chart(pydeck_obj=None, *, width=\"stretch\", use_container_width=None, height=500, selection_mode=\"single-object\", on_select=\"ignore\", key=None)", + "examples": "

Here's a chart using a HexagonLayer and a ScatterplotLayer. It uses either the\nlight or dark map style, based on which Streamlit theme is currently active:

\n
\nimport pandas as pd\nimport pydeck as pdk\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    rng(0).standard_normal((1000, 2)) / [50, 50] + [37.76, -122.4],\n    columns=["lat", "lon"],\n)\n\nst.pydeck_chart(\n    pdk.Deck(\n        map_style=None,  # Use Streamlit theme to pick map style\n        initial_view_state=pdk.ViewState(\n            latitude=37.76,\n            longitude=-122.4,\n            zoom=11,\n            pitch=50,\n        ),\n        layers=[\n            pdk.Layer(\n                "HexagonLayer",\n                data=df,\n                get_position="[lon, lat]",\n                radius=200,\n                elevation_scale=4,\n                elevation_range=[0, 1000],\n                pickable=True,\n                extruded=True,\n            ),\n            pdk.Layer(\n                "ScatterplotLayer",\n                data=df,\n                get_position="[lon, lat]",\n                get_color="[200, 30, 0, 160]",\n                get_radius=200,\n            ),\n        ],\n    )\n)\n
\n
\n

Note

\n

To make the PyDeck chart's style consistent with Streamlit's theme,\nyou can set map_style=None in the pydeck.Deck object.

\n
\n", + "description": "

Draw a chart using the PyDeck library.

\n

This supports 3D maps, point clouds, and more! More info about PyDeck\nat https://deckgl.readthedocs.io/en/latest/.

\n

These docs are also quite useful:

\n\n

When using this command, a service called Carto provides the map tiles to render\nmap content. If you're using advanced PyDeck features you may need to obtain\nan API key from Carto first. You can do that as\npydeck.Deck(api_keys={"carto": YOUR_KEY}) or by setting the CARTO_API_KEY\nenvironment variable. See PyDeck's documentation for more information.

\n

Another common provider for map tiles is Mapbox. If you prefer to use that,\nyou'll need to create an account at https://mapbox.com and specify your Mapbox\nkey when creating the pydeck.Deck object. You can do that as\npydeck.Deck(api_keys={"mapbox": YOUR_KEY}) or by setting the MAPBOX_API_KEY\nenvironment variable.

\n

Carto and Mapbox are third-party products and Streamlit accepts no responsibility\nor liability of any kind for Carto or Mapbox, or for any content or information\nmade available by Carto or Mapbox. The use of Carto or Mapbox is governed by\ntheir respective Terms of Use.

\n
\n

Note

\n

Pydeck uses two WebGL contexts per chart, and different browsers\nhave different limits on the number of WebGL contexts per page.\nIf you exceed this limit, the oldest contexts will be dropped to\nmake room for the new ones. To avoid this limitation in most\nbrowsers, don't display more than eight Pydeck charts on a single\npage.

\n
\n", + "args": [ + { + "name": "pydeck_obj", + "type_name": "pydeck.Deck or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Object specifying the PyDeck chart to draw.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override the chart's native width with the width of\nthe parent container. This can be one of the following:

\n
    \n
  • None (default): Streamlit will use the chart's default behavior.
  • \n
  • True: Streamlit sets the width of the chart to match the\nwidth of the parent container.
  • \n
  • False: Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of\nthe parent container.
  • \n
\n", + "default": "behavior" + }, + { + "name": "height", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled. This is 500 by default.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\" or \"rerun\" or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the figure should respond to user selection events. This controls\nwhether or not the chart behaves like an input widget.\non_select can be one of the following:

\n
    \n
  • "ignore" (default): Streamlit will not react to any selection\nevents in the chart. The figure will not behave like an\ninput widget.
  • \n
  • "rerun": Streamlit will rerun the app when the user selects\ndata in the chart. In this case, st.pydeck_chart will return\nthe selection data as a dictionary.
  • \n
  • A callable: Streamlit will rerun the app and execute the callable\nas a callback function before the rest of the app. In this case,\nst.pydeck_chart will return the selection data as a\ndictionary.
  • \n
\n

If on_select is not "ignore", all layers must have a\ndeclared id to keep the chart stateful across reruns.

\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "\"single-object\" or \"multi-object\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The selection mode of the chart. This can be one of the following:

\n
    \n
  • "single-object" (default): Only one object can be selected at\na time.
  • \n
  • "multi-object": Multiple objects can be selected at a time.
  • \n
\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string to use for giving this element a stable\nidentity. If this is None (default), the element's identity\nwill be determined based on the values of the other parameters.

\n

If selections are activated and key is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only. For more\ndetails, see Widget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or PydeckState", + "is_generator": false, + "description": "

If on_select is "ignore" (default), this command returns an\ninternal placeholder for the chart element. Otherwise, this method\nreturns a PydeckState object. This object is dictionary-like\nand supports both key and attribute notation. To use this type in\nan annotation, import it from streamlit.typing.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/deck_gl_json_chart.py#L346" + }, + "streamlit.pyplot": { + "name": "pyplot", + "signature": "st.pyplot(fig, clear_figure=False, *, width=\"stretch\", use_container_width=None, **kwargs)", + "examples": "
\nimport matplotlib.pyplot as plt\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\narr = rng(0).normal(1, 1, size=100)\nfig, ax = plt.subplots()\nax.hist(arr, bins=20)\n\nst.pyplot(fig)\n
\n

Matplotlib supports several types of "backends". If you're getting an\nerror using Matplotlib with Streamlit, try setting your backend to "TkAgg":

\n
\necho "backend: TkAgg" >> ~/.matplotlib/matplotlibrc\n
\n

For more information, see https://matplotlib.org/faq/usage_faq.html.

\n", + "description": "

Display a matplotlib.pyplot figure.

\n

Streamlit renders the figure by calling Matplotlib's savefig with\nbbox_inches="tight" and dpi=200 so charts look sharp and cropped\nby default.

\n
\n

Important

\n

You must install matplotlib>=3.0.0 to use this command. You can\ninstall all charting dependencies as an extra with\nStreamlit:

\n
\npip install streamlit[charts]\n
\n
\n", + "args": [ + { + "name": "fig", + "type_name": "Matplotlib Figure", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The Matplotlib Figure object to render. See\nhttps://matplotlib.org/stable/gallery/index.html for examples.

\n", + "default": null + }, + { + "name": "clear_figure", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Whether to clear the figure after rendering it. If this is\nFalse (default), the figure is left as-is. If True,\nStreamlit calls fig.clf() after the figure is displayed.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch". For use_container_width=False, use\nwidth="content".

\n" + }, + "description": "

Whether to override the figure's native width with the width of\nthe parent container. If use_container_width is True\n(default), Streamlit sets the width of the figure to match the\nwidth of the parent container. If use_container_width is\nFalse, Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of the\nparent container.

\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

Passing savefig keyword arguments to st.pyplot is\ndeprecated and will be removed in a future version.\nst.pyplot already uses bbox_inches="tight" and\ndpi=200 by default. For other savefig options, save the\nfigure yourself and display it with st.image.

\n" + }, + "description": "

Arguments to pass to Matplotlib's savefig function.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/pyplot.py#L82" + }, + "streamlit.radio": { + "name": "radio", + "signature": "st.radio(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, horizontal=False, captions=None, label_visibility=\"visible\", width=\"content\", bind=None, persist_state=None)", + "examples": "
\nimport streamlit as st\n\ngenre = st.radio(\n    "What's your favorite movie genre",\n    [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],\n    captions=[\n        "Laugh out loud.",\n        "Get the popcorn.",\n        "Never stop learning.",\n    ],\n)\n\nif genre == ":rainbow[Comedy]":\n    st.write("You selected comedy.")\nelse:\n    st.write("You didn't select comedy.")\n
\n

To initialize an empty radio widget, use None as the index value:

\n
\nimport streamlit as st\n\ngenre = st.radio(\n    "What's your favorite movie genre",\n    [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],\n    index=None,\n)\n\nst.write("You selected:", genre)\n
\n", + "description": "

Display a radio button widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this radio group is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default.

\n

Labels can include markdown as described in the label parameter.

\n", + "default": null + }, + { + "name": "index", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The index of the preselected option on first render. If None,\nwill initialize empty and return None until the user selects an option.\nDefaults to 0 (the first option).

\n", + "default": "0" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Function to modify the display of radio options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe radio.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this radio's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the radio button if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "horizontal", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean, which orients the radio group horizontally.\nThe default is false (vertical buttons).

\n", + "default": "false" + }, + { + "name": "captions", + "type_name": "iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A list of captions to show below each radio button. If None (default),\nno captions are shown.

\n", + "default": null + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the radio button widget. This can be one of the\nfollowing:

\n
    \n
  • "content" (default): The width of the widget matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the widget matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

Invalid query parameter values are ignored and removed\nfrom the URL. If index is None, an empty query\nparameter (e.g., ?my_key=) clears the widget.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "any", + "is_generator": false, + "description": "

The selected option or None if no option is selected.

\n

This is a copy of the selected option, not the original.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/radio.py#L207" + }, + "streamlit.rerun": { + "name": "rerun", + "signature": "st.rerun(*, scope=\"app\")", + "description": "

Rerun the script immediately.

\n

When st.rerun() is called, Streamlit halts the current script run and\nexecutes no further statements. Streamlit immediately queues the script to\nrerun.

\n

When using st.rerun in a fragment, you can scope the rerun to the\nfragment. However, if a fragment is running as part of a full-app rerun,\na fragment-scoped rerun is not allowed.

\n", + "args": [ + { + "name": "scope", + "type_name": "\"app\" or \"fragment\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies what part of the app should rerun. If scope is "app"\n(default), the full app reruns. If scope is "fragment",\nStreamlit only reruns the fragment from which this command is called.

\n

Setting scope="fragment" is only valid inside a fragment during a\nfragment rerun. If st.rerun(scope="fragment") is called during a\nfull-app rerun or outside of a fragment, Streamlit will raise a\nStreamlitAPIException.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/commands/execution_control.py#L143" + }, + "streamlit.scatter_chart": { + "name": "scatter_chart", + "signature": "st.scatter_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, size=None, width=\"stretch\", height=\"content\", use_container_width=None)", + "examples": "

Example 1: Basic scatter chart from a dataframe

\n

If you don't use any of the optional parameters, Streamlit plots each\ncolumn as a color-coded group of points, uses the index as the x\nvalues, and labels each group with the column name:

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((20, 3)), columns=["a", "b", "c"])\n\nst.scatter_chart(df)\n
\n

Example 2: Scatter chart from specific dataframe columns

\n

You can choose different columns to use for the x and y values. If your\ndataframe is in long format (all y-values in one column), you can set\nthe scatter point colors from another column.

\n

If the column contains color strings, the colors will be applied\ndirectly and each color group will be unlabeled. If the column contains\nother values, those values will label each group, and the scatter point\ncolors will be selected from the default color palette. You can\nconfigure this color palette in the theme.chartCategoryColors\nconfiguration option.

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    rng(0).standard_normal((20, 3)), columns=["col1", "col2", "col3"]\n)\ndf["col4"] = rng(0).choice(["a", "b", "c"], 20)\n\nst.scatter_chart(\n    df,\n    x="col1",\n    y="col2",\n    color="col4",\n    size="col3",\n)\n
\n

Example 3: Scatter chart from wide-format dataframe

\n

If your dataframe is in wide format (y-values are in multiple columns),\nyou can pass a list of columns to the y parameter. Each column\nname becomes a group label. To override the default colors, pass a\nlist of colors to the color parameter, one for each group:

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    rng(0).standard_normal((20, 4)),\n    columns=["col1", "col2", "col3", "col4"],\n)\n\nst.scatter_chart(\n    df,\n    x="col1",\n    y=["col2", "col3"],\n    size="col4",\n    color=["#FF0000", "#0000FF"],\n)\n
\n", + "description": "

Display a scatterplot chart.

\n

This is syntax-sugar around st.altair_chart. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.

\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Data to be plotted.

\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column name or key associated to the x-axis data. If x is\nNone (default), Streamlit uses the data index for the x-axis\nvalues.

\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column name(s) or key(s) associated to the y-axis data. If this is\nNone (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a Sequence of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.

\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The label for the x-axis. If this is None (default), Streamlit\nwill use the column name specified in x if available, or else\nno label will be displayed.

\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The label for the y-axis. If this is None (default), Streamlit\nwill use the column name(s) specified in y if available, or\nelse no label will be displayed.

\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color of the circles representing each datapoint.

\n

This can be:

\n
    \n
  • None, to use the default color.

    \n
  • \n
  • A hex string like "#ffaa00" or "#ffaa0088".

    \n
  • \n
  • An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.

    \n
  • \n
  • A built-in color name: "red", "orange", "yellow", "green",\n"blue", "violet", "gray"/"grey", or "primary". These map to\ntheme colors that you can customize using theme.<color>Color\nconfiguration options.

    \n
  • \n
  • The name of a column in the dataset where the color of that\ndatapoint will come from.

    \n

    If the values in this column are in one of the color formats\nabove (hex string or color tuple), then that color will be used.

    \n

    Otherwise, the color will be automatically picked from the\ndefault palette.

    \n

    For example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints be shown using three colors from the default palette.

    \n

    But if this column only contains floats or ints, then those\n1000 datapoints will be shown using a colors from a continuous\ncolor gradient.

    \n

    Finally, if this column only contains the values "#ffaa00",\n"#f0f", "#0000ff", then then each of those 1000 datapoints will\nbe assigned "#ffaa00", "#f0f", or "#0000ff" as appropriate.

    \n
  • \n
\n

If the dataframe is in wide format (that is, y is a Sequence of\ncolumns), this can also be:

\n
    \n
  • A list of string colors or color tuples to be used for each of\nthe series in the chart. This list should have the same length\nas the number of y values (e.g. color=["#fd0", "#f0f", "#04f"]\nfor three series). You can also use built-in color names in the\nlist (e.g. color=["red", "blue", "green"]).
  • \n
\n", + "default": "color" + }, + { + "name": "size", + "type_name": "str, float, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The size of the circles representing each point.

\n

This can be:

\n
    \n
  • A number like 100, to specify a single size to use for all\ndatapoints.
  • \n
  • The name of the column to use for the size. This allows each\ndatapoint to be represented by a circle of a different size.
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override the chart's native width with the width of\nthe parent container. This can be one of the following:

\n
    \n
  • None (default): Streamlit will use the chart's default behavior.
  • \n
  • True: Streamlit sets the width of the chart to match the\nwidth of the parent container.
  • \n
  • False: Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of\nthe parent container.
  • \n
\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/vega_charts.py#L1521" + }, + "streamlit.segmented_control": { + "name": "segmented_control", + "signature": "st.segmented_control(label, options, *, selection_mode=\"single\", default=None, required=False, format_func=None, key=None, help=None, on_change=None, args=None, kwargs=None, disabled=False, label_visibility=\"visible\", width=\"content\", bind=None, persist_state=None)", + "examples": "

Example 1: Multi-select segmented control

\n

Display a multi-select segmented control widget, and show the\nselection:

\n
\nimport streamlit as st\n\noptions = ["North", "East", "South", "West"]\nselection = st.segmented_control(\n    "Directions", options, selection_mode="multi"\n)\nst.markdown(f"Your selected options: {selection}.")\n
\n

Example 2: Single-select segmented control with icons

\n

Display a single-select segmented control widget with icons:

\n
\nimport streamlit as st\n\noption_map = {\n    0: ":material/add:",\n    1: ":material/zoom_in:",\n    2: ":material/zoom_out:",\n    3: ":material/zoom_out_map:",\n}\nselection = st.segmented_control(\n    "Tool",\n    options=option_map.keys(),\n    format_func=lambda option: option_map[option],\n    selection_mode="single",\n)\nst.write(\n    "Your selected option: "\n    f"{None if selection is None else option_map[selection]}"\n)\n
\n", + "description": "

Display a segmented control widget.

\n

A segmented control widget is a linear set of segments where each of\nthe passed options functions like a toggle button.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this widget is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable of V", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default and can\noptionally contain GitHub-flavored Markdown, including the Markdown\ndirectives described in the body parameter of st.markdown.

\n", + "default": "and" + }, + { + "name": "selection_mode", + "type_name": "\"single\" or \"multi\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The selection mode for the widget. If this is "single"\n(default), only one option can be selected. If this is "multi",\nmultiple options can be selected.

\n", + "default": null + }, + { + "name": "default", + "type_name": "Iterable of V, V, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The value of the widget when it first renders. If the\nselection_mode is multi, this can be a list of values, a\nsingle value, or None. If the selection_mode is\n"single", this can be a single value or None.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether a selection is required. If this is True and\nselection_mode="single", users cannot deselect an option once\none is selected. Clicking an already-selected option does nothing.\nThe default is False.

\n

If required=True is used with selection_mode="multi", an\nexception is raised.

\n", + "default": "is" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Function to modify the display of the options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe command. The output can optionally contain GitHub-flavored\nMarkdown, including the Markdown directives described in the\nbody parameter of st.markdown.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing selection_mode resets the widget even when a\nkey is provided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when this widget's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the widget if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the segmented control widget. This can be one of the\nfollowing:

\n
    \n
  • "content" (default): The width of the widget matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the widget matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

An empty query parameter (e.g., ?tags=) clears the\nwidget. Invalid query parameter values are ignored and removed from\nthe URL. For selection_mode="multi", multiple selections use\nrepeated parameters (e.g., ?tags=Red&tags=Blue) and duplicates\nare deduplicated.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "list of V, V, or None", + "is_generator": false, + "description": "

If the selection_mode is multi, this is a list of selected\noptions or an empty list. If the selection_mode is\n"single", this is a selected option or None.

\n

This contains copies of the selected options, not the originals.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/button_group.py#L755" + }, + "streamlit.select_slider": { + "name": "select_slider", + "signature": "st.select_slider(label, options=(), value=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", width=\"stretch\", bind=None, persist_state=None)", + "examples": "
\nimport streamlit as st\n\ncolor = st.select_slider(\n    "Select a color of the rainbow",\n    options=[\n        "red",\n        "orange",\n        "yellow",\n        "green",\n        "blue",\n        "indigo",\n        "violet",\n    ],\n)\nst.write("My favorite color is", color)\n
\n

And here's an example of a range select slider:

\n
\nimport streamlit as st\n\nstart_color, end_color = st.select_slider(\n    "Select a range of color wavelength",\n    options=[\n        "red",\n        "orange",\n        "yellow",\n        "green",\n        "blue",\n        "indigo",\n        "violet",\n    ],\n    value=("red", "blue"),\n)\nst.write("You selected wavelengths between", start_color, "and", end_color)\n
\n", + "description": "

Display a slider widget to select items from a list.

\n

This also allows you to render a range slider by passing a two-element\ntuple or list as the value.

\n

The difference between st.select_slider and st.slider is that\nselect_slider accepts any datatype and takes an iterable set of\noptions, while st.slider only accepts numerical or date/time data and\ntakes a range as input.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this slider is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default.

\n

Each item in the iterable can optionally contain GitHub-flavored\nMarkdown, subject to the same limitations described in the\nlabel parameter.

\n", + "default": null + }, + { + "name": "value", + "type_name": "a supported type or a tuple/list of supported types or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to (1, 10) the\nslider will have a selectable range between 1 and 10.\nDefaults to first option.

\n", + "default": "first" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Function to modify the display of the labels from the options.\nargument. It receives the option as an argument and its output\nwill be cast to str.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this select_slider's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the select slider if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the slider widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

Invalid query parameter values are ignored and removed\nfrom the URL. Range select sliders use repeated parameters\n(e.g., ?color=red&color=blue).

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "any value or tuple of any value", + "is_generator": false, + "description": "

The current value of the slider widget. The return type will match\nthe data type of the value parameter.

\n

This contains copies of the selected options, not the originals.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/select_slider.py#L201" + }, + "streamlit.selectbox": { + "name": "selectbox", + "signature": "st.selectbox(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\", accept_new_options=False, filter_mode=\"fuzzy\", width=\"stretch\", bind=None, persist_state=None)", + "examples": "

Example 1: Use a basic selectbox widget

\n

If no index is provided, the first option is selected by default.

\n
\nimport streamlit as st\n\noption = st.selectbox(\n    "How would you like to be contacted?",\n    ("Email", "Home phone", "Mobile phone"),\n)\n\nst.write("You selected:", option)\n
\n

Example 2: Use a selectbox widget with no initial selection

\n

To initialize an empty selectbox, use None as the index value.

\n
\nimport streamlit as st\n\noption = st.selectbox(\n    "How would you like to be contacted?",\n    ("Email", "Home phone", "Mobile phone"),\n    index=None,\n    placeholder="Select contact method...",\n)\n\nst.write("You selected:", option)\n
\n

Example 3: Let users add a new option

\n

To allow users to add a new option that isn't included in the\noptions list, use the accept_new_options=True parameter. You\ncan also customize the placeholder text.

\n
\nimport streamlit as st\n\noption = st.selectbox(\n    "Default email",\n    ["foo@example.com", "bar@example.com", "baz@example.com"],\n    index=None,\n    placeholder="Select a saved email or enter a new one",\n    accept_new_options=True,\n)\n\nst.write("You selected:", option)\n
\n", + "description": "

Display a select widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this select widget is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Labels for the select options in an Iterable. This can be a\nlist, set, or anything supported by st.dataframe. If\noptions is dataframe-like, the first column will be used. Each\nlabel will be cast to str internally by default.

\n", + "default": null + }, + { + "name": "index", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The index of the preselected option on first render. If None,\nwill initialize empty and return None until the user selects an option.\nDefaults to 0 (the first option).

\n", + "default": "0" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Function to modify the display of the options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe command.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing accept_new_options resets the widget even when\na key is provided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this selectbox's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A string to display when no options are selected.\nIf this is None (default), the widget displays placeholder text\nbased on the widget's configuration:

\n
    \n
  • "Choose an option" is displayed when options are available and\naccept_new_options=False.
  • \n
  • "Choose or add an option" is displayed when options are available\nand accept_new_options=True.
  • \n
  • "Add an option" is displayed when no options are available and\naccept_new_options=True.
  • \n
  • "No options to select" is displayed when no options are available\nand accept_new_options=False. The widget is also disabled in\nthis case.
  • \n
\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the selectbox if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "accept_new_options", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the user can add a selection that isn't included in options.\nIf this is False (default), the user can only select from the\nitems in options. If this is True, the user can enter a new\nitem that doesn't exist in options.

\n

When a user enters a new item, it is returned by the widget as a\nstring. The new item is not added to the widget's drop-down menu.\nStreamlit will use a case-insensitive match from options before\nadding a new item.

\n", + "default": null + }, + { + "name": "filter_mode", + "type_name": "\"fuzzy\", \"contains\", \"prefix\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The matching mode used to filter options while the user types.\nIf this is "fuzzy" (default), options are matched by in-order\nsubsequence and sorted by match score. If this is "contains",\noptions are matched by case-insensitive substring. If this is\n"prefix", options are matched by case-insensitive prefix. If\nthis is None, typing is disabled and the options are not\nfiltered.

\n

filter_mode=None is incompatible with\naccept_new_options=True.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the selectbox widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

Invalid query parameter values are ignored and removed\nfrom the URL. If index is None, an empty query\nparameter (e.g., ?my_key=) clears the widget.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "any", + "is_generator": false, + "description": "

The selected option or None if no option is selected.

\n

This is a copy of the selected option, not the original.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/selectbox.py#L312" + }, + "streamlit.set_option": { + "name": "set_option", + "signature": "st.set_option(key, value)", + "examples": "
\nimport streamlit as st\n\nst.set_option("client.showErrorDetails", True)\n
\n", + "description": "

Set a configuration option.

\n

Currently, only client configuration options can be set within the\nscript itself:

\n
\n
    \n
  • client.showErrorDetails
  • \n
  • client.disableDataExport
  • \n
  • client.showSidebarNavigation
  • \n
  • client.toolbarMode
  • \n
\n
\n

Calling st.set_option with any other option will raise a\nStreamlitAPIException. When changing a configuration option in a\nrunning app, you may need to trigger a rerun after changing the option to\nsee the effects.

\n

Run streamlit config show in a terminal to see all available options.

\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The config option key of the form "section.optionName". To see all\navailable options, run streamlit config show in a terminal.

\n", + "default": null + }, + { + "name": "value", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

The new value to assign to this config option.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/config.py#L155" + }, + "streamlit.set_page_config": { + "name": "set_page_config", + "signature": "st.set_page_config(page_title=None, page_icon=None, layout=None, initial_sidebar_state=None, menu_items=None)", + "examples": "
\nimport streamlit as st\n\nst.set_page_config(\n    page_title="Ex-stream-ly Cool App",\n    page_icon="\ud83e\uddca",\n    layout="wide",\n    initial_sidebar_state="expanded",\n    menu_items={\n        'Get Help': 'https://www.extremelycoolapp.com/help',\n        'Report a bug': "https://www.extremelycoolapp.com/bug",\n        'About': "# This is a header. This is an *extremely* cool app!"\n    }\n)\n
\n", + "description": "

Configure the default settings of the page.

\n

This command can be called multiple times in a script run to dynamically\nchange the page configuration. The calls are additive, with each successive\ncall overriding only the parameters that are specified.

\n", + "args": [ + { + "name": "page_title", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The page title, shown in the browser tab. If this is None\n(default), the page title is inherited from the previous call of\nst.set_page_config. If this is None and no previous call\nexists, the page title is inferred from the page source.

\n

If a page source is a Python file, its inferred title is derived from\nthe filename. If a page source is a callable object, its inferred title\nis derived from the callable's name.

\n", + "default": null + }, + { + "name": "page_icon", + "type_name": "Anything supported by st.image (except list), str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The page favicon. If page_icon is None (default), the page icon\nis inherited from the previous call of st.set_page_config. If this\nis None and no previous call exists, the favicon is a monochrome\nStreamlit logo.

\n

In addition to the types supported by st.image (except list), the\nfollowing strings are valid:

\n
    \n
  • A single-character emoji. For example, you can set page_icon="\ud83e\udd88".

    \n
  • \n
  • An emoji short code. For example, you can set page_icon=":shark:".\nFor a list of all supported codes, see\nhttps://share.streamlit.io/streamlit/emoji-shortcodes.

    \n
  • \n
  • The string literal, "random". You can set page_icon="random"\nto set a random emoji from the supported list above.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, page_icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
  • \n
\n
\n

Note

\n

Colors are not supported for Material icons. When you use a\nMaterial icon for favicon, it will be black, regardless of browser\ntheme.

\n
\n", + "default": null + }, + { + "name": "layout", + "type_name": "\"centered\", \"wide\", or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Layout of the page content. The following layouts are supported:

\n
    \n
  • None (default): The page layout is inherited from the previous\ncall of st.set_page_config. If no previous call exists, the page\nlayout is "centered".
  • \n
  • "centered": Page elements are constrained to a centered column of\nfixed width.
  • \n
  • "wide": Page elements use the entire screen width.
  • \n
\n", + "default": null + }, + { + "name": "initial_sidebar_state", + "type_name": "\"auto\", \"expanded\", \"collapsed\", \"locked\", int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Initial state of the sidebar. The following states are supported:

\n
    \n
  • None (default): The sidebar state is inherited from the previous\ncall of st.set_page_config. If no previous call exists, the\nsidebar state is "auto".
  • \n
  • "auto": The sidebar is hidden on small devices and shown\notherwise.
  • \n
  • "expanded": The sidebar is shown initially.
  • \n
  • "collapsed": The sidebar is hidden initially.
  • \n
  • "locked": On desktop, the sidebar is expanded with all collapse\ncontrols hidden so users cannot close it. On narrow/mobile\nviewports the lock degrades gracefully: the sidebar starts\ncollapsed and can be toggled to avoid covering the main content.
  • \n
  • int: The sidebar will use "auto" behavior but start with the\nspecified width in pixels. The width must be between 200 and 600\npixels, inclusive.
  • \n
\n

In most cases, "auto" provides the best user experience across\ndevices of different sizes.

\n", + "default": null + }, + { + "name": "menu_items", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Configure the menu that appears on the top-right side of this app.\nThe keys in this dict denote the menu item to configure. The following\nkeys can have string or None values:

\n
    \n
  • "Get help": The URL this menu item should point to.
  • \n
  • "Report a Bug": The URL this menu item should point to.
  • \n
  • "About": A markdown string to show in the About dialog.
  • \n
\n

A URL may also refer to an email address e.g. mailto:john@example.com.

\n

If you do not include a key, its menu item will be hidden (unless it\nwas set by a previous call to st.set_page_config). To remove an\nitem that was specified in a previous call to st.set_page_config,\nset its value to None in the dictionary.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/commands/page_config.py#L112" + }, + "streamlit.skeleton": { + "name": "skeleton", + "signature": "st.skeleton(height=None, *, width=\"stretch\")", + "examples": "

Standalone mode - replace skeleton with content:

\n
\nimport streamlit as st\nimport time\n\nplaceholder = st.skeleton(height=200)\ntime.sleep(2)\nplaceholder.dataframe({"col1": [1, 2, 3], "col2": [4, 5, 6]})\n
\n

Context manager mode - skeleton auto-clears when block exits:

\n
\nimport streamlit as st\nimport time\n\nwith st.skeleton(height=100):\n    # Expensive computation runs here\n    time.sleep(2)\n\n# Skeleton clears, show results below\nst.success("Data loaded!")\n
\n", + "description": "

Display a skeleton loading placeholder.

\n

A skeleton is an animated placeholder that indicates content is\nloading. Use it to reserve layout space and provide visual feedback\nwhile content loads. It can be used in two ways:

\n

Standalone mode (like st.empty()): Returns a placeholder that\nis shown immediately and can be replaced with content later by calling\nan st.* method on it (for example, placeholder.dataframe(...)).

\n

Context manager mode (like st.spinner(), recommended): The\nskeleton is shown while the with block runs (after a short delay)\nand automatically clears when the block exits, whether normally or due\nto an exception. Like st.spinner, any st.* calls made inside the\nwith block are written to the parent container and remain visible\nafter the skeleton clears.

\n
\n

Note

\n

Context manager mode is recommended. Use standalone mode only when\nyou need to reserve a slot and fill it later (like st.empty()).

\n
\n", + "args": [ + { + "name": "height", + "type_name": "int, \"stretch\", or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The height of the skeleton. This can be one of the following:

\n
    \n
  • None (default): The skeleton uses the standard element\nheight (the same height as most input widgets).
  • \n
  • An integer specifying the height in pixels.
  • \n
  • "stretch": The height of the skeleton matches the height of\nthe parent container. This requires a parent container with a\nbounded height.
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "int or \"stretch\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the skeleton. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the skeleton matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels.
  • \n
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "SkeletonPlaceholder", + "is_generator": false, + "description": "

A placeholder object that can be used to replace the skeleton with\nother content, or as a context manager.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/skeleton.py#L64" + }, + "streamlit.slider": { + "name": "slider", + "signature": "st.slider(label, min_value=None, max_value=None, value=None, step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", width=\"stretch\", bind=None, persist_state=None)", + "examples": "
\nimport streamlit as st\n\nage = st.slider("How old are you?", 0, 130, 25)\nst.write("I'm ", age, "years old")\n
\n

And here's an example of a range slider:

\n
\nimport streamlit as st\n\nvalues = st.slider("Select a range of values", 0.0, 100.0, (25.0, 75.0))\nst.write("Values:", values)\n
\n

This is a range time slider:

\n
\nimport streamlit as st\nfrom datetime import time\n\nappointment = st.slider(\n    "Schedule your appointment:", value=(time(11, 30), time(12, 45))\n)\nst.write("You're scheduled for:", appointment)\n
\n

Finally, a datetime slider:

\n
\nimport streamlit as st\nfrom datetime import datetime\n\nstart_time = st.slider(\n    "When do you start?",\n    value=datetime(2020, 1, 1, 9, 30),\n    format="MM/DD/YY - hh:mm",\n)\nst.write("Start time:", start_time)\n
\n", + "description": "

Display a slider widget.

\n

This supports int, float, date, time, and datetime types.

\n

This also allows you to render a range slider by passing a two-element\ntuple or list as the value.

\n

The difference between st.slider and st.select_slider is that\nslider only accepts numerical or date/time data and takes a range as\ninput, while select_slider accepts any datatype and takes an iterable\nset of options.

\n
\n

Note

\n

Integer values exceeding +/- (1<<53) - 1 cannot be accurately\nstored or returned by the widget due to serialization constraints\nbetween the Python server and JavaScript client. You must handle\nsuch numbers as floats, leading to a loss in precision.

\n

The same constraint bounds date and datetime values, which\nare serialized as microseconds since the epoch: only values from\n1684-07-29 to 2255-06-04 can be represented exactly. Streamlit\nraises an error for a bound outside that range rather than\nsilently shifting it.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this slider is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "min_value", + "type_name": "a supported type or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The minimum permitted value.\nIf this is None (default), the minimum value depends on the\ntype as follows:

\n
    \n
  • integer: 0
  • \n
  • float: 0.0
  • \n
  • date or datetime: value - timedelta(days=14)
  • \n
  • time: time.min
  • \n
\n", + "default": null + }, + { + "name": "max_value", + "type_name": "a supported type or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The maximum permitted value.\nIf this is None (default), the maximum value depends on the\ntype as follows:

\n
    \n
  • integer: 100
  • \n
  • float: 1.0
  • \n
  • date or datetime: value + timedelta(days=14)
  • \n
  • time: time.max
  • \n
\n", + "default": null + }, + { + "name": "value", + "type_name": "a supported type or a tuple/list of supported types or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to (1, 10) the\nslider will have a selectable range between 1 and 10.\nThis defaults to min_value. If the type is not otherwise\nspecified in any of the numeric parameters, the widget will have an\ninteger value.

\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, timedelta, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The stepping interval.\nDefaults to 1 if the value is an int, 0.01 if a float,\ntimedelta(days=1) if a date/datetime, timedelta(minutes=15) if a time\n(or if max_value - min_value < 1 day)

\n", + "default": "1" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A printf-style format string or a predefined format name controlling\nhow the interface should display values. This does not impact the\nreturn value.

\n

For integers and floats, you can use a printf-style format string\nor one of the following predefined formats:

\n
    \n
  • "plain": Show the full number without formatting (e.g. 1234.567).
  • \n
  • "localized": Show the number in the user's locale format (e.g. 1,234.567).
  • \n
  • "percent": Show as a percentage (e.g. 50% from 0.5).
  • \n
  • "dollar": Show as US dollars (e.g. $1,234.57).
  • \n
  • "euro": Show as euros (e.g. \u20ac1,234.57).
  • \n
  • "yen": Show as Japanese yen (e.g. \u00a51,235).
  • \n
  • "compact": Show in compact notation (e.g. 1.2K).
  • \n
  • "scientific": Show in scientific notation (e.g. 1.235E3).
  • \n
  • "engineering": Show in engineering notation (e.g. 1.235E3).
  • \n
  • "accounting": Show in accounting format with parentheses for negatives.
  • \n
  • "bytes": Show in byte units (e.g. 1.2KB).
  • \n
\n

For information about printf-style format strings, see\nsprintf.js.\nFor example, format="%0.1f" adjusts the displayed decimal\nprecision to only show one digit after the decimal. Use , for\nthousand separators (e.g. "%,d" yields "1,234").

\n

For datetimes, dates, and times, you can use a momentJS format string\nor one of the following predefined formats:

\n
    \n
  • "localized": Show in the user's locale format.
  • \n
  • "distance": Show as relative time (e.g. "2 hours ago").
  • \n
  • "calendar": Show as calendar time (e.g. "Tomorrow 12:00").\nWorks best with datetime values. For date-only values, displays\nrelative day names (e.g. "Yesterday"). For time-only values,\nthis format may produce unexpected results.
  • \n
  • "iso8601": Show in ISO 8601 format.
  • \n
\n

For information about momentJS format strings, see\nmomentJS.\nFor example, format="ddd ha" adjusts the displayed datetime to\nshow the day of the week and the hour ("Tue 8pm").

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing min_value, max_value, or step resets\nthe widget even when a key is provided, because those\nparameters constrain valid values.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this slider's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the slider if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the slider widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

Invalid query parameter values are ignored and removed\nfrom the URL. Range sliders use repeated parameters (e.g.,\n?price=10&price=90).

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "int/float/date/time/datetime or tuple of int/float/date/time/datetime", + "is_generator": false, + "description": "

The current value of the slider widget. The return type will match\nthe data type of the value parameter.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/slider.py#L522" + }, + "streamlit.snow": { + "name": "snow", + "signature": "st.snow()", + "examples": "
\nimport streamlit as st\n\nst.snow()\n
\n

...then watch your app and get ready for a cool celebration!

\n", + "description": "

Draw celebratory snowfall.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/snow.py#L27" + }, + "streamlit.space": { + "name": "space", + "signature": "st.space(size=\"small\")", + "examples": "

Example 1: Use vertical space to align elements

\n

Use small spaces to replace label heights. Use medium spaces to replace\ntwo label heights or a button.

\n
\nimport streamlit as st\n\nleft, middle, right = st.columns(3)\n\nleft.space("medium")\nleft.button("Left button", width="stretch")\n\nmiddle.space("small")\nmiddle.text_input("Middle input")\n\nright.audio_input("Right uploader")\n
\n

Example 2: Add horizontal space in a container

\n

Use stretch space to float elements left and right.

\n
\nimport streamlit as st\n\nwith st.container(horizontal=True):\n    st.button("Left")\n    st.space("stretch")\n    st.button("Right")\n
\n", + "description": "

Add vertical or horizontal space.

\n

This command adds space in the direction of its parent container. In\na vertical layout, it adds vertical space. In a horizontal layout, it\nadds horizontal space.

\n", + "args": [ + { + "name": "size", + "type_name": "\"xxsmall\", \"xsmall\", \"small\", \"medium\", \"large\", \"xlarge\", \"xxlarge\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The size of the space. This can be one of the following values:

\n
    \n
  • "xxsmall": 0.25rem, matching the "xxsmall" gap in\nst.container and st.columns.
  • \n
  • "xsmall": 0.5rem, matching the "xsmall" gap in\nst.container and st.columns.
  • \n
  • "small" (default): 0.75rem, which is the height of a widget\nlabel. This is useful for aligning buttons with labeled widgets.
  • \n
  • "medium": 2.5rem, which is the height of a button or\n(unlabeled) input field.
  • \n
  • "large": 4.25rem, which is the height of a labeled input\nfield or unlabeled media widget, like st.file_uploader.
  • \n
  • "xlarge": 6rem, matching the "xlarge" gap in\nst.container and st.columns.
  • \n
  • "xxlarge": 8rem, matching the "xxlarge" gap in\nst.container and st.columns.
  • \n
  • "stretch": Expands to fill remaining space in the container.
  • \n
  • An integer: Fixed size in pixels.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/space.py#L32" + }, + "streamlit.spinner": { + "name": "spinner", + "signature": "st.spinner(text=\"In progress...\", *, show_time=False, width=\"content\")", + "examples": "
\nimport streamlit as st\nimport time\n\nwith st.spinner("Wait for it...", show_time=True):\n    time.sleep(5)\nst.success("Done!")\nst.button("Rerun")\n
\n", + "description": "

Display a loading spinner while executing a block of code.

\n", + "args": [ + { + "name": "text", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display next to the spinner. This defaults to\n"In progress...".

\n

The text can optionally contain GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional, supported\nMarkdown directives.

\n", + "default": null + }, + { + "name": "show_time", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show the elapsed time next to the spinner text. If this is\nFalse (default), no time is displayed. If this is True,\nelapsed time is displayed with a precision of 0.1 seconds. The time\nformat is not configurable.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the spinner element. This can be one of the following:

\n
    \n
  • "content" (default): The width of the element matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the element matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/spinner.py#L40" + }, + "streamlit.status": { + "name": "status", + "signature": "st.status(label, *, expanded=False, state=\"running\", type=\"default\", width=\"stretch\")", + "examples": "

You can use the with notation to insert any element into an status container:

\n
\nimport time\nimport streamlit as st\n\nwith st.status("Downloading data..."):\n    st.write("Searching for data...")\n    time.sleep(2)\n    st.write("Found URL.")\n    time.sleep(1)\n    st.write("Downloading data...")\n    time.sleep(1)\n\nst.button("Rerun")\n
\n

You can also use .update() on the container to change the label, state,\nor expanded state:

\n
\nimport time\nimport streamlit as st\n\nwith st.status("Downloading data...", expanded=True) as status:\n    st.write("Searching for data...")\n    time.sleep(2)\n    st.write("Found URL.")\n    time.sleep(1)\n    st.write("Downloading data...")\n    time.sleep(1)\n    status.update(\n        label="Download complete!", state="complete", expanded=False\n    )\n\nst.button("Rerun")\n
\n", + "description": "

Insert a status container to display output from long-running tasks.

\n

Inserts a container into your app that is typically used to show the status and\ndetails of a process or task. The container can hold multiple elements and can\nbe expanded or collapsed by the user similar to st.expander.\nWhen collapsed, all that is visible is the status icon and label.

\n

The label, state, and expanded state can all be updated by calling .update()\non the returned object. To add elements to the returned container, you can\nuse with notation (preferred) or just call methods directly on the returned\nobject.

\n

By default, st.status() initializes in the "running" state. When called using\nwith notation, it automatically updates to the "complete" state at the end\nof the "with" block. See examples below for more details.

\n
\n

Note

\n

All content within the status container is computed and sent to the\nfrontend, even if the status container is closed.

\n

To follow best design practices and maintain a good appearance on\nall screen sizes, don't nest status containers.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The initial label of the status container. The label can optionally\ncontain GitHub-flavored Markdown of the following types: Bold, Italics,\nStrikethroughs, Inline Code, Links, and Images. Images display like\nicons, with a max height equal to the font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

If True, initializes the status container in "expanded" state. Defaults to\nFalse (collapsed).

\n", + "default": null + }, + { + "name": "state", + "type_name": "\"running\", \"complete\", or \"error\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The initial state of the status container which determines which icon is\nshown:

\n
    \n
  • running (default): A spinner icon is shown.
  • \n
  • complete: A checkmark icon is shown.
  • \n
  • error: An error icon is shown.
  • \n
\n", + "default": null + }, + { + "name": "type", + "type_name": "\"default\" or \"compact\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visual style of the status container. If "default" (default),\nthe container is displayed with a border and background. If\n"compact", the container is rendered as a minimal inline\ntoggle, ideal for displaying AI reasoning or task progress without\nvisual clutter.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the status container. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the container matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The container has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the container matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [ + { + "type_name": "StatusContainer", + "is_generator": false, + "description": "

A mutable status container that can hold multiple elements. The label, state,\nand expanded state can be updated after creation via .update().

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/layouts.py#L1830" + }, + "streamlit.stop": { + "name": "stop", + "signature": "st.stop()", + "example": "
\nimport streamlit as st\n\nname = st.text_input("Name")\nif not name:\n  st.warning('Please input a name.')\n  st.stop()\nst.success("Thank you for inputting a name.")\n
\n", + "description": "

Stops execution immediately.

\n

Streamlit will not run any statements after st.stop().\nWe recommend rendering a message to explain why the script has stopped.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/commands/execution_control.py#L48" + }, + "streamlit.subheader": { + "name": "subheader", + "signature": "st.subheader(body, anchor=None, *, help=None, divider=False, width=\"stretch\", text_alignment=\"left\")", + "examples": "
\nimport streamlit as st\n\nst.subheader("_Streamlit_ is :blue[cool] :sunglasses:")\nst.subheader("This is a subheader with a divider", divider="gray")\nst.subheader("These subheaders have rotating dividers", divider=True)\nst.subheader("One", divider=True)\nst.subheader("Two", divider=True)\nst.subheader("Three", divider=True)\nst.subheader("Four", divider=True)\n
\n", + "description": "

Display text in subheader formatting.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the subheader. If this is\nNone (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "divider", + "type_name": "bool, \"blue\", \"green\", \"orange\", \"red\", \"violet\", \"yellow\", \"gray\"/\"grey\", or \"rainbow\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Shows a colored divider below the header. If this is True,\nsuccessive headers will cycle through divider colors, except gray\nand rainbow. That is, the first header will have a blue line, the\nsecond header will have a green line, and so on. If this is a\nstring, the color can be set to one of the following: blue, green,\norange, red, violet, yellow, gray/grey, or rainbow.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the subheader element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "text_alignment", + "type_name": "\"left\", \"center\", \"right\", or \"justify\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of the text within the element. This can\nbe one of the following:

\n
    \n
  • "left" (default): Text is aligned to the left edge.
  • \n
  • "center": Text is centered.
  • \n
  • "right": Text is aligned to the right edge.
  • \n
  • "justify": Text is justified (stretched to fill the available\nwidth with the last line left-aligned).
  • \n
\n
\n

Note

\n

For text alignment to have a visible effect, the element's\nwidth must be wider than its content. If you use\nwidth="content" with short text, the alignment may not be\nnoticeable.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/heading.py#L152" + }, + "streamlit.success": { + "name": "success", + "signature": "st.success(body, *, icon=None, width=\"stretch\", title=None)", + "examples": "
\nimport streamlit as st\n\nst.success('This is a success message!', icon="\u2705")\n
\n", + "description": "

Display a success message.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

If icon is None, and body begins with an emoji or\nMaterial icon shortcode, Streamlit will extract it and display it\nslightly enlarged, as if it were passed to icon. If body\ncontains multiple icons, or you want to override this behavior,\nyou can insert a null Markdown directive like :red[] before\nyour leading icon.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the alert. If icon\nis None (default), Streamlit attempts to extract a leading\nemoji or Material icon shortcode from body. If found, the icon\nis displayed and removed from the body text. If no leading icon is\nfound, no icon is displayed. If icon is a string, it takes\nprecedence over any icon in the body, and the following options\nare valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the success element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "title", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional title to display above the body text. If None\n(default), no title is displayed. The title is rendered with bold\nstyling and can optionally contain GitHub-flavored Markdown of the\nfollowing types: Italics, Strikethroughs, Inline Code, Links, and\nImages. Images display like icons, with a max height equal to the\nfont height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display elements are not supported.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/alert.py#L385" + }, + "streamlit.switch_page": { + "name": "switch_page", + "signature": "st.switch_page(page, *, query_params=None)", + "examples": "

Example 1: Basic usage

\n

The following example shows how to switch to a different page in a\nmultipage app that uses the pages/ directory:

\n
\nyour-repository/\n\u251c\u2500\u2500 pages/\n\u2502   \u251c\u2500\u2500 page_1.py\n\u2502   \u2514\u2500\u2500 page_2.py\n\u2514\u2500\u2500 your_app.py\n
\n
\nimport streamlit as st\n\nif st.button("Home"):\n    st.switch_page("your_app.py")\nif st.button("Page 1"):\n    st.switch_page("pages/page_1.py")\nif st.button("Page 2"):\n    st.switch_page("pages/page_2.py")\n
\n

Example 2: Passing query parameters

\n

The following example shows how to pass query parameters when switching to a\ndifferent page. This example uses st.navigation to create a multipage app.

\n
\nyour-repository/\n\u251c\u2500\u2500 page_2.py\n\u2514\u2500\u2500 your_app.py\n
\n
\nimport streamlit as st\n\ndef page_1():\n    st.title("Page 1")\n    if st.button("Switch to Page 2"):\n        st.switch_page("page_2.py", query_params={"utm_source": "page_1"})\n\npg = st.navigation([page_1, "page_2.py"])\npg.run()\n
\n", + "description": "

Programmatically switch the current page in a multipage app.

\n

When st.switch_page is called, the current page execution stops and\nthe specified page runs as if the user clicked on it in the navigation\nmenu. The specified page must be recognized by Streamlit's multipage\narchitecture. Arbitrary Python scripts and URLs can't be passed to\nst.switch_page.

\n", + "args": [ + { + "name": "page", + "type_name": "str, Path, or Page", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The page to switch to. This can be one of the following values:

\n
    \n
  • Path to a Python file: The path can be a string or pathlib.Path\nobject. It can be absolute or relative to the entrypoint file. The\nPython file must be the source of a page in st.navigation.

    \n

    If you are using the pages/ directory instead of\nst.navigation, the Python file must be your entrypoint file or\na file in the pages/ directory.

    \n
  • \n
  • Page: The source of the Page and its\nurl_path must match a page defined in st.navigation. The\nPage must be internal and can't be defined by a URL.\nUse st.Page to create a Page object.

    \n
  • \n
\n

To switch to a page defined by a callable, you must use a\nPage object.

\n", + "default": null + }, + { + "name": "query_params", + "type_name": "dict, list of tuples, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Query parameters to apply when navigating to the target page.\nThis can be a dictionary or an iterable of key-value tuples. Values can\nbe strings or iterables of strings (for repeated keys). When this is\nNone (default), all non-embed query parameters are cleared during\nnavigation.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/commands/execution_control.py#L196" + }, + "streamlit.table": { + "name": "table", + "signature": "st.table(data=None, *, border=True, width=\"stretch\", height=\"content\", hide_index=None, hide_header=None)", + "examples": "

Example 1: Display a confusion matrix as a static table

\n
\nimport pandas as pd\nimport streamlit as st\n\nconfusion_matrix = pd.DataFrame(\n    {\n        "Predicted Cat": [85, 3, 2, 1],\n        "Predicted Dog": [2, 78, 4, 0],\n        "Predicted Bird": [1, 5, 72, 3],\n        "Predicted Fish": [0, 2, 1, 89],\n    },\n    index=["Actual Cat", "Actual Dog", "Actual Bird", "Actual Fish"],\n)\nst.table(confusion_matrix)\n
\n

Example 2: Display a product leaderboard with Markdown and horizontal borders

\n
\nimport streamlit as st\n\nproduct_data = {\n    "Product": [\n        ":material/devices: Widget Pro",\n        ":material/smart_toy: Smart Device",\n        ":material/inventory: Premium Kit",\n    ],\n    "Category": [":blue[Electronics]", ":green[IoT]", ":violet[Bundle]"],\n    "Stock": ["\ud83d\udfe2 Full", "\ud83d\udfe1 Low", "\ud83d\udd34 Empty"],\n    "Units sold": [1247, 892, 654],\n    "Revenue": [125000, 89000, 98000],\n}\nst.table(product_data, border="horizontal")\n
\n

Example 3: Display a scrollable table with fixed height

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    rng(0).standard_normal((50, 5)), columns=["A", "B", "C", "D", "E"]\n)\nst.table(df, height=300)\n
\n

Example 4: Display key-value data

\n
\nimport streamlit as st\n\nst.table(\n    {\n        ":material/folder: Project": "**Streamlit** - The fastest way to build data apps",\n        ":material/code: Repository": "[github.com/streamlit/streamlit](https://github.com/streamlit/streamlit)",\n        ":material/new_releases: Version": ":gray-badge[1.45.0]",\n        ":material/license: License": ":green-badge[Apache 2.0]",\n        ":material/group: Maintainers": ":blue-badge[Core Team] :violet-badge[Community]",\n    },\n    border="horizontal",\n    width="content",\n)\n
\n

Example 5: Display a minimal table without index and headers

\n
\nimport pandas as pd\nimport streamlit as st\n\ndf = pd.DataFrame({"Name": ["Alice", "Bob"], "Age": [25, 30]})\nst.table(df, hide_index=True, hide_header=True)\n
\n", + "description": "

Display a static table.

\n

While st.dataframe is geared towards large datasets and interactive\ndata exploration, st.table is useful for displaying small, styled\ntables without sorting or scrolling. For example, st.table may be\nthe preferred way to display a confusion matrix or leaderboard.\nAdditionally, st.table supports Markdown.

\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The table data.

\n

All cells including the index and column headers can optionally\ncontain GitHub-flavored Markdown. Syntax information can be found\nat: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "border", + "type_name": "bool or \"horizontal\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to show borders around the table and between cells. This can be one\nof the following:

\n
    \n
  • True (default): Show borders around the table and between cells.
  • \n
  • False: Don't show any borders.
  • \n
  • "horizontal": Show only horizontal borders between rows.
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the table element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n

Row index columns are sticky only when the content overflows a\nspecified integer width. Otherwise, they aren't sticky.

\n", + "default": null + }, + { + "name": "height", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the table element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content, showing all rows.
  • \n
  • "stretch": The height of the element expands to fill the\navailable vertical space in its parent container. When multiple\nelements with stretch height are in the same container, they\nshare the available vertical space evenly.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the table content exceeds this height,\nscrolling is enabled with sticky headers.
  • \n
\n", + "default": null + }, + { + "name": "hide_index", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to hide the index column. This can be one of the following\nvalues:

\n
    \n
  • None (default): Hide the index column if it's a default\nRangeIndex. Show custom indices.
  • \n
  • True: Always hide the index column.
  • \n
  • False: Always show the index column.
  • \n
\n", + "default": null + }, + { + "name": "hide_header", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to hide the column header row. This can be one of the\nfollowing values:

\n
    \n
  • None (default): Auto-hide headers for data formats without\nuser-defined column names, like dict, list, and\nnumpy.ndarray. Show headers for data with explicit column\nnames, like pandas.DataFrame.
  • \n
  • True: Always hide the column header row, including all levels\nof MultiIndex headers.
  • \n
  • False: Always show the column header row.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/table.py#L153" + }, + "streamlit.tabs": { + "name": "tabs", + "signature": "st.tabs(tabs, *, width=\"stretch\", height=\"content\", default=None, key=None, on_change=\"ignore\", args=None, kwargs=None)", + "examples": "

Example 1: Use context management

\n

You can use with notation to insert any element into a tab:

\n
\nimport streamlit as st\n\ntab1, tab2, tab3 = st.tabs(["Cat", "Dog", "Owl"])\n\nwith tab1:\n    st.header("A cat")\n    st.image("https://static.streamlit.io/examples/cat.jpg", width=200)\nwith tab2:\n    st.header("A dog")\n    st.image("https://static.streamlit.io/examples/dog.jpg", width=200)\nwith tab3:\n    st.header("An owl")\n    st.image("https://static.streamlit.io/examples/owl.jpg", width=200)\n
\n

Example 2: Call methods directly

\n

You can call methods directly on the returned objects:

\n
\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = rng(0).standard_normal((10, 1))\n\ntab1, tab2 = st.tabs(["\ud83d\udcc8 Chart", "\ud83d\uddc3 Data"])\n\ntab1.subheader("A tab with a chart")\ntab1.line_chart(df)\n\ntab2.subheader("A tab with the data")\ntab2.write(df)\n
\n

Example 3: Set the default tab and style the tab labels

\n

Use the default parameter to set the default tab. You can also use\nMarkdown in the tab labels.

\n
\nimport streamlit as st\n\ntab1, tab2, tab3 = st.tabs(\n    [":cat: Cat", ":dog: Dog", ":rainbow[Owl]"], default=":rainbow[Owl]"\n)\n\nwith tab1:\n    st.header("A cat")\n    st.image("https://static.streamlit.io/examples/cat.jpg", width=200)\nwith tab2:\n    st.header("A dog")\n    st.image("https://static.streamlit.io/examples/dog.jpg", width=200)\nwith tab3:\n    st.header("An owl")\n    st.image("https://static.streamlit.io/examples/owl.jpg", width=200)\n
\n

Example 4: Programmatically control the tab state

\n

You can use a key to programmatically control the tab state or access\nthe state in callbacks. You must set the on_change parameter for\nthe tabs to track state.

\n
\nimport streamlit as st\n\ndef switch_tab(tab):\n    st.session_state.animal = tab\n\ndef on_tab_change():\n    st.toast(f"You opened the {st.session_state.animal} tab.")\n\ncat, dog, owl = st.tabs(\n    ["Cat", "Dog", "Owl"], on_change=on_tab_change, key="animal"\n)\n\nif cat.open:\n    with cat:\n        st.write("This is the cat")\nif dog.open:\n    with dog:\n        st.write("This is the dog")\nif owl.open:\n    with owl:\n        st.write("This is the owl")\n\nwith st.container(horizontal=True):\n    st.button("Cat", on_click=switch_tab, args=("Cat",))\n    st.button("Dog", on_click=switch_tab, args=("Dog",))\n    st.button("Owl", on_click=switch_tab, args=("Owl",))\n
\n", + "description": "

Insert containers separated into tabs.

\n

Inserts a number of multi-element containers as tabs.\nTabs are a navigational element that allows users to easily\nmove between groups of related content.

\n

To add elements to the returned containers, you can use the with notation\n(preferred) or just call methods directly on the returned object. See\nthe examples below.

\n

By default, all tab content is computed and sent to the frontend\nregardless of which tab is selected. To enable lazy execution where\nonly the selected tab's content runs, use on_change="rerun" or\npass a callable to on_change. Each tab's .open property\nindicates whether it is the currently selected tab, letting you\nconditionally render expensive content.

\n", + "args": [ + { + "name": "tabs", + "type_name": "list of str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Creates a tab for each string in the list. The first tab is selected\nby default. The string is used as the name of the tab and can\noptionally contain GitHub-flavored Markdown of the following types:\nBold, Italics, Strikethroughs, Inline Code, Links, and Images.\nImages display like icons, with a max height equal to the font\nheight.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the tab container. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the container matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The container has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the container matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the tab container. This can be one of the following:

\n
    \n
  • "content" (default): The height of the container matches the\nheight of its content.
  • \n
  • "stretch": The height of the container matches the height\nof the parent container, and content that overflows scrolls\ninside the active tab panel. If the container is not in a\nfixed-height parent, the height of the container matches the\nheight of its content.
  • \n
  • An integer specifying the height in pixels: The container has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled inside the active tab panel.
  • \n
\n
\n

Note

\n

Use scrolling tab panels sparingly. If you use scrolling tab\npanels, avoid heights that exceed 500 pixels. Otherwise, the\nscroll surface of the tab panel might cover the majority of\nthe screen on mobile devices, which makes it hard to scroll the\nrest of the app.

\n
\n", + "default": null + }, + { + "name": "default", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The default tab to select. If this is None (default), the first\ntab is selected. If this is a string, it must be one of the tab\nlabels. If two tabs have the same label as default, the first\none is selected.

\n", + "default": "tab" + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key.

\n

When on_change is set to "rerun" or a callable, setting a\nkey lets you read or update the active tab label via\nst.session_state[key]. For more details, see Widget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "\"ignore\", \"rerun\", callable, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the tabs should respond when the user switches tabs. This\ncontrols whether tabs track state and trigger reruns. on_change\ncan be one of the following values:

\n
    \n
  • "ignore" (default): The tabs don't track state. All tab content\nruns regardless of which tab is selected. The .open attribute\nof each tab container returns None for all tabs.
  • \n
  • "rerun": The tabs track state. Streamlit reruns the app when\nthe user switches tabs. The .open attribute of each tab\ncontainer returns its current state, which is True if it is\nselected and False if it isn't selected. This lets you skip\nexpensive work in hidden tabs.
  • \n
  • A callable: The tabs track state. Streamlit executes the callable\nas a callback function and reruns the app when the user switches\ntabs. The .open attribute of each tab container returns its\nstate like when on_change="rerun". If you need to access\nlabel of the current tab inside your callback, fetch it through\nSession State.
  • \n
\n

When the tabs track state, they can't be used inside\nStreamlit cache-decorated functions.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional list or tuple of args to pass to the on_change\ncallback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the on_change callback.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Sequence of TabContainers", + "is_generator": false, + "description": "

A sequence of TabContainer objects with .open properties to\nreturn the current state of the tabs if the tabs track state.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/layouts.py#L708" + }, + "streamlit.text": { + "name": "text", + "signature": "st.text(body, *, help=None, width=\"content\", text_alignment=\"left\")", + "examples": "
\nimport streamlit as st\n\nst.text("This is text\\n[and more text](that's not a Markdown link).")\n
\n", + "description": "

Write text without Markdown or HTML parsing.

\n

For monospace text, use st.code.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The string to display.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the text. If this is None\n(default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the text element. This can be one of the following:

\n
    \n
  • "content" (default): The width of the element matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the element matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "text_alignment", + "type_name": "\"left\", \"center\", \"right\", or \"justify\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of the text within the element. This can\nbe one of the following:

\n
    \n
  • "left" (default): Text is aligned to the left edge.
  • \n
  • "center": Text is centered.
  • \n
  • "right": Text is aligned to the right edge.
  • \n
  • "justify": Text is justified (stretched to fill the available\nwidth with the last line left-aligned).
  • \n
\n
\n

Note

\n

For text alignment to have a visible effect, the element's\nwidth must be wider than its content. If you use\nwidth="content" with short text, the alignment may not be\nnoticeable.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/text.py#L31" + }, + "streamlit.text_area": { + "name": "text_area", + "signature": "st.text_area(label, value=\"\", height=None, max_chars=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\", width=\"stretch\", bind=None, persist_state=None)", + "examples": "
\nimport streamlit as st\n\ntxt = st.text_area(\n    "Text to analyze",\n    "It was the best of times, it was the worst of times, it was the age of "\n    "wisdom, it was the age of foolishness, it was the epoch of belief, it "\n    "was the epoch of incredulity, it was the season of Light, it was the "\n    "season of Darkness, it was the spring of hope, it was the winter of "\n    "despair, (...)",\n)\n\nst.write(f"You wrote {len(txt)} characters.")\n
\n", + "description": "

Display a multi-line text input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "object or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text value of this widget when it first renders. This will be\ncast to str internally. If None, will initialize empty and\nreturn None until the user provides input. Defaults to empty string.

\n", + "default": "empty" + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The height of the text area widget. This can be one of the\nfollowing:

\n
    \n
  • None (default): The height of the widget fits three lines.
  • \n
  • "content": The height of the widget matches the\nheight of its content.
  • \n
  • "stretch": The height of the widget matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the widget is not in a parent container, the height\nof the widget matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The widget has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n

The widget's height can't be smaller than the height of two lines.\nWhen label_visibility="collapsed", the minimum height is 68\npixels. Otherwise, the minimum height is 98 pixels.

\n", + "default": null + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Maximum number of characters allowed in text area.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing max_chars resets the widget even when a key\nis provided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this text_area's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string displayed when the text area is empty. If None,\nno text is displayed.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the text area if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the text area widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

An empty query parameter (e.g., ?my_key=) clears the\nwidget.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "str or None", + "is_generator": false, + "description": "

The current value of the text area widget or None if no value has been\nprovided by the user.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/text_widgets.py#L799" + }, + "streamlit.text_input": { + "name": "text_input", + "signature": "st.text_input(label, value=\"\", max_chars=None, key=None, type=\"default\", help=None, autocomplete=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\", icon=None, validate=None, width=\"stretch\", bind=None, persist_state=None)", + "examples": "
\nimport streamlit as st\n\ntitle = st.text_input("Movie title", "Life of Brian")\nst.write("The current movie title is", title)\n
\n

Use a specialized type to get a matching native input, icon,\nplaceholder, and validation with zero extra code:

\n
\nimport streamlit as st\n\nemail = st.text_input("Email", type="email")\nif email:\n    st.write("We'll reach you at", email)\n
\n", + "description": "

Display a single-line text input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "object or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text value of this widget when it first renders. This will be\ncast to str internally. If None, will initialize empty and\nreturn None until the user provides input. Defaults to empty string.

\n", + "default": "empty" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Max number of characters allowed in text input.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing max_chars or the validation regex resets the\nwidget even when a key is provided.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"default\", \"password\", \"email\", \"url\", \"phone\", or \"search\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The type of the text input. This sets the underlying native HTML\ninput type (which controls things like the mobile keyboard and\nbrowser autofill) and, for the specialized types, applies\noverridable smart defaults for icon, placeholder,\nvalidate, and autocomplete. Defaults to "default".

\n
    \n
  • "default": A regular single-line text input. No smart\ndefaults are applied.
  • \n
  • "password": A text input that masks the user's typed value.\nautocomplete defaults to "new-password".
  • \n
  • "email": An input for email addresses. Defaults to a mail\nicon, a you@example.com placeholder, email-format\nvalidation, and autocomplete="email".
  • \n
  • "url": An input for web addresses. Defaults to a link icon,\nan https://example.com placeholder, URL-format validation,\nand autocomplete="url".
  • \n
  • "phone": An input for phone numbers (numeric keypad on\nmobile). Defaults to a call icon, a +1 234 567 8900\nplaceholder, and autocomplete="tel". No default validation\nis applied because phone formats vary too widely.
  • \n
  • "search": A free-text search input with a clear button that\nempties the field. Defaults to a search icon, a Search\nplaceholder, and autocomplete="off" (so private search terms\ndon't leak into the browser's autofill history). No default\nvalidation is applied.
  • \n
\n

The smart defaults are only applied when you don't pass a value\nfor icon, placeholder, validate, or autocomplete.\nFor each of these, None (or omission) uses the type's default,\nan explicit value overrides it, and "" forces the feature off\n(for example, icon="" shows no icon).

\n
\n

Note

\n

The default email and URL validation runs in the user's browser\nand can be bypassed. If the validation is security-relevant, you\nmust also validate the value on the server (in your app code)\nafter it is submitted.

\n
\n", + "default": "a" + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "autocomplete", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional value that will be passed to the <input> element's\nautocomplete property. If this is None (default), the value is\nderived from type: "new-password" for "password",\n"email" for "email", "url" for "url", "tel"\nfor "phone", "off" for "search", and the empty string\nfor "default". Pass an explicit token to override the default,\nor "" to fall back to the browser's default autofill behavior\n(equivalent to not setting the attribute). For more details, see\nhttps://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete

\n", + "default": "autofill" + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this text input's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string displayed when the text input is empty. If\nplaceholder is None (default), the placeholder is derived\nfrom type (for example, you@example.com for\ntype="email"); for type="default" and type="password",\nno placeholder is displayed. Pass placeholder="" to force no\nplaceholder even for a specialized type.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the text input if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.

\n", + "default": "is" + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display within the input field to the\nleft of the value. If icon is None (default), the icon is\nderived from type (for example, a mail icon for\ntype="email"); for type="default" and type="password",\nno icon is displayed. Pass icon="" to force no icon even for a\nspecialized type. If icon is a non-empty string, the following\noptions are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols \nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "validate", + "type_name": "str, tuple[str, str], or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional client-side validation rule for the input. If this is\nNone (default), no validation is performed for\ntype="default" and type="password", while type="email"\nand type="url" fall back to their built-in format validation.\nPass validate="" to turn a specialized type's default\nvalidation off. If this is a string, it is treated as a\nJavaScript-flavored regular expression that the input must match\nbefore it can be submitted, and a generic error message is shown\nwhen validation fails. If this is a (regex, message) tuple, the\nregex is used for client-side validation and the custom message\nis shown when validation fails. Providing a custom message is\nrecommended, since generic validation messages are less helpful to\nusers. A user-supplied validate replaces the type's default\nrule.

\n

For example, pass r"^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$" to require an\nemail-like value, or\n(r"^\\d{3}-\\d{3}-\\d{4}$", "Use the format 555-123-4567.") to\nrequire a phone number and show a custom error message. Patterns are\nnot implicitly anchored; use ^ / $ when the whole value must\nmatch (same semantics as st.column_config.TextColumn).

\n

Validation runs when the user tries to submit a value: on blur or\nEnter outside a form, and on form submission inside a form. Invalid\nvalues are not submitted, and empty inputs bypass validation.

\n

Inside a form with bind="query-params", keystrokes still stage\nthe value into widget state (and therefore the URL) before\nsubmit-time validation runs. Form submission itself still blocks\ninvalid values from reaching the server.

\n
\n

Note

\n

This validation runs in the user's browser and can be bypassed.\nIf the validation is security-relevant, you must also validate\nthe value on the server (in your app code) after it is\nsubmitted.

\n
\n", + "default": "validation" + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the text input widget. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

This can't be used with type="password". An empty\nquery parameter (e.g., ?my_key=) clears the widget.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope. For example,\nst.text_input("Name", key="name", persist_state="session") keeps\nthe entered text when the widget is hidden and shown again, or when\nthe user navigates to another page and back.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "str or None", + "is_generator": false, + "description": "

The current value of the text input widget or None if no value has been\nprovided by the user.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/text_widgets.py#L242" + }, + "streamlit.time_input": { + "name": "time_input", + "signature": "st.time_input(label, value=\"now\", key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", step=0:15:00, format=\"24h\", width=\"stretch\", bind=None, persist_state=None)", + "examples": "

Example 1: Basic usage

\n
\nimport datetime\nimport streamlit as st\n\nt = st.time_input("Set an alarm for", datetime.time(8, 45))\nst.write("Alarm is set for", t)\n
\n

Example 2: Empty initial value

\n

To initialize an empty time input, use None as the value:

\n
\nimport datetime\nimport streamlit as st\n\nt = st.time_input("Set an alarm for", value=None)\nst.write("Alarm is set for", t)\n
\n", + "description": "

Display a time input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this time input is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "\"now\", datetime.time, datetime.datetime, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value of this widget when it first renders. This can be one of\nthe following:

\n
    \n
  • "now" (default): The widget initializes with the current time.
  • \n
  • A datetime.time or datetime.datetime object: The widget\ninitializes with the given time, ignoring any date if included.
  • \n
  • An ISO-formatted time (hh:mm[:ss[.ffffff]]) or datetime\n(YYYY-MM-DD hh:mm[:ss]) string: The widget initializes with the\ngiven time, ignoring any date if included.
  • \n
  • None: The widget initializes with no time and returns\nNone until the user selects a time.
  • \n
\n

Any seconds in the initial value are only preserved in the returned\ndatetime.time when step is not a whole number of minutes\n(step % 60 != 0). With the default step, seconds are stripped\nfrom the initial value.

\n", + "default": "step" + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n
\n

Note

\n

Changing step resets the widget even when a key is\nprovided, because it constrains valid values.

\n
\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this time_input's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the time input if set to\nTrue. The default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "step", + "type_name": "int or timedelta", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Controls which time components are displayed in the widget. This\ndefaults to 900 (15 minutes). You can also pass a\ndatetime.timedelta object. The value must be between 1\nsecond and 23 hours.

\n
    \n
  • If step is divisible by 60: hour and minute components\nare shown. Arrow keys snap to the nearest step boundary.
  • \n
  • Otherwise (step is not a whole number of minutes,\ni.e. step % 60 != 0): hour, minute, and second\ncomponents are shown, and the returned datetime.time\nincludes seconds. Arrow keys snap to the nearest step\nboundary across the full time value.
  • \n
\n

Any valid time may be entered regardless of the step value. Step\ndoes not restrict or snap the entered value.

\n", + "default": null + }, + { + "name": "format", + "type_name": "\"12h\", \"24h\", or \"localized\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Controls whether the hour is displayed in 12-hour or 24-hour\nformat. Defaults to "24h".

\n
    \n
  • "24h" (default): hours are displayed from 0 to 23.
  • \n
  • "12h": hours are displayed from 1 to 12 with an AM/PM\nindicator.
  • \n
  • "localized": the format is determined by the user's\nbrowser locale (may be 12-hour or 24-hour depending on\nthe locale).
  • \n
\n

The format setting is a display preference only and does\nnot affect the returned datetime.time value, which always\nuses 24-hour representation.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the time input widget. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the widget matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n

Times use HH:MM format in the URL (HH:MM:SS when step has\na sub-minute component). Invalid query parameter values are\nignored and removed from the URL. If value\nis None, an empty query parameter (e.g., ?my_key=)\nclears the widget.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "datetime.time or None", + "is_generator": false, + "description": "

The current value of the time input widget or None if no time has been\nselected.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/time_widgets.py#L714" + }, + "streamlit.title": { + "name": "title", + "signature": "st.title(body, anchor=None, *, help=None, width=\"stretch\", text_alignment=\"left\")", + "examples": "
\nimport streamlit as st\n\nst.title("This is a title")\nst.title("_Streamlit_ is :blue[cool] :sunglasses:")\n
\n", + "description": "

Display text in title formatting.

\n

Each document should have a single st.title(), although this is not\nenforced.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed next to the title. If this is\nNone (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the title element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "text_alignment", + "type_name": "\"left\", \"center\", \"right\", or \"justify\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of the text within the element. This can\nbe one of the following:

\n
    \n
  • "left" (default): Text is aligned to the left edge.
  • \n
  • "center": Text is centered.
  • \n
  • "right": Text is aligned to the right edge.
  • \n
  • "justify": Text is justified (stretched to fill the available\nwidth with the last line left-aligned).
  • \n
\n
\n

Note

\n

For text alignment to have a visible effect, the element's\nwidth must be wider than its content. If you use\nwidth="content" with short text, the alignment may not be\nnoticeable.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/heading.py#L261" + }, + "streamlit.toast": { + "name": "toast", + "signature": "st.toast(body, *, icon=None, duration=\"short\")", + "examples": "

Example 1: Show a toast message

\n
\nimport streamlit as st\n\nst.toast("Your edited image was saved!", icon="\ud83d\ude0d")\n
\n

Example 2: Show multiple toasts

\n

When multiple toasts are generated, they will stack. Hovering over a\ntoast will stop it from disappearing. When hovering ends, the toast\nwill disappear after time specified in duration.

\n
\nimport time\nimport streamlit as st\n\nif st.button("Three cheers"):\n    st.toast("Hip!")\n    time.sleep(0.5)\n    st.toast("Hip!")\n    time.sleep(0.5)\n    st.toast("Hooray!", icon="\ud83c\udf89")\n
\n

Example 3: Update a toast message

\n

Toast messages can also be updated. Assign st.toast(my_message) to\na variable and use the .toast() method to update it. If a toast has\nalready disappeared or been dismissed, the update will not be seen.

\n
\nimport time\nimport streamlit as st\n\ndef cook_breakfast():\n    msg = st.toast("Gathering ingredients...")\n    time.sleep(1)\n    msg.toast("Cooking...")\n    time.sleep(1)\n    msg.toast("Ready!", icon="\ud83e\udd5e")\n\nif st.button("Cook breakfast"):\n    cook_breakfast()\n
\n", + "description": "

Display a short message, known as a notification "toast".

\n

The toast appears in the app's top-right corner and disappears after four seconds.

\n
\n

Warning

\n

st.toast is not compatible with Streamlit's caching and\ncannot be called within a cached function.

\n
\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The string to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the alert. If icon\nis None (default), no icon is displayed. If icon is a\nstring, the following options are valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "duration", + "type_name": "\"short\", \"long\", \"infinite\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The time to display the toast message. This can be one of the\nfollowing:

\n
    \n
  • "short" (default): Displays for 4 seconds.
  • \n
  • "long": Displays for 10 seconds.
  • \n
  • "infinite": Shows the toast until the user dismisses it.
  • \n
  • An integer: Displays for the specified number of seconds.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/toast.py#L38" + }, + "streamlit.toggle": { + "name": "toggle", + "signature": "st.toggle(label, value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", width=\"content\", wrap=None, bind=None, persist_state=None)", + "examples": "
\nimport streamlit as st\n\non = st.toggle("Activate feature")\n\nif on:\n    st.write("Feature activated!")\n
\n", + "description": "

Display a toggle widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short label explaining to the user what this toggle is for.\nThe label can optionally contain GitHub-flavored Markdown of the\nfollowing types: Bold, Italics, Strikethroughs, Inline Code, Links,\nand Images. Images display like icons, with a max height equal to\nthe font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

For accessibility reasons, you should never set an empty label, but\nyou can hide it with label_visibility if needed. In the future,\nwe may disallow empty labels by raising an exception.

\n", + "default": null + }, + { + "name": "value", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Preselect the toggle when it first renders. This will be\ncast to bool internally.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional string or integer to use as the unique key for\nthe widget. If this is None (default), a key will be\ngenerated for the widget based on the values of the other\nparameters. No two widgets may have the same key. Assigning\na key stabilizes the widget's identity and preserves its\nstate across reruns even when other parameters change.

\n

A key lets you read or update the widget's value via\nst.session_state[key]. For more details, see Widget\nbehavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A tooltip that gets displayed next to the widget label. Streamlit\nonly displays the tooltip when label_visibility="visible". If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown,\nincluding the Markdown directives described in the body\nparameter of st.markdown.

\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional callback invoked when this toggle's value changes.

\n", + "default": null + }, + { + "name": "args", + "type_name": "list or tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional list or tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional boolean that disables the toggle if set to True.\nThe default is False.

\n", + "default": "is" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The visibility of the label. The default is "visible". If this\nis "hidden", Streamlit displays an empty spacer instead of the\nlabel, which can help keep the widget aligned with other widgets.\nIf this is "collapsed", Streamlit displays no label or spacer.

\n", + "default": "is" + }, + { + "name": "width", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the toggle widget. This can be one of the following:

\n
    \n
  • "content" (default): The width of the widget matches the\nwidth of its content, but doesn't exceed the width of the parent\ncontainer.
  • \n
  • "stretch": The width of the widget matches the width of the\nparent container.
  • \n
  • An integer specifying the width in pixels: The widget has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the widget matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "wrap", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the toggle label can wrap onto multiple lines. This can be\none of the following:

\n
    \n
  • None (default): Streamlit decides based on the surrounding\nlayout. Inside a horizontal container, the toggle keeps its\nstandard, single-row height and truncates an overflowing label\nwith an ellipsis; in other layouts, the label wraps onto\nadditional lines.
  • \n
  • True: If the label is too wide for the toggle, it wraps onto\nadditional lines and the widget grows taller.
  • \n
  • False: The toggle keeps its standard, single-row height. A\nlabel that is too wide is truncated with an ellipsis.
  • \n
\n

When the toggle keeps a single-row label, hovering the label reveals\nthe full label in a tooltip, including when help is set. The\ntoggle switch and help icon remain visible.

\n", + "default": null + }, + { + "name": "bind", + "type_name": "\"query-params\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Binding mode for syncing the widget's value with a URL query\nparameter. If this is None (default), the widget's value\nis not synced to the URL. When this is set to\n"query-params", changes to the widget update the URL, and\nthe widget can be initialized or updated through a query\nparameter in the URL. This requires key to be set. The\nkey is used as the query parameter name.

\n

When the widget's value equals its default, the query\nparameter is removed from the URL to keep it clean. A bound\nquery parameter can't be set or deleted through\nst.query_params; it can only be programmatically changed\nthrough st.session_state.

\n", + "default": null + }, + { + "name": "persist_state", + "type_name": "\"page\", \"session\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How long to preserve the widget's value when it isn't rendered.\nIf this is None (default), the value is lost when the widget\nstops being rendered or the user switches pages. If this is\n"page", the value is preserved only while the user stays on the\npage where the widget is defined (for example, while the widget is\nconditionally hidden); it is discarded on a page switch and is not\nrestored if the user returns to the page. If this is "session",\nthe value is preserved for the entire session, including across\npage switches, so it returns when the user navigates back. This\nrequires key to be set. If bind="query-params" is also set,\nthe binding takes precedence: the value is stored in the URL, so it\npersists across page switches regardless of the persist_state\nscope.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "

Whether or not the toggle is checked.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/checkbox.py#L255" + }, + "streamlit.vega_lite_chart": { + "name": "vega_lite_chart", + "signature": "st.vega_lite_chart(data=None, spec=None, *, width=None, height=\"content\", use_container_width=None, theme=\"streamlit\", key=None, on_select=\"ignore\", selection_mode=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((60, 3)), columns=["a", "b", "c"])\n\nst.vega_lite_chart(\n    df,\n    {\n        "mark": {"type": "circle", "tooltip": True},\n        "encoding": {\n            "x": {"field": "a", "type": "quantitative"},\n            "y": {"field": "b", "type": "quantitative"},\n            "size": {"field": "c", "type": "quantitative"},\n            "color": {"field": "c", "type": "quantitative"},\n        },\n    },\n)\n
\n

Examples of Vega-Lite usage without Streamlit can be found at\nhttps://vega.github.io/vega-lite/examples/. Most of those can be easily\ntranslated to the syntax shown above.

\n", + "description": "

Display a chart using the Vega-Lite library.

\n

Vega-Lite is a high-level\ngrammar for defining interactive graphics.

\n", + "args": [ + { + "name": "data", + "type_name": "Anything supported by st.dataframe", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Either the data to be plotted or a Vega-Lite spec containing the\ndata (which more closely follows the Vega-Lite API).

\n", + "default": null + }, + { + "name": "spec", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The Vega-Lite spec for the chart. If spec is None (default),\nStreamlit uses the spec passed in data. You cannot pass a spec\nto both data and spec. See\nhttps://vega.github.io/vega-lite/docs/ for more info.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the chart element. This can be one of the following:

\n
    \n
  • "stretch": The width of the element matches the width of the\nparent container.

    \n
  • \n
  • "content": The width of the element matches the width of its\ncontent, but doesn't exceed the width of the parent container.

    \n
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.

    \n
  • \n
  • None (default): Streamlit uses "stretch" for most charts,\nand uses "content" for the following multi-view charts:

    \n
    \n
      \n
    • Facet charts: the spec contains "facet" or encodings for\n"row", "column", or "facet".
    • \n
    • Horizontal concatenation charts: the spec contains\n"hconcat".
    • \n
    • Repeat charts: the spec contains "repeat".
    • \n
    • Nested composition charts: the spec contains "vconcat"\nwith nested "hconcat", "vconcat", "concat", or\n"layer" operators (e.g., scatter plots with marginal\nhistograms).
    • \n
    \n
    \n
  • \n
\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The height of the chart element. This can be one of the following:

\n
    \n
  • "content" (default): The height of the element matches the\nheight of its content.
  • \n
  • "stretch": The height of the element matches the height of\nits content or the height of the parent container, whichever is\nlarger. If the element is not in a parent container, the height\nof the element matches the height of its content.
  • \n
  • An integer specifying the height in pixels: The element has a\nfixed height. If the content is larger than the specified\nheight, scrolling is enabled.
  • \n
\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "deprecated": { + "deprecated": true, + "deprecatedText": "

use_container_width is deprecated and will be removed in a\nfuture release. For use_container_width=True, use\nwidth="stretch".

\n" + }, + "description": "

Whether to override the chart's native width with the width of\nthe parent container. This can be one of the following:

\n
    \n
  • None (default): Streamlit will use the parent container's\nwidth for all charts except those with known incompatibility\n(altair.Facet, altair.HConcatChart, and\naltair.RepeatChart).
  • \n
  • True: Streamlit sets the width of the chart to match the\nwidth of the parent container.
  • \n
  • False: Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of\nthe parent container.
  • \n
\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The theme of the chart. If theme is "streamlit" (default),\nStreamlit uses its own design default. If theme is None,\nStreamlit falls back to the default behavior of the library.

\n

The "streamlit" theme can be partially customized through the\nconfiguration options theme.chartCategoricalColors and\ntheme.chartSequentialColors. Font configuration options are\nalso applied.

\n", + "default": "behavior" + }, + { + "name": "key", + "type_name": "str, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string to use for giving this element a stable\nidentity. If this is None (default), the element's identity\nwill be determined based on the values of the other parameters.

\n

If selections are activated and key is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only. For more\ndetails, see Widget behavior.

\n

Additionally, if key is provided, it will be used as a\nCSS class name prefixed with st-key-.

\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\", \"rerun\", or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "

How the figure should respond to user selection events. This\ncontrols whether or not the figure behaves like an input widget.\non_select can be one of the following:

\n
    \n
  • "ignore" (default): Streamlit will not react to any selection\nevents in the chart. The figure will not behave like an input\nwidget.
  • \n
  • "rerun": Streamlit will rerun the app when the user selects\ndata in the chart. In this case, st.vega_lite_chart will\nreturn the selection data as a dictionary.
  • \n
  • A callable: Streamlit will rerun the app and execute the\ncallable as a callback function before the rest of the app.\nIn this case, st.vega_lite_chart will return the selection data\nas a dictionary.
  • \n
\n

To use selection events, the Vega-Lite spec defined in data or\nspec must include selection parameters from the charting\nlibrary. To learn about defining interactions in Vega-Lite, see\nDynamic Behaviors with Parameters\nin Vega-Lite's documentation.

\n

For consistent selection output, especially in multi-view charts\n(layer, hconcat, vconcat, facet, repeat), specify fields or\nencodings in your selection, like\nalt.selection_point(fields=["Origin"]) or\nalt.selection_point(encodings=["x", "y"]). Without explicit\nfields, Vega may add an internal row identifier field (vgsid)\nto your data, and selections can then return this identifier\ninstead of your original data values.

\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "str or Iterable of str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The selection parameters Streamlit should use. If\nselection_mode is None (default), Streamlit will use all\nselection parameters defined in the chart's Vega-Lite spec.

\n

When Streamlit uses a selection parameter, selections from that\nparameter will trigger a rerun and be included in the selection\nstate. When Streamlit does not use a selection parameter,\nselections from that parameter will not trigger a rerun and not be\nincluded in the selection state.

\n

Selection parameters are identified by their name property.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or VegaLiteState", + "is_generator": false, + "description": "

If on_select is "ignore" (default), this command returns an\ninternal placeholder for the chart element. Otherwise, this command\nreturns a VegaLiteState object. This object is dictionary-like\nand supports both key and attribute notation. To use this type in\nan annotation, import it from streamlit.typing.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/vega_charts.py#L2028" + }, + "streamlit.video": { + "name": "video", + "signature": "st.video(data, format=\"video/mp4\", start_time=0, *, subtitles=None, end_time=None, loop=False, autoplay=False, muted=False, width=\"stretch\")", + "examples": "
\nimport streamlit as st\n\nvideo_file = open("myvideo.mp4", "rb")\nvideo_bytes = video_file.read()\n\nst.video(video_bytes)\n
\n

When you include subtitles, they will be turned on by default. A viewer\ncan turn off the subtitles (or captions) from the browser's default video\ncontrol menu, usually located in the lower-right corner of the video.

\n

Here is a simple VTT file (subtitles.vtt):

\n
\nWEBVTT\n\n0:00:01.000 --> 0:00:02.000\nLook!\n\n0:00:03.000 --> 0:00:05.000\nLook at the pretty stars!\n
\n

If the above VTT file lives in the same directory as your app, you can\nadd subtitles like so:

\n
\nimport streamlit as st\n\nVIDEO_URL = "https://example.com/not-youtube.mp4"\nst.video(VIDEO_URL, subtitles="subtitles.vtt")\n
\n

See additional examples of supported subtitle input types in our\nvideo subtitles feature demo.

\n
\n

Note

\n

Some videos may not display if they are encoded using MP4V (which is an export option in OpenCV),\nas this codec is not widely supported by browsers. Converting your video to H.264 will allow\nthe video to be displayed in Streamlit.\nSee this StackOverflow post or this\nStreamlit forum post\nfor more information.

\n
\n", + "description": "

Display a video player.

\n", + "args": [ + { + "name": "data", + "type_name": "str, Path, bytes, io.BytesIO, numpy.ndarray, or file", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The video to play. This can be one of the following:

\n
    \n
  • A URL (string) for a hosted video file, including YouTube URLs.\nAlso supports /app/static/<asset> URLs for files served via\nstatic file serving.
  • \n
  • A path to a local video file. The path can be a str\nor Path object. Paths can be absolute or relative to the\nworking directory (where you execute streamlit run).
  • \n
  • Raw video data. Raw data formats must include all necessary file\nheaders to match the file format specified via format.
  • \n
\n", + "default": null + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The MIME type for the video file. This defaults to "video/mp4".\nFor more information about MIME types, see\nhttps://www.iana.org/assignments/media-types/media-types.xhtml.

\n", + "default": null + }, + { + "name": "start_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The time from which the element should start playing. This can be\none of the following:

\n
    \n
  • None (default): The element plays from the beginning.
  • \n
  • An int or float specifying the time in seconds. float\nvalues are rounded down to whole seconds.
  • \n
  • A string specifying the time in a format supported by Pandas'\nTimedelta constructor,\ne.g. "2 minute", "20s", or "1m14s".
  • \n
  • A timedelta object from Python's built-in datetime library,\ne.g. timedelta(seconds=70).
  • \n
\n", + "default": null + }, + { + "name": "subtitles", + "type_name": "str, bytes, Path, io.BytesIO, or dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Optional subtitle data for the video, supporting several input types:

\n
    \n
  • None (default): No subtitles.
  • \n
  • A string, bytes, or Path: File path to a subtitle file in\n.vtt or .srt formats, or the raw content of subtitles\nconforming to these formats. Paths can be absolute or relative to\nthe working directory (where you execute streamlit run).\nIf providing raw content, the string must adhere to the WebVTT or\nSRT format specifications.
  • \n
  • io.BytesIO: A BytesIO stream that contains valid .vtt or .srt\nformatted subtitle data.
  • \n
  • A dictionary: Pairs of labels and file paths or raw subtitle content in\n.vtt or .srt formats to enable multiple subtitle tracks.\nThe label will be shown in the video player. Example:\n{"English": "path/to/english.vtt", "French": "path/to/french.srt"}
  • \n
\n

When provided, subtitles are displayed by default. For multiple\ntracks, the first one is displayed by default. If you don't want any\nsubtitles displayed by default, use an empty string for the value\nin a dictionary's first pair: {"None": "", "English": "path/to/english.vtt"}

\n

Not supported for YouTube videos.

\n", + "default": null + }, + { + "name": "end_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The time at which the element should stop playing. This can be\none of the following:

\n
    \n
  • None (default): The element plays through to the end.
  • \n
  • An int or float specifying the time in seconds. float\nvalues are rounded down to whole seconds.
  • \n
  • A string specifying the time in a format supported by Pandas'\nTimedelta constructor,\ne.g. "2 minute", "20s", or "1m14s".
  • \n
  • A timedelta object from Python's built-in datetime library,\ne.g. timedelta(seconds=70).
  • \n
\n", + "default": null + }, + { + "name": "loop", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the video should loop playback.

\n", + "default": null + }, + { + "name": "autoplay", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the video should start playing automatically. This is\nFalse by default. Browsers will not autoplay unmuted videos\nif the user has not interacted with the page by clicking somewhere.\nTo enable autoplay without user interaction, you must also set\nmuted=True.

\n", + "default": null + }, + { + "name": "muted", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the video should play with the audio silenced. This is\nFalse by default. Use this in conjunction with autoplay=True\nto enable autoplay without user interaction.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the video player element. This can be one of the\nfollowing:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/media.py#L227" + }, + "streamlit.warning": { + "name": "warning", + "signature": "st.warning(body, *, icon=None, width=\"stretch\", title=None)", + "examples": "
\nimport streamlit as st\n\nst.warning('This is a warning', icon="\u26a0\ufe0f")\n
\n", + "description": "

Display warning message.

\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The text to display as GitHub-flavored Markdown. Syntax\ninformation can be found at: https://github.github.com/gfm.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n

If icon is None, and body begins with an emoji or\nMaterial icon shortcode, Streamlit will extract it and display it\nslightly enlarged, as if it were passed to icon. If body\ncontains multiple icons, or you want to override this behavior,\nyou can insert a null Markdown directive like :red[] before\nyour leading icon.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional emoji or icon to display next to the alert. If icon\nis None (default), Streamlit attempts to extract a leading\nemoji or Material icon shortcode from body. If found, the icon\nis displayed and removed from the body text. If no leading icon is\nfound, no icon is displayed. If icon is a string, it takes\nprecedence over any icon in the body, and the following options\nare valid:

\n
    \n
  • A single-character emoji. For example, you can set icon="\ud83d\udea8"\nor icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
  • \n
  • An icon from the Material Symbols library (rounded style) in the\nformat ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
  • \n
  • "spinner": Displays a spinner as an icon.

    \n
  • \n
\n", + "default": null + }, + { + "name": "width", + "type_name": "\"stretch\" or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The width of the warning element. This can be one of the following:

\n
    \n
  • "stretch" (default): The width of the element matches the\nwidth of the parent container.
  • \n
  • An integer specifying the width in pixels: The element has a\nfixed width. If the specified width is greater than the width of\nthe parent container, the width of the element matches the width\nof the parent container.
  • \n
\n", + "default": null + }, + { + "name": "title", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional title to display above the body text. If None\n(default), no title is displayed. The title is rendered with bold\nstyling and can optionally contain GitHub-flavored Markdown of the\nfollowing types: Italics, Strikethroughs, Inline Code, Links, and\nImages. Images display like icons, with a max height equal to the\nfont height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Display elements are not supported.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/alert.py#L168" + }, + "streamlit.write": { + "name": "write", + "signature": "st.write(*args, unsafe_allow_html=False)", + "examples": "

Its basic use case is to draw Markdown-formatted text, whenever the\ninput is a string:

\n
\nimport streamlit as st\n\nst.write("Hello, *World!* :sunglasses:")\n
\n

As mentioned earlier, st.write() also accepts other data formats, such as\nnumbers, data frames, styled data frames, and assorted objects:

\n
\nimport streamlit as st\nimport pandas as pd\n\nst.write(1234)\nst.write(\n    pd.DataFrame(\n        {\n            "first column": [1, 2, 3, 4],\n            "second column": [10, 20, 30, 40],\n        }\n    )\n)\n
\n

Finally, you can pass in multiple arguments to do things like:

\n
\nimport streamlit as st\n\nst.write("1 + 1 = ", 2)\nst.write("Below is a DataFrame:", data_frame, "Above is a dataframe.")\n
\n

Oh, one more thing: st.write accepts chart objects too! For example:

\n
\nimport altair as alt\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((200, 3)), columns=["a", "b", "c"])\nchart = (\n    alt.Chart(df)\n    .mark_circle()\n    .encode(x="a", y="b", size="c", color="c", tooltip=["a", "b", "c"])\n)\n\nst.write(chart)\n
\n", + "description": "

Displays arguments in the app.

\n

This is the Swiss Army knife of Streamlit commands: it does different\nthings depending on what you throw at it. Unlike other Streamlit\ncommands, st.write() has some unique properties:

\n
    \n
  • You can pass in multiple arguments, all of which will be displayed.
  • \n
  • Its behavior depends on the input type(s).
  • \n
\n", + "args": [ + { + "name": "*args", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": false, + "description": "

One or many objects to display in the app.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Each type of argument is handled as follows:
TypeHandling
strUses st.markdown().
dataframe-like, dict, or listUses st.dataframe().
ExceptionUses st.exception().
function, module, or classUses st.help().
DeltaGeneratorUses st.help().
Altair chartUses st.altair_chart().
Graphviz graphUses st.graphviz_chart().
Keras modelConverts model and uses st.graphviz_chart().
Matplotlib figureUses st.pyplot().
Plotly figureUses st.plotly_chart().
PIL.ImageUses st.image().
generator or stream (like openai.Stream)Uses st.write_stream().
SymPy expressionUses st.latex().
An object with ._repr_html()Uses st.html().
Database cursorDisplays DB API 2.0 cursor results in a table.
AnyDisplays str(arg) as inline code.
\n", + "default": null + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to render HTML within *args. This only applies to\nstrings or objects falling back on _repr_html_(). If this is\nFalse (default), any HTML tags found in body will be\nescaped and therefore treated as raw text. If this is True, any\nHTML expressions within body will be rendered.

\n

Adding custom HTML to your app impacts safety, styling, and\nmaintainability.

\n
\n

Note

\n

If you only want to insert HTML or CSS without Markdown text,\nwe recommend using st.html instead.

\n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/write.py#L302" + }, + "streamlit.write_stream": { + "name": "write_stream", + "signature": "st.write_stream(stream, *, cursor=None)", + "examples": "

You can pass an OpenAI stream as shown in our tutorial, Build a basic LLM chat app. Alternatively,\nyou can pass a generic generator function as input:

\n
\nimport time\nimport numpy as np\nimport pandas as pd\nimport streamlit as st\n\n_LOREM_IPSUM = \\"\\"\\"\nLorem ipsum dolor sit amet, **consectetur adipiscing** elit, sed do eiusmod tempor\nincididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis\nnostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n\\"\\"\\"\n\n\ndef stream_data():\n    for word in _LOREM_IPSUM.split(" "):\n        yield word + " "\n        time.sleep(0.02)\n\n    yield pd.DataFrame(\n        np.random.randn(5, 10),\n        columns=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"],\n    )\n\n    for word in _LOREM_IPSUM.split(" "):\n        yield word + " "\n        time.sleep(0.02)\n\n\nif st.button("Stream data"):\n    st.write_stream(stream_data)\n
\n", + "description": "

Stream a generator, iterable, or stream-like sequence to the app.

\n

st.write_stream iterates through the given sequences and writes all\nchunks to the app. String chunks will be written using a typewriter effect.\nOther data types will be written using st.write.

\n", + "args": [ + { + "name": "stream", + "type_name": "Callable, Generator, Iterable, OpenAI Stream, or LangChain Stream", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The generator or iterable to stream.

\n

If you pass an async generator, Streamlit will internally convert\nit to a sync generator. If the generator depends on a cached object\nwith async references, this can raise an error.

\n

Streamlit natively parses OpenAI streams (both the Chat\nCompletions API and the Responses API) and LangChain streams.

\n
\n

Note

\n

To use additional LLM libraries, you can create a wrapper to\nmanually define a generator function and include custom output\nparsing.

\n
\n", + "default": null + }, + { + "name": "cursor", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A string to append to text as it's being written. If this is\nNone (default), no cursor is shown. Otherwise, the string is\nrendered as Markdown and appears as a cursor at the end of the\nstreamed text. For example, you can use an emoji, emoji shortcode,\nor Material icon.

\n

The first line of the cursor string can contain GitHub-flavored\nMarkdown of the following types: Bold, Italics, Strikethroughs,\nInline Code, Links, and Images. Images display like icons, with a\nmax height equal to the font height. If you pass a multiline\nstring, additional lines display after the text with the full\nMarkdown rendering capabilities of st.markdown.

\n

See the body parameter of st.markdown for additional,\nsupported Markdown directives.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "str or list", + "is_generator": false, + "description": "

The full response. If the streamed output only contains text, this\nis a string. Otherwise, this is a list of all the streamed objects.\nThe return value is fully compatible as input for st.write.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/write.py#L70" + }, + "streamlit.cache_data.clear": { + "name": "cache_data.clear", + "signature": "st.cache_data.clear()", + "description": "

Clear all in-memory and on-disk data caches.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/caching/cache_data_api.py#L761" + }, + "streamlit.cache_resource.clear": { + "name": "cache_resource.clear", + "signature": "st.cache_resource.clear()", + "description": "

Clear all cache_resource caches.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/caching/cache_resource_api.py#L681" + }, + "streamlit.query_params.clear": { + "name": "clear", + "signature": "st.query_params.clear()", + "description": "

Clear all query parameters from the URL of the app.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/state/query_params_proxy.py#L135" + }, + "streamlit.query_params.from_dict": { + "name": "from_dict", + "signature": "st.query_params.from_dict(params)", + "examples": "
\nimport streamlit as st\n\nst.query_params.from_dict({"foo": "bar", "baz": [1, "two"]})\n
\n", + "description": "

Set all of the query parameters from a dictionary or dictionary-like object.

\n

This method primarily exists for advanced users who want to control\nmultiple query parameters in a single update. To set individual query\nparameters, use key or attribute notation instead.

\n

This method inherits limitations from st.query_params and can't be\nused to set embedding options as described in Embed your app.

\n

To handle repeated keys, the value in a key-value pair should be a list.

\n
\n

Note

\n

.from_dict() is not a direct inverse of .to_dict() if\nyou are working with repeated keys. A true inverse operation is\n{key: st.query_params.get_all(key) for key in st.query_params}.

\n
\n", + "args": [ + { + "name": "params", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A dictionary used to replace the current query parameters.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/state/query_params_proxy.py#L169" + }, + "streamlit.query_params.get_all": { + "name": "get_all", + "signature": "st.query_params.get_all(key)", + "description": "

Get a list of all query parameter values associated to a given key.

\n

When a key is repeated as a query parameter within the URL, this method\nallows all values to be obtained. In contrast, dict-like methods only\nretrieve the last value when a key is repeated in the URL.

\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label of the query parameter in the URL.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "List[str]", + "is_generator": false, + "description": "

A list of values associated to the given key. May return zero, one,\nor multiple values.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/state/query_params_proxy.py#L112" + }, + "streamlit.query_params.missing_attr_error_message": { + "name": "missing_attr_error_message", + "signature": "st.query_params.missing_attr_error_message(key)", + "description": "

Returns a formatted error message for missing attributes.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/state/query_params_proxy.py#L213" + }, + "streamlit.query_params.missing_key_error_message": { + "name": "missing_key_error_message", + "signature": "st.query_params.missing_key_error_message(key)", + "description": "

Returns a formatted error message for missing keys.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/state/query_params_proxy.py#L208" + }, + "streamlit.query_params.to_dict": { + "name": "to_dict", + "signature": "st.query_params.to_dict()", + "description": "

Get all query parameters as a dictionary.

\n

This method primarily exists for internal use and is not needed for\nmost cases. st.query_params returns an object that inherits from\ndict by default.

\n

When a key is repeated as a query parameter within the URL, this method\nwill return only the last value of each unique key.

\n", + "args": [], + "returns": [ + { + "type_name": "Dict[str,str]", + "is_generator": false, + "description": "

A dictionary of the current query parameters in the app's URL.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/state/query_params_proxy.py#L141" + }, + "streamlit.query_params.update": { + "name": "update", + "signature": "st.query_params.update(params=(), /, **kwds)", + "description": "

Update one or more values in query_params at once from a dictionary or

\n

dictionary-like object.

\n

See Mapping.update() from Python's collections library.

\n", + "args": [ + { + "name": "other", + "type_name": "SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]]", + "is_optional": false, + "description": "

A dictionary or mapping of strings to strings.

\n", + "default": null + }, + { + "name": "**kwds", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Additional key/value pairs to update passed as keyword arguments.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/state/query_params_proxy.py#L90" + }, + "streamlit.connections.BaseConnection": { + "name": "BaseConnection", + "signature": "st.connections.BaseConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "close", + "signature": "st.connections.close.close()", + "description": "

A function to invoke when this connection needs to be cleaned up.

", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L201" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "examples": "
\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L130" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L28", + "description": "

The abstract base class that all Streamlit Connections must inherit from.

\n

This base class provides connection authors with a standardized way to hook into the\nst.connection() factory function: connection authors are required to provide an\nimplementation for the abstract method _connect in their subclasses.

\n

Additionally, it also provides a few methods/properties designed to make\nimplementation of connections more convenient. See the docstrings for each of the\nmethods of this class for more information

\n

By default, BaseConnection is a global-scoped connection. It has a class\nmethod BaseConnection.scope() that returns "global". To implement a session-scoped\nconnection, override this method to return "session" in your subclass.

\n
\n

Note

\n

While providing an implementation of _connect is technically all that's\nrequired to define a valid connection, connections should also provide the user\nwith context-specific ways of interacting with the underlying connection object.\nFor example, the first-party SQLConnection provides a query() method for\nreads and a session property for more complex operations.

\n
\n", + "args": [], + "returns": [] + }, + "streamlit.connections.ExperimentalBaseConnection": { + "name": "ExperimentalBaseConnection", + "signature": "st.connections.ExperimentalBaseConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "close", + "signature": "st.connections.close.close()", + "description": "

A function to invoke when this connection needs to be cleaned up.

", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L201" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "examples": "
\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L130" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L28", + "description": "

The abstract base class that all Streamlit Connections must inherit from.

\n

This base class provides connection authors with a standardized way to hook into the\nst.connection() factory function: connection authors are required to provide an\nimplementation for the abstract method _connect in their subclasses.

\n

Additionally, it also provides a few methods/properties designed to make\nimplementation of connections more convenient. See the docstrings for each of the\nmethods of this class for more information

\n

By default, BaseConnection is a global-scoped connection. It has a class\nmethod BaseConnection.scope() that returns "global". To implement a session-scoped\nconnection, override this method to return "session" in your subclass.

\n
\n

Note

\n

While providing an implementation of _connect is technically all that's\nrequired to define a valid connection, connections should also provide the user\nwith context-specific ways of interacting with the underlying connection object.\nFor example, the first-party SQLConnection provides a query() method for\nreads and a session property for more complex operations.

\n
\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SQLConnection": { + "name": "SQLConnection", + "signature": "st.connections.SQLConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "close", + "signature": "st.connections.close.close()", + "description": "

A function to invoke when this connection needs to be cleaned up.

", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L201" + }, + { + "name": "connect", + "signature": "st.connections.connect.connect()", + "description": "

Call .connect() on the underlying SQLAlchemy Engine, returning a new connection object.

", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.engine.Connection", + "is_generator": false, + "description": "

A new SQLAlchemy connection object.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L355" + }, + { + "name": "query", + "signature": "st.connections.query.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", + "example": "
\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query(\n    "SELECT * FROM pet_owners WHERE owner = :owner",\n    ttl=3600,\n    params={"owner": "barbara"},\n)\nst.dataframe(df)\n
\n", + "description": "

Run a read-only query.

", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The read-only SQL query to execute.

\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Enable the spinner. The default is to show a spinner when there is a\n"cache miss" and the cached resource is being created. If a string, the value\nof the show_spinner param will be used for the spinner text.

\n", + "default": "to" + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", + "default": "None" + }, + { + "name": "index_col", + "type_name": "str, list of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column(s) to set as index(MultiIndex). Default is None.

\n", + "default": "None" + }, + { + "name": "chunksize", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.

\n", + "default": "None" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in PEP 249\nparamstyle, is supported.\nDefault is None.

\n", + "default": "None" + }, + { + "name": "**kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Additional keyword arguments are passed to pandas.read_sql.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L224" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "examples": "
\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L130" + } + ], + "properties": [ + { + "name": "driver", + "signature": "st.connections.driver.driver", + "description": "

The name of the driver used by the underlying SQLAlchemy Engine.

", + "args": [], + "returns": [ + { + "type_name": "str", + "is_generator": false, + "description": "

The name of the driver. For example, "pyodbc" or "psycopg2".

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L384" + }, + { + "name": "engine", + "signature": "st.connections.engine.engine", + "description": "

The underlying SQLAlchemy Engine.

", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.engine.base.Engine", + "is_generator": false, + "description": "

The underlying SQLAlchemy Engine.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L371" + }, + { + "name": "session", + "signature": "st.connections.session.session", + "example": "
\nimport streamlit as st\nconn = st.connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n    with conn.session as session:\n        session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n        session.commit()\n
\n", + "description": "

A SQLAlchemy Session.

", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.orm.Session", + "is_generator": false, + "description": "

A SQLAlchemy Session.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L397" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L55", + "examples": "

Example 1: Configuration with URL

\n

You can configure your SQL connection using Streamlit's\nSecrets management.\nThe following example specifies a SQL connection URL.

\n

.streamlit/secrets.toml:

\n
\n[connections.sql]\nurl = "xxx+xxx://xxx:xxx@xxx:xxx/xxx"\n
\n

Your app code:

\n
\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query("SELECT * FROM pet_owners")\nst.dataframe(df)\n
\n

Example 2: Configuration with dialect, host, and username

\n

If you do not specify url, you must at least specify dialect,\nhost, and username instead. The following example also includes\npassword.

\n

.streamlit/secrets.toml:

\n
\n[connections.sql]\ndialect = "xxx"\nhost = "xxx"\nusername = "xxx"\npassword = "xxx"\n
\n

Your app code:

\n
\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query("SELECT * FROM pet_owners")\nst.dataframe(df)\n
\n

Example 3: Configuration with keyword arguments

\n

You can configure your SQL connection with keyword arguments (with or\nwithout secrets.toml). For example, if you use Microsoft Entra ID with\na Microsoft Azure SQL server, you can quickly set up a local connection for\ndevelopment using interactive authentication.

\n

This example requires the Microsoft ODBC Driver for SQL Server\nfor Windows in addition to the sqlalchemy and pyodbc packages for\nPython.

\n
\nimport streamlit as st\n\nconn = st.connection(\n    "sql",\n    dialect="mssql",\n    driver="pyodbc",\n    host="xxx.database.windows.net",\n    database="xxx",\n    username="xxx",\n    query={\n        "driver": "ODBC Driver 18 for SQL Server",\n        "authentication": "ActiveDirectoryInteractive",\n        "encrypt": "yes",\n    },\n)\n\ndf = conn.query("SELECT * FROM pet_owners")\nst.dataframe(df)\n
\n", + "description": "

A connection to a SQL database using a SQLAlchemy Engine.

\n

Initialize this connection object using st.connection("sql") or\nst.connection("<name>", type="sql"). Connection parameters for a\nSQLConnection can be specified using secrets.toml and/or **kwargs.\nPossible connection parameters include:

\n
    \n
  • url or keyword arguments for sqlalchemy.engine.URL.create(), except\ndrivername. Use dialect and driver instead of drivername.
  • \n
  • Keyword arguments for sqlalchemy.create_engine(), including custom\nconnect() arguments used by your specific dialect or driver.
  • \n
  • autocommit. If this is False (default), the connection operates\nin manual commit (transactional) mode. If this is True, the\nconnection operates in autocommit (non-transactional) mode.
  • \n
\n

If url exists as a connection parameter, Streamlit will pass it to\nsqlalchemy.engine.make_url(). Otherwise, Streamlit requires (at a\nminimum) dialect, username, and host. Streamlit will use\ndialect and driver (if defined) to derive drivername, then pass\nthe relevant connection parameters to sqlalchemy.engine.URL.create().

\n

In addition to the default keyword arguments for sqlalchemy.create_engine(),\nyour dialect may accept additional keyword arguments. For example, if you\nuse dialect="snowflake" with Snowflake SQLAlchemy,\nyou can pass a value for private_key to use key-pair authentication. If\nyou use dialect="bigquery" with Google BigQuery,\nyou can pass a value for location.

\n

SQLConnection provides the .query() convenience method, which can be\nused to run simple, read-only queries with both caching and simple error\nhandling/retries. More complex database interactions can be performed by\nusing the .session property to receive a regular SQLAlchemy Session.

\n
\n

Important

\n

SQLAlchemy must be installed\nin your environment to use this connection. You must also install your\ndriver, such as pyodbc or psycopg2.

\n
\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SnowflakeCallersRightsConnection": { + "name": "SnowflakeCallersRightsConnection", + "signature": "st.connections.SnowflakeCallersRightsConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "close", + "signature": "st.connections.close.close()", + "description": "

Closes the underlying Snowflake connection.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L355" + }, + { + "name": "cursor", + "signature": "st.connections.cursor.cursor()", + "example": "

The following example uses a cursor to insert multiple rows into a\ntable. The qmark parameter style is specified as an optional\nkeyword argument. Alternatively, the parameter style can be declared in\nyour connection configuration file. For more information, see the\nSnowflake Connector for Python documentation.

\n
\nimport streamlit as st\n\nconn = st.connection("snowflake", "paramstyle"="qmark")\nrows_to_insert = [("Mary", "dog"), ("John", "cat"), ("Robert", "bird")]\nconn.cursor().executemany(\n    "INSERT INTO mytable (name, pet) VALUES (?, ?)", rows_to_insert\n)\n
\n", + "description": "

Create a new cursor object from this connection.

", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.cursor.SnowflakeCursor", + "is_generator": false, + "description": "

A cursor object for the connection.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L247" + }, + { + "name": "query", + "signature": "st.connections.query.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)", + "example": "
\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\nst.dataframe(df)\n
\n", + "description": "

Run a read-only SQL query.

", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The read-only SQL query to execute.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to keep results in the cache. If this\nis None (default), cached results do not expire with time.

\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to enable the spinner. When a cached query is executed, no\nspinner is displayed because the result is immediately available.\nWhen a new query is executed, the default is to show a spinner with\nthe message "Running snowflake.query(...)."

\n

If this is False, no spinner displays while executing the\nquery. If this is a string, the string will be used as the message\nfor the spinner.

\n", + "default": "to" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

List of parameters to pass to the Snowflake Connector for Python\nCursor.execute() method. This connector supports binding data\nto a SQL statement using qmark bindings. For more information and\nexamples, see the Snowflake Connector for Python documentation.\nThis defaults to None.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L66" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "examples": "
\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L130" + }, + { + "name": "session", + "signature": "st.connections.session.session()", + "example": "

The following example creates a new Snowpark session and uses it to run\na query.

\n
\nimport streamlit as st\n\nconn = st.connection("snowflake")\nsession = conn.session()\ndf = session.sql("SELECT * FROM my_table").collect()\n
\n", + "description": "

Create a new Snowpark session from this connection.

", + "args": [], + "returns": [ + { + "type_name": "snowflake.snowpark.Session", + "is_generator": false, + "description": "

A new Snowpark session for this connection.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L319" + }, + { + "name": "write_pandas", + "signature": "st.connections.write_pandas.write_pandas(df, table_name, database=None, schema=None, chunk_size=None, **kwargs)", + "example": "

The following example uses the database and schema currently in use in\nthe session and copies the data into a table named "my_table."

\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    {"Name": ["Mary", "John", "Robert"], "Pet": ["dog", "cat", "bird"]}\n)\nconn = st.connection("snowflake")\nconn.write_pandas(df, "my_table")\n
\n", + "description": "

Write a pandas.DataFrame to a table in a Snowflake database.

", + "args": [ + { + "name": "df", + "type_name": "pandas.DataFrame", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The pandas.DataFrame object containing the data to be copied\ninto the table.

\n", + "default": null + }, + { + "name": "table_name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Name of the table where the data should be copied to.

\n", + "default": null + }, + { + "name": "database", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Name of the database containing the table. By default, the function\nwrites to the database that is currently in use in the session.

\n
\n

Note

\n

If you specify this parameter, you must also specify the schema\nparameter.

\n
\n", + "default": null + }, + { + "name": "schema", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Name of the schema containing the table. By default, the function\nwrites to the table in the schema that is currently in use in the\nsession.

\n", + "default": null + }, + { + "name": "chunk_size", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Number of elements to insert at a time. By default, the function\ninserts all elements in one chunk.

\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Additional keyword arguments for\nsnowflake.connector.pandas_tools.write_pandas().

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "tuple[bool, int, int]", + "is_generator": false, + "description": "

A tuple containing three values:

\n
    \n
  1. A boolean value that is True if the write was successful.
  2. \n
  3. An integer giving the number of chunks of data that were copied.
  4. \n
  5. An integer giving the number of rows that were inserted.
  6. \n
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L165" + } + ], + "properties": [ + { + "name": "raw_connection", + "signature": "st.connections.raw_connection.raw_connection", + "example": "

The following example uses a cursor to submit an asynchronous query,\nsaves the query ID, then periodically checks the query status through\nthe connection before retrieving the results.

\n
\nimport streamlit as st\nimport time\n\nconn = st.connection("snowflake")\ncur = conn.cursor()\ncur.execute_async("SELECT * FROM my_table")\nquery_id = cur.sfqid\nwhile True:\n    status = conn.raw_connection.get_query_status(query_id)\n    if conn.raw_connection.is_still_running(status):\n        time.sleep(1)\n    else:\n        break\ncur.get_results_from_sfqid(query_id)\ndf = cur.fetchall()\n
\n", + "description": "

Access the underlying connection object from the Snowflake Connector for Python.

", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.connection.SnowflakeConnection", + "is_generator": false, + "description": "

The connection object.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L280" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L690", + "description": "

A caller's rights connection to Snowflake using the Snowflake Connector for Python.

\n

This will only work when running on Snowpark Container Services or another\ncompatible platform.

\n

See BaseSnowflakeConnection for complete docs.

\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SnowflakeConnection": { + "name": "SnowflakeConnection", + "signature": "st.connections.SnowflakeConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "close", + "signature": "st.connections.close.close()", + "description": "

Closes the underlying Snowflake connection.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L355" + }, + { + "name": "cursor", + "signature": "st.connections.cursor.cursor()", + "example": "

The following example uses a cursor to insert multiple rows into a\ntable. The qmark parameter style is specified as an optional\nkeyword argument. Alternatively, the parameter style can be declared in\nyour connection configuration file. For more information, see the\nSnowflake Connector for Python documentation.

\n
\nimport streamlit as st\n\nconn = st.connection("snowflake", "paramstyle"="qmark")\nrows_to_insert = [("Mary", "dog"), ("John", "cat"), ("Robert", "bird")]\nconn.cursor().executemany(\n    "INSERT INTO mytable (name, pet) VALUES (?, ?)", rows_to_insert\n)\n
\n", + "description": "

Create a new cursor object from this connection.

", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.cursor.SnowflakeCursor", + "is_generator": false, + "description": "

A cursor object for the connection.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L247" + }, + { + "name": "query", + "signature": "st.connections.query.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)", + "example": "
\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\nst.dataframe(df)\n
\n", + "description": "

Run a read-only SQL query.

", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The read-only SQL query to execute.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to keep results in the cache. If this\nis None (default), cached results do not expire with time.

\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to enable the spinner. When a cached query is executed, no\nspinner is displayed because the result is immediately available.\nWhen a new query is executed, the default is to show a spinner with\nthe message "Running snowflake.query(...)."

\n

If this is False, no spinner displays while executing the\nquery. If this is a string, the string will be used as the message\nfor the spinner.

\n", + "default": "to" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

List of parameters to pass to the Snowflake Connector for Python\nCursor.execute() method. This connector supports binding data\nto a SQL statement using qmark bindings. For more information and\nexamples, see the Snowflake Connector for Python documentation.\nThis defaults to None.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L66" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "examples": "
\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L130" + }, + { + "name": "session", + "signature": "st.connections.session.session()", + "example": "

The following example creates a new Snowpark session and uses it to run\na query.

\n
\nimport streamlit as st\n\nconn = st.connection("snowflake")\nsession = conn.session()\ndf = session.sql("SELECT * FROM my_table").collect()\n
\n", + "description": "

Create a new Snowpark session from this connection.

", + "args": [], + "returns": [ + { + "type_name": "snowflake.snowpark.Session", + "is_generator": false, + "description": "

A new Snowpark session for this connection.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L319" + }, + { + "name": "write_pandas", + "signature": "st.connections.write_pandas.write_pandas(df, table_name, database=None, schema=None, chunk_size=None, **kwargs)", + "example": "

The following example uses the database and schema currently in use in\nthe session and copies the data into a table named "my_table."

\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    {"Name": ["Mary", "John", "Robert"], "Pet": ["dog", "cat", "bird"]}\n)\nconn = st.connection("snowflake")\nconn.write_pandas(df, "my_table")\n
\n", + "description": "

Write a pandas.DataFrame to a table in a Snowflake database.

", + "args": [ + { + "name": "df", + "type_name": "pandas.DataFrame", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The pandas.DataFrame object containing the data to be copied\ninto the table.

\n", + "default": null + }, + { + "name": "table_name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Name of the table where the data should be copied to.

\n", + "default": null + }, + { + "name": "database", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Name of the database containing the table. By default, the function\nwrites to the database that is currently in use in the session.

\n
\n

Note

\n

If you specify this parameter, you must also specify the schema\nparameter.

\n
\n", + "default": null + }, + { + "name": "schema", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Name of the schema containing the table. By default, the function\nwrites to the table in the schema that is currently in use in the\nsession.

\n", + "default": null + }, + { + "name": "chunk_size", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Number of elements to insert at a time. By default, the function\ninserts all elements in one chunk.

\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Additional keyword arguments for\nsnowflake.connector.pandas_tools.write_pandas().

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "tuple[bool, int, int]", + "is_generator": false, + "description": "

A tuple containing three values:

\n
    \n
  1. A boolean value that is True if the write was successful.
  2. \n
  3. An integer giving the number of chunks of data that were copied.
  4. \n
  5. An integer giving the number of rows that were inserted.
  6. \n
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L165" + } + ], + "properties": [ + { + "name": "raw_connection", + "signature": "st.connections.raw_connection.raw_connection", + "example": "

The following example uses a cursor to submit an asynchronous query,\nsaves the query ID, then periodically checks the query status through\nthe connection before retrieving the results.

\n
\nimport streamlit as st\nimport time\n\nconn = st.connection("snowflake")\ncur = conn.cursor()\ncur.execute_async("SELECT * FROM my_table")\nquery_id = cur.sfqid\nwhile True:\n    status = conn.raw_connection.get_query_status(query_id)\n    if conn.raw_connection.is_still_running(status):\n        time.sleep(1)\n    else:\n        break\ncur.get_results_from_sfqid(query_id)\ndf = cur.fetchall()\n
\n", + "description": "

Access the underlying connection object from the Snowflake Connector for Python.

", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.connection.SnowflakeConnection", + "is_generator": false, + "description": "

The connection object.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L280" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L362", + "examples": "

Example 1: Configuration with Streamlit secrets

\n

You can configure your Snowflake connection using Streamlit's\nSecrets management.\nFor example, if you have MFA enabled on your account, you can connect using\nkey-pair authentication.

\n
\n[connections.snowflake]\naccount = "xxx-xxx"\nuser = "xxx"\nprivate_key_file = "/xxx/xxx/xxx.p8"\nrole = "xxx"\nwarehouse = "xxx"\ndatabase = "xxx"\nschema = "xxx"\n
\n
\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\n
\n

Example 2: Configuration with keyword arguments and external authentication

\n

You can configure your Snowflake connection with keyword arguments. The\nkeyword arguments are merged with (and take precedence over) the values in\nsecrets.toml. However, if you name your connection "snowflake" and\ndon't have a [connections.snowflake] dictionary in your\nsecrets.toml file, Streamlit will ignore any keyword arguments and use\nthe default Snowflake connection as described in Example 5 and Example 6.\nTo configure your connection using only keyword arguments, declare a name\nfor the connection other than "snowflake".

\n

For example, if your Snowflake account supports SSO, you can set up a quick\nlocal connection for development using browser-based SSO.\nBecause there is nothing configured in secrets.toml, the name is an\nempty string and the type is set to "snowflake". This prevents\nStreamlit from ignoring the keyword arguments and using a default\nSnowflake connection.

\n
\nimport streamlit as st\n\nconn = st.connection(\n    "",\n    type="snowflake",\n    account="xxx-xxx",\n    user="xxx",\n    authenticator="externalbrowser",\n)\ndf = conn.query("SELECT * FROM my_table")\n
\n

Example 3: Named connection with Snowflake's connection configuration file

\n

Snowflake's Python Connector supports a connection configuration file,\nwhich is well integrated with Streamlit's SnowflakeConnection. If you\nalready have one or more connections configured, you can pass the name of\nthe connection to use. When you use a custom name with no\n[connections.<name>] Streamlit secrets and no connection keyword\narguments, Streamlit passes the name to Snowflake's Python Connector as\nconnection_name.

\n
\n[my_connection]\naccount = "xxx-xxx"\nuser = "xxx"\npassword = "xxx"\nwarehouse = "xxx"\ndatabase = "xxx"\nschema = "xxx"\n
\n
\nimport streamlit as st\n\nconn = st.connection("my_connection", type="snowflake")\ndf = conn.query("SELECT * FROM my_table")\n
\n

Snowflake's CLI uses [connections.my_connection] sections in\nconfig.toml. The shared connections.toml file used by the Python\nConnector omits the connections. prefix, as shown above.

\n

Example 4: Named connection with Streamlit secrets and Snowflake's connection configuration file

\n

If you have a Snowflake configuration file with a connection named\nmy_connection as in Example 3, you can pass the connection name through\nsecrets.toml.

\n
\n[connections.snowflake]\nconnection_name = "my_connection"\n
\n
\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\n
\n

Example 5: Default connection with an environment variable

\n

If you don't have a [connections.snowflake] dictionary in your\nsecrets.toml file and use st.connection("snowflake"), Streamlit\nwill use the default connection for the Snowflake Python Connector.

\n

If you have a Snowflake configuration file with a connection named\nmy_connection as in Example 3, you can set an environment variable to\ndeclare it as the default Snowflake connection.

\n
\nexport SNOWFLAKE_DEFAULT_CONNECTION_NAME="my_connection"\n
\n
\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\n
\n

Example 6: Default connection in Snowflake's connection configuration file

\n

If you have a Snowflake configuration file that defines your default\nconnection, Streamlit will automatically use it if no other connection is\ndeclared.

\n
\n[default]\naccount = "xxx-xxx"\nuser = "xxx"\npassword = "xxx"\nwarehouse = "xxx"\ndatabase = "xxx"\nschema = "xxx"\n
\n
\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\n
\n

Example 7: Caller's rights connection when running in Snowpark Container Services

\n

You can use "snowflake-callers-rights" type connections in any\nenvironment running on Snowpark Container Services, including Streamlit in\nSnowflake on containers and any self-managed caller's rights Service.

\n

This will use the Snowpark-provided account, host, database, and schema to connect.\nAdditionally, it will set client_session_keep_alive to True. These values\nmay be overridden with **kwargs in st.connection. For a complete list\nof keyword arguments, see the documentation for snowflake.connector.connect().

\n
\nimport streamlit as st\n\nconn = st.connection("snowflake-callers-rights")\ndf = conn.query("SELECT * FROM my_table")\n
\n

If you want to develop locally with a caller's rights connection, use an\nenvironment variable to logically switch between a "snowflake"\nconnection locally and a "snowflake-callers-rights" connection in\nSnowpark Container Services.

\n
\nimport streamlit as st\n\nconn = (\n    st.connection("snowflake")\n    if "LOCAL_DEVELOPMENT" in st.secrets and st.secrets["LOCAL_DEVELOPMENT"]\n    else st.connection("snowflake-callers-rights")\n)\ndf = conn.query("SELECT * FROM my_table")\n
\n", + "description": "

A connection to Snowflake using the Snowflake Connector for Python.

\n

For standard connections, create an instance of this using\nst.connection("snowflake") or\nst.connection("<name>", type="snowflake"). Connection parameters for a\nSnowflakeConnection can be specified using secrets.toml and/or\n**kwargs. Connection parameters are passed to\nsnowflake.connector.connect().

\n

When an app is running in Streamlit in Snowflake,\nst.connection("snowflake") connects automatically using the app owner's\nrole without further configuration. **kwargs are ignored in this\ncase. Use secrets.toml and **kwargs to configure your connection\nfor local development.

\n

When an app is running in Snowpark Container Services and has caller's rights\nenabled, st.connection("snowflake-callers-rights") connects automatically\nusing the current user's identity tokens. This is a session-scoped connection\nto ensure that the identity stays tied to the active user. Unlike with\n"snowflake" connections, it will use the Snowpark Container Services\nconnection settings even when other **kwargs are provided.

\n

The Snowflake connection includes several convenience methods. For example, you\ncan directly execute a SQL query with .query() or access the underlying\nSnowflake Connector object with .raw_connection.

\n
\n

Important

\n
    \n
  • snowflake-snowpark-python\nmust be installed in your environment to use this connection. You can\ninstall it as an extra with Streamlit:

    \n
    \npip install streamlit[snowflake]\n
    \n
  • \n
  • Account identifiers must be of the form <orgname>-<account_name>\nwhere <orgname> is the name of your Snowflake organization and\n<account_name> is the unique name of your account within your\norganization. This is dash-separated, not dot-separated like when used\nin SQL queries. For more information, see Account identifiers.

    \n
  • \n
  • Caller's rights connections rely on credentials provided when a user first\nconnects to a Streamlit app. These credentials are only valid for about\ntwo minutes. Therefore, caller's rights connections must be created at\nthe top of an app or else the connection may fail.

    \n
  • \n
  • To develop locally with a caller's rights connection, use an\nenvironment variable to logically switch between a "snowflake"\nconnection locally and a "snowflake-callers-rights" connection in\nSnowpark Container Services.

    \n
  • \n
\n
\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SQLConnection.close": { + "name": "close", + "signature": "SQLConnection.close()", + "description": "

A function to invoke when this connection needs to be cleaned up.

\n

close is registered as an on_release hook in the resource cache when a\nconnection is created with st.connection.

\n", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L201" + }, + "streamlit.connections.SQLConnection.connect": { + "name": "connect", + "signature": "SQLConnection.connect()", + "description": "

Call .connect() on the underlying SQLAlchemy Engine, returning a new connection object.

\n

Calling this method is equivalent to calling self._instance.connect().

\n

NOTE: This method should not be confused with the internal _connect method used\nto implement a Streamlit Connection.

\n", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.engine.Connection", + "is_generator": false, + "description": "

A new SQLAlchemy connection object.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L355" + }, + "streamlit.connections.SQLConnection.driver": { + "name": "driver", + "signature": "SQLConnection.driver", + "description": "

The name of the driver used by the underlying SQLAlchemy Engine.

\n

This is equivalent to accessing self._instance.driver.

\n", + "args": [], + "returns": [ + { + "type_name": "str", + "is_generator": false, + "description": "

The name of the driver. For example, "pyodbc" or "psycopg2".

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L384" + }, + "streamlit.connections.SQLConnection.engine": { + "name": "engine", + "signature": "SQLConnection.engine", + "description": "

The underlying SQLAlchemy Engine.

\n

This is equivalent to accessing self._instance.

\n", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.engine.base.Engine", + "is_generator": false, + "description": "

The underlying SQLAlchemy Engine.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L371" + }, + "streamlit.connections.SQLConnection.query": { + "name": "query", + "signature": "SQLConnection.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", + "example": "
\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query(\n    "SELECT * FROM pet_owners WHERE owner = :owner",\n    ttl=3600,\n    params={"owner": "barbara"},\n)\nst.dataframe(df)\n
\n", + "description": "

Run a read-only query.

\n

This method implements query result caching and simple error\nhandling/retries. The caching behavior is identical to that of using\n@st.cache_data.

\n
\n

Note

\n

Queries that are run without a specified ttl are cached indefinitely.

\n
\n

All keyword arguments passed to this function are passed down to\npandas.read_sql, except ttl.

\n", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The read-only SQL query to execute.

\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Enable the spinner. The default is to show a spinner when there is a\n"cache miss" and the cached resource is being created. If a string, the value\nof the show_spinner param will be used for the spinner text.

\n", + "default": "to" + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.

\n", + "default": "None" + }, + { + "name": "index_col", + "type_name": "str, list of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Column(s) to set as index(MultiIndex). Default is None.

\n", + "default": "None" + }, + { + "name": "chunksize", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.

\n", + "default": "None" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in PEP 249\nparamstyle, is supported.\nDefault is None.

\n", + "default": "None" + }, + { + "name": "**kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Additional keyword arguments are passed to pandas.read_sql.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L224" + }, + "streamlit.connections.SQLConnection.reset": { + "name": "reset", + "signature": "SQLConnection.reset()", + "examples": "
\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L130" + }, + "streamlit.connections.SQLConnection.scope": { + "name": "scope", + "signature": "SQLConnection.scope(cls)", + "description": "

Returns the scope of this connection type.

\n

This is a class method. "global" connection instances will be cached\nglobally and are typically created once during the lifetime of an\napplication. "session" connection instances will be cached per\nsession and are typically created once per user session.

\n

A connection's scope can't be changed for different instances of the\nsame connection type. If you want to switch between global and\nsession-scoped connections, you should create two different connection\ntypes.

\n", + "args": [], + "returns": [ + { + "type_name": "\"global\" or \"session\"", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L181" + }, + "streamlit.connections.SQLConnection.session": { + "name": "session", + "signature": "SQLConnection.session", + "example": "
\nimport streamlit as st\nconn = st.connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n    with conn.session as session:\n        session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n        session.commit()\n
\n", + "description": "

A SQLAlchemy Session.

\n

Users of this connection should use the contextmanager pattern for writes,\ntransactions, and anything more complex than simple read queries.

\n

See the usage example below, which assumes we have a table numbers with a\nsingle integer column val. The SQLAlchemy docs also contain\nmuch more information on the usage of sessions.

\n", + "args": [], + "returns": [ + { + "type_name": "sqlalchemy.orm.Session", + "is_generator": false, + "description": "

A SQLAlchemy Session.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/sql_connection.py#L397" + }, + "streamlit.connections.SnowflakeConnection.close": { + "name": "close", + "signature": "SnowflakeConnection.close()", + "description": "

Closes the underlying Snowflake connection.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L355" + }, + "streamlit.connections.SnowflakeConnection.cursor": { + "name": "cursor", + "signature": "SnowflakeConnection.cursor()", + "example": "

The following example uses a cursor to insert multiple rows into a\ntable. The qmark parameter style is specified as an optional\nkeyword argument. Alternatively, the parameter style can be declared in\nyour connection configuration file. For more information, see the\nSnowflake Connector for Python documentation.

\n
\nimport streamlit as st\n\nconn = st.connection("snowflake", "paramstyle"="qmark")\nrows_to_insert = [("Mary", "dog"), ("John", "cat"), ("Robert", "bird")]\nconn.cursor().executemany(\n    "INSERT INTO mytable (name, pet) VALUES (?, ?)", rows_to_insert\n)\n
\n", + "description": "

Create a new cursor object from this connection.

\n

Snowflake Connector cursors implement the Python Database API v2.0\nspecification (PEP-249). For more information, see the\nSnowflake Connector for Python documentation.

\n", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.cursor.SnowflakeCursor", + "is_generator": false, + "description": "

A cursor object for the connection.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L247" + }, + "streamlit.connections.SnowflakeConnection.query": { + "name": "query", + "signature": "SnowflakeConnection.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)", + "example": "
\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("SELECT * FROM my_table")\nst.dataframe(df)\n
\n", + "description": "

Run a read-only SQL query.

\n

This method implements query result caching and simple error\nhandling/retries. The caching behavior is identical to that of using\n@st.cache_data.

\n
\n

Note

\n

Queries that are run without a specified ttl are cached\nindefinitely.

\n
\n", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The read-only SQL query to execute.

\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to keep results in the cache. If this\nis None (default), cached results do not expire with time.

\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to enable the spinner. When a cached query is executed, no\nspinner is displayed because the result is immediately available.\nWhen a new query is executed, the default is to show a spinner with\nthe message "Running snowflake.query(...)."

\n

If this is False, no spinner displays while executing the\nquery. If this is a string, the string will be used as the message\nfor the spinner.

\n", + "default": "to" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

List of parameters to pass to the Snowflake Connector for Python\nCursor.execute() method. This connector supports binding data\nto a SQL statement using qmark bindings. For more information and\nexamples, see the Snowflake Connector for Python documentation.\nThis defaults to None.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "

The result of running the query, formatted as a pandas DataFrame.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L66" + }, + "streamlit.connections.SnowflakeConnection.raw_connection": { + "name": "raw_connection", + "signature": "SnowflakeConnection.raw_connection", + "example": "

The following example uses a cursor to submit an asynchronous query,\nsaves the query ID, then periodically checks the query status through\nthe connection before retrieving the results.

\n
\nimport streamlit as st\nimport time\n\nconn = st.connection("snowflake")\ncur = conn.cursor()\ncur.execute_async("SELECT * FROM my_table")\nquery_id = cur.sfqid\nwhile True:\n    status = conn.raw_connection.get_query_status(query_id)\n    if conn.raw_connection.is_still_running(status):\n        time.sleep(1)\n    else:\n        break\ncur.get_results_from_sfqid(query_id)\ndf = cur.fetchall()\n
\n", + "description": "

Access the underlying connection object from the Snowflake Connector for Python.

\n

For information on how to use the Snowflake Connector for Python, see\nthe Snowflake Connector for Python documentation.

\n", + "args": [], + "returns": [ + { + "type_name": "snowflake.connector.connection.SnowflakeConnection", + "is_generator": false, + "description": "

The connection object.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L280" + }, + "streamlit.connections.SnowflakeConnection.reset": { + "name": "reset", + "signature": "SnowflakeConnection.reset()", + "examples": "
\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L130" + }, + "streamlit.connections.SnowflakeConnection.scope": { + "name": "scope", + "signature": "SnowflakeConnection.scope(cls)", + "description": "

Returns the scope of this connection type.

\n

This is a class method. "global" connection instances will be cached\nglobally and are typically created once during the lifetime of an\napplication. "session" connection instances will be cached per\nsession and are typically created once per user session.

\n

A connection's scope can't be changed for different instances of the\nsame connection type. If you want to switch between global and\nsession-scoped connections, you should create two different connection\ntypes.

\n", + "args": [], + "returns": [ + { + "type_name": "\"global\" or \"session\"", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L181" + }, + "streamlit.connections.SnowflakeConnection.session": { + "name": "session", + "signature": "SnowflakeConnection.session()", + "example": "

The following example creates a new Snowpark session and uses it to run\na query.

\n
\nimport streamlit as st\n\nconn = st.connection("snowflake")\nsession = conn.session()\ndf = session.sql("SELECT * FROM my_table").collect()\n
\n", + "description": "

Create a new Snowpark session from this connection.

\n

For information on how to use Snowpark sessions, see the\nSnowpark developer guide\nand Snowpark API Reference.

\n", + "args": [], + "returns": [ + { + "type_name": "snowflake.snowpark.Session", + "is_generator": false, + "description": "

A new Snowpark session for this connection.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L319" + }, + "streamlit.connections.SnowflakeConnection.write_pandas": { + "name": "write_pandas", + "signature": "SnowflakeConnection.write_pandas(df, table_name, database=None, schema=None, chunk_size=None, **kwargs)", + "example": "

The following example uses the database and schema currently in use in\nthe session and copies the data into a table named "my_table."

\n
\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n    {"Name": ["Mary", "John", "Robert"], "Pet": ["dog", "cat", "bird"]}\n)\nconn = st.connection("snowflake")\nconn.write_pandas(df, "my_table")\n
\n", + "description": "

Write a pandas.DataFrame to a table in a Snowflake database.

\n

This convenience method is a thin wrapper around\nsnowflake.connector.pandas_tools.write_pandas() using the\nunderlying connection. The conn parameter is passed automatically.\nFor more information and additional keyword arguments, see the\nSnowflake Connector for Python documentation.

\n", + "args": [ + { + "name": "df", + "type_name": "pandas.DataFrame", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The pandas.DataFrame object containing the data to be copied\ninto the table.

\n", + "default": null + }, + { + "name": "table_name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Name of the table where the data should be copied to.

\n", + "default": null + }, + { + "name": "database", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Name of the database containing the table. By default, the function\nwrites to the database that is currently in use in the session.

\n
\n

Note

\n

If you specify this parameter, you must also specify the schema\nparameter.

\n
\n", + "default": null + }, + { + "name": "schema", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Name of the schema containing the table. By default, the function\nwrites to the table in the schema that is currently in use in the\nsession.

\n", + "default": null + }, + { + "name": "chunk_size", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Number of elements to insert at a time. By default, the function\ninserts all elements in one chunk.

\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Additional keyword arguments for\nsnowflake.connector.pandas_tools.write_pandas().

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "tuple[bool, int, int]", + "is_generator": false, + "description": "

A tuple containing three values:

\n
    \n
  1. A boolean value that is True if the write was successful.
  2. \n
  3. An integer giving the number of chunks of data that were copied.
  4. \n
  5. An integer giving the number of rows that were inserted.
  6. \n
\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/snowflake_connection.py#L165" + }, + "streamlit.connections.BaseConnection.close": { + "name": "close", + "signature": "BaseConnection.close()", + "description": "

A function to invoke when this connection needs to be cleaned up.

\n

close is registered as an on_release hook in the resource cache when a\nconnection is created with st.connection.

\n", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L201" + }, + "streamlit.connections.BaseConnection.reset": { + "name": "reset", + "signature": "BaseConnection.reset()", + "examples": "
\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n    conn.reset()\n\n# Do stuff with conn...\n
\n", + "description": "

Reset this connection so that it gets reinitialized the next time it's used.

\n

This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use reset()\nin their error handling code.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L130" + }, + "streamlit.connections.BaseConnection.scope": { + "name": "scope", + "signature": "BaseConnection.scope(cls)", + "description": "

Returns the scope of this connection type.

\n

This is a class method. "global" connection instances will be cached\nglobally and are typically created once during the lifetime of an\napplication. "session" connection instances will be cached per\nsession and are typically created once per user session.

\n

A connection's scope can't be changed for different instances of the\nsame connection type. If you want to switch between global and\nsession-scoped connections, you should create two different connection\ntypes.

\n", + "args": [], + "returns": [ + { + "type_name": "\"global\" or \"session\"", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/connections/base_connection.py#L181" + }, + "streamlit.column_config.AreaChartColumn": { + "name": "AreaChartColumn", + "signature": "st.column_config.AreaChartColumn(label=None, *, width=None, help=None, pinned=None, y_min=None, y_max=None, color=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "sales": [\n            [0, 4, 26, 80, 100, 40],\n            [80, 20, 80, 35, 40, 100],\n            [10, 20, 80, 80, 70, 0],\n            [10, 100, 20, 100, 30, 100],\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "sales": st.column_config.AreaChartColumn(\n            "Sales (last 6 months)",\n            width="medium",\n            help="The sales volume in the last 6 months",\n            y_min=0,\n            y_max=100,\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure an area chart column in st.dataframe or st.data_editor.

\n

Cells need to contain a list of numbers. Chart columns are not editable\nat the moment. This command needs to be used in the column_config parameter\nof st.dataframe or st.data_editor.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "y_min", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the minimum of its data.

\n", + "default": null + }, + { + "name": "y_max", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the maximum of its data.

\n", + "default": null + }, + { + "name": "color", + "type_name": "\"auto\", \"auto-inverse\", str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color to use for the chart. This can be one of the following:

\n
    \n
  • None (default): The primary color is used.
  • \n
  • "auto": If the data is increasing, the chart is green; if the\ndata is decreasing, the chart is red.
  • \n
  • "auto-inverse": If the data is increasing, the chart is red; if\nthe data is decreasing, the chart is green.
  • \n
  • A single color value that is applied to all charts in the column.\nIn addition to the basic color palette (red, orange, yellow, green,\nblue, violet, gray/grey, and primary), this supports hex codes like\n"#483d8b".
  • \n
\n

The basic color palette can be configured in the theme settings.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L1527" + }, + "streamlit.column_config.AudioColumn": { + "name": "AudioColumn", + "signature": "st.column_config.AudioColumn(label=None, *, width=None, help=None, pinned=None, alignment=None)", + "examples": "

You can use publicly accessible URLs or Base64-encoded audio data. To show\nthe playback controls, double click a cell in the audio column.

\n
\nimport base64\nimport pandas as pd\nimport streamlit as st\n\n@st.cache_data\ndef load_audio_as_base64():\n    with open("cat-purr.mp3", "rb") as audio_file:\n        audio_bytes = audio_file.read()\n    return base64.b64encode(audio_bytes).decode("utf-8")\n\ndata_df = pd.DataFrame(\n    {\n        "source": [\n            "Small and fluffy house panther",\n            "Wikimedia, Performed by Muriel Nguyen Xuan and St\u00e9phane Magnenat",\n        ],\n        "audio": [\n            f"data:audio/mp3;base64,{load_audio_as_base64()}",\n            "https://upload.wikimedia.org/wikipedia/commons/c/c4/Muriel-Nguyen-Xuan-Chopin-valse-opus64-1.ogg",\n        ],\n    }\n)\n\nst.dataframe(\n    data_df,\n    column_config={\n        "audio": st.column_config.AudioColumn("Preview Audio"),\n    },\n)\n
\n", + "description": "

Configure an audio column in st.dataframe or st.data_editor.

\n

Audio columns display an icon. When a user double clicks the icon in a cell,\nStreamlit displays playback controls. To play an audio file, a cell must have\none of the following values:

\n
    \n
  • A URL to fetch the audio from. If you use static file serving, the\nURL can be relative to your app's URL. Otherwise, the URL must be fully qualified with\na scheme, like "https://example.com/my_audio.mp3".

    \n

    Paths to local audio files aren't supported.

    \n
  • \n
  • A data URL containing a Base64-encoded audio like "data:audio/mp3;base64,//uQ...".

    \n
  • \n
\n

Audio columns aren't editable at this time. This command must be used in the\ncolumn_config parameter of st.dataframe or st.data_editor.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), audio icons are center-aligned.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L1762" + }, + "streamlit.column_config.BarChartColumn": { + "name": "BarChartColumn", + "signature": "st.column_config.BarChartColumn(label=None, *, width=None, help=None, pinned=None, y_min=None, y_max=None, color=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "sales": [\n            [0, 4, 26, 80, 100, 40],\n            [80, 20, 80, 35, 40, 100],\n            [10, 20, 80, 80, 70, 0],\n            [10, 100, 20, 100, 30, 100],\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "sales": st.column_config.BarChartColumn(\n            "Sales (last 6 months)",\n            help="The sales volume in the last 6 months",\n            y_min=0,\n            y_max=100,\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a bar chart column in st.dataframe or st.data_editor.

\n

Cells need to contain a list of numbers. Chart columns are not editable\nat the moment. This command needs to be used in the column_config parameter\nof st.dataframe or st.data_editor.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "y_min", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the minimum of its data.

\n", + "default": null + }, + { + "name": "y_max", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the maximum of its data.

\n", + "default": null + }, + { + "name": "color", + "type_name": "\"auto\", \"auto-inverse\", str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color to use for the chart. This can be one of the following:

\n
    \n
  • None (default): The primary color is used.
  • \n
  • "auto": If the data is increasing, the chart is green; if the\ndata is decreasing, the chart is red.
  • \n
  • "auto-inverse": If the data is increasing, the chart is red; if\nthe data is decreasing, the chart is green.
  • \n
  • A single color value that is applied to all charts in the column.\nIn addition to the basic color palette (red, orange, yellow, green,\nblue, violet, gray/grey, and primary), this supports hex codes like\n"#483d8b".
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L1282" + }, + "streamlit.column_config.ButtonColumn": { + "name": "ButtonColumn", + "signature": "st.column_config.ButtonColumn(label=None, *, width=None, help=None, pinned=None, alignment=None, type=\"secondary\", on_click=None, args=None, kwargs=None, key=None)", + "examples": "

Example 1: Basic button column with callback

\n
\nimport pandas as pd\nimport streamlit as st\n\ndf = pd.DataFrame(\n    {\n        "name": ["Alice", "Bob", "Charlie"],\n        "view": [":material/visibility: View"] * 3,\n    }\n)\n\ndef handle_view():\n    click = st.session_state.view_click\n    st.toast(f"Viewing row {click['row']}: {df.iloc[click['row']]['name']}")\n\nst.dataframe(\n    df,\n    column_config={\n        "view": st.column_config.ButtonColumn(\n            "", type="tertiary", on_click=handle_view, key="view_click"\n        ),\n    },\n    hide_index=True,\n)\n
\n

Example 2: Multi-action dropdown

\n
\nimport pandas as pd\nimport streamlit as st\n\ndf = pd.DataFrame(\n    {\n        "name": ["Alice", "Bob", "Charlie"],\n        "actions": [\n            [":material/edit: Edit", ":material/delete: Delete"],\n            [":material/edit: Edit", ":material/delete: Delete"],\n            [":material/edit: Edit"],\n        ],\n    }\n)\n\ndef handle_action():\n    click = st.session_state.action_click\n    if "Delete" in click["label"]:\n        st.warning(f"Deleting row {click['row']}")\n    elif "Edit" in click["label"]:\n        st.info(f"Editing row {click['row']}")\n\nst.dataframe(\n    df,\n    column_config={\n        "actions": st.column_config.ButtonColumn(\n            "Actions", on_click=handle_action, key="action_click"\n        ),\n    },\n)\n
\n
\n

Note

\n

Button columns are always read-only. In st.data_editor, the underlying\ncell values cannot be edited, but button clicks still trigger callbacks.

\n
\n", + "description": "

Configure a button column in st.dataframe or st.data_editor.

\n

Button columns display clickable buttons in each cell, enabling row-level\nactions with Python callbacks. The cell values determine the button labels.\nThis command needs to be used in the column_config parameter of\nst.dataframe or st.data_editor. Button columns are always read-only\u2014\nin st.data_editor, the underlying cell values cannot be edited, but\nbutton clicks still trigger callbacks.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of the button within the cell. If this is\nNone (default), buttons are centered.

\n", + "default": null + }, + { + "name": "type", + "type_name": "\"primary\", \"secondary\", or \"tertiary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional string that specifies the button type. This can be one of\nthe following:

\n
    \n
  • "primary": The button's background is the app's primary color\nfor additional emphasis.
  • \n
  • "secondary" (default): The button's background coordinates\nwith the app's background color for normal emphasis.
  • \n
  • "tertiary": The button is plain text without a border or\nbackground for subtlety.
  • \n
\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional callback invoked when a button is clicked. By default, the\ncallback receives no arguments. Use args and kwargs to pass\nextra arguments. The click information is also available in\nst.session_state[key] during the callback.

\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional tuple of args to pass to the callback.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the callback.

\n", + "default": null + }, + { + "name": "key", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A session state key for the click trigger value. When a button is\nclicked, the click information is stored under this key in Session\nState as a ButtonColumnClickState object with row (int) and\nlabel (str) entries that support both key and attribute notation.\nFor example, if key="my_click", you can access the clicked row with\nst.session_state.my_click.row or\nst.session_state["my_click"]["row"]. The value is only present\nduring the rerun triggered by the click; it resets to None on\nsubsequent reruns. To use ButtonColumnClickState in an annotation,\nimport it from streamlit.typing.

\n

key is required to enable button clicks and callbacks.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L3287" + }, + "streamlit.column_config.CheckboxColumn": { + "name": "CheckboxColumn", + "signature": "st.column_config.CheckboxColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, alignment=None, default=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "widgets": [\n            "st.selectbox",\n            "st.number_input",\n            "st.text_area",\n            "st.button",\n        ],\n        "favorite": [True, False, False, True],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "favorite": st.column_config.CheckboxColumn(\n            "Your favorite?",\n            help="Select your **favorite** widgets",\n            default=False,\n        )\n    },\n    disabled=["widgets"],\n    hide_index=True,\n)\n
\n", + "description": "

Configure a checkbox column in st.dataframe or st.data_editor.

\n

This is the default column type for boolean values. This command needs to be used in\nthe column_config parameter of st.dataframe or st.data_editor.\nWhen used with st.data_editor, editing will be enabled with a checkbox widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), checkboxes are center-aligned.

\n", + "default": null + }, + { + "name": "default", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L1008" + }, + "streamlit.column_config.Column": { + "name": "Column", + "signature": "st.column_config.Column(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, alignment=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "widgets": [\n            "st.selectbox",\n            "st.number_input",\n            "st.text_area",\n            "st.button",\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "widgets": st.column_config.Column(\n            "Streamlit Widgets",\n            help="Streamlit **widget** commands \ud83c\udf88",\n            width="medium",\n            required=True,\n        )\n    },\n    hide_index=True,\n    num_rows="dynamic",\n)\n
\n", + "description": "

Configure a generic column in st.dataframe or st.data_editor.

\n

The type of the column will be automatically inferred from the data type.\nThis command needs to be used in the column_config parameter of st.dataframe\nor st.data_editor.

\n

To change the type of the column and enable type-specific configuration options,\nuse one of the column types in the st.column_config namespace,\ne.g. st.column_config.NumberColumn.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), the alignment depends on the column type (e.g., numbers\nare right-aligned, text is left-aligned).

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L392" + }, + "streamlit.column_config.DateColumn": { + "name": "DateColumn", + "signature": "st.column_config.DateColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, alignment=None, default=None, format=None, min_value=None, max_value=None, step=None)", + "examples": "
\nfrom datetime import date\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "birthday": [\n            date(1980, 1, 1),\n            date(1990, 5, 3),\n            date(1974, 5, 19),\n            date(2001, 8, 17),\n        ]\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "birthday": st.column_config.DateColumn(\n            "Birthday",\n            min_value=date(1900, 1, 1),\n            max_value=date(2005, 1, 1),\n            format="DD.MM.YYYY",\n            step=1,\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a date column in st.dataframe or st.data_editor.

\n

This is the default column type for date values. This command needs to be used in\nthe column_config parameter of st.dataframe or st.data_editor. When used\nwith st.data_editor, editing will be enabled with a date picker widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), dates are left-aligned.

\n", + "default": null + }, + { + "name": "default", + "type_name": "datetime.date or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str, \"localized\", \"distance\", \"iso8601\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A format string controlling how dates are displayed.\nThis can be one of the following values:

\n
    \n
  • None (default): Show the date in "YYYY-MM-DD" format (e.g.\n"2025-03-04").
  • \n
  • "localized": Show the date in the default locale format (e.g.\n"Mar 4, 2025" in the America/Los_Angeles timezone).
  • \n
  • "distance": Show the date in a relative format (e.g.\n"a few seconds ago").
  • \n
  • "iso8601": Show the date in ISO 8601 format (e.g.\n"2025-03-04").
  • \n
  • A momentJS format string: Format the date with a string, like\n"ddd, MMM Do" to show "Tue, Mar 4th". For available formats, see\nmomentJS.
  • \n
\n

Formatting from column_config always takes precedence over\nformatting from pandas.Styler. The formatting does not impact the\nreturn value when used in st.data_editor.

\n", + "default": "locale" + }, + { + "name": "min_value", + "type_name": "datetime.date or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum date that can be entered. If this is None (default),\nthere will be no minimum.

\n", + "default": null + }, + { + "name": "max_value", + "type_name": "datetime.date or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum date that can be entered. If this is None (default),\nthere will be no maximum.

\n", + "default": null + }, + { + "name": "step", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The stepping interval in days. If this is None (default), the step\nwill be 1 day.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L2704" + }, + "streamlit.column_config.DatetimeColumn": { + "name": "DatetimeColumn", + "signature": "st.column_config.DatetimeColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, alignment=None, default=None, format=None, min_value=None, max_value=None, step=None, timezone=None)", + "examples": "
\nfrom datetime import datetime\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "appointment": [\n            datetime(2024, 2, 5, 12, 30),\n            datetime(2023, 11, 10, 18, 0),\n            datetime(2024, 3, 11, 20, 10),\n            datetime(2023, 9, 12, 3, 0),\n        ]\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "appointment": st.column_config.DatetimeColumn(\n            "Appointment",\n            min_value=datetime(2023, 6, 1),\n            max_value=datetime(2025, 1, 1),\n            format="D MMM YYYY, h:mm a",\n            step=60,\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a datetime column in st.dataframe or st.data_editor.

\n

This is the default column type for datetime values. This command needs to be\nused in the column_config parameter of st.dataframe or\nst.data_editor. When used with st.data_editor, editing will be enabled\nwith a datetime picker widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), datetimes are left-aligned.

\n", + "default": null + }, + { + "name": "default", + "type_name": "datetime.datetime or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str, \"localized\", \"distance\", \"calendar\", \"iso8601\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A format string controlling how datetimes are displayed.\nThis can be one of the following values:

\n
    \n
  • None (default): Show the datetime in "YYYY-MM-DD HH:mm:ss"\nformat (e.g. "2025-03-04 20:00:00").
  • \n
  • "localized": Show the datetime in the default locale format (e.g.\n"Mar 4, 2025, 12:00:00 PM" in the America/Los_Angeles timezone).
  • \n
  • "distance": Show the datetime in a relative format (e.g.\n"a few seconds ago").
  • \n
  • "calendar": Show the datetime in a calendar format (e.g.\n"Today at 8:00 PM").
  • \n
  • "iso8601": Show the datetime in ISO 8601 format (e.g.\n"2025-03-04T20:00:00.000Z").
  • \n
  • A momentJS format string: Format the datetime with a string, like\n"ddd ha" to show "Tue 8pm". For available formats, see\nmomentJS.
  • \n
\n

Formatting from column_config always takes precedence over\nformatting from pandas.Styler. The formatting does not impact the\nreturn value when used in st.data_editor.

\n", + "default": "locale" + }, + { + "name": "min_value", + "type_name": "datetime.datetime or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum datetime that can be entered. If this is None\n(default), there will be no minimum.

\n", + "default": null + }, + { + "name": "max_value", + "type_name": "datetime.datetime or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum datetime that can be entered. If this is None\n(default), there will be no maximum.

\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, datetime.timedelta, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The stepping interval in seconds. If this is None (default), the\nstep will be 1 second.

\n", + "default": null + }, + { + "name": "timezone", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The timezone of this column. If this is None (default), the\ntimezone is inferred from the underlying data.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L2361" + }, + "streamlit.column_config.ImageColumn": { + "name": "ImageColumn", + "signature": "st.column_config.ImageColumn(label=None, *, width=None, help=None, pinned=None, alignment=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "apps": [\n            "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/5435b8cb-6c6c-490b-9608-799b543655d3/Home_Page.png",\n            "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/ef9a7627-13f2-47e5-8f65-3f69bb38a5c2/Home_Page.png",\n            "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/31b99099-8eae-4ff8-aa89-042895ed3843/Home_Page.png",\n            "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/6a399b09-241e-4ae7-a31f-7640dc1d181e/Home_Page.png",\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "apps": st.column_config.ImageColumn(\n            "Preview Image", help="Streamlit app preview screenshots"\n        )\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure an image column in st.dataframe or st.data_editor.

\n

Image columns display an inline thumbnail. When a user double clicks a\nthumbnail in a cell, Streamlit displays a larger image. To display an\nimage, a cell must have one of the following values:

\n
    \n
  • A URL to fetch the image from. If you use static file serving, the\nURL can be relative to your app's URL. Otherwise, the URL must be fully qualified with\na scheme, like "https://example.com/my_image.jpg".

    \n

    Paths to local image files aren't supported.

    \n
  • \n
  • A data URL containing an SVG XML like "data:image/svg+xml;utf8,<svg xmlns=...</svg>".

    \n
  • \n
  • A data URL containing a Base64 encoded image like "data:image/png;base64,iVBO...".

    \n
  • \n
\n

Image columns aren't editable at this time. This command must be used in the\ncolumn_config parameter of st.dataframe or st.data_editor.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), images are center-aligned.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L1652" + }, + "streamlit.column_config.JsonColumn": { + "name": "JsonColumn", + "signature": "st.column_config.JsonColumn(label=None, *, width=None, help=None, pinned=None, alignment=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "json": [\n            {"foo": "bar", "bar": "baz"},\n            {"foo": "baz", "bar": "qux"},\n            {"foo": "qux", "bar": "foo"},\n            None,\n        ],\n    }\n)\n\nst.dataframe(\n    data_df,\n    column_config={\n        "json": st.column_config.JsonColumn(\n            "JSON Data",\n            help="JSON strings or objects",\n            width="large",\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a JSON column in st.dataframe or st.data_editor.

\n

Cells need to contain JSON strings or JSON-compatible objects. JSON columns\nare not editable at the moment. This command needs to be used in the\ncolumn_config parameter of st.dataframe or st.data_editor.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), JSON content is left-aligned.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L3032" + }, + "streamlit.column_config.LineChartColumn": { + "name": "LineChartColumn", + "signature": "st.column_config.LineChartColumn(label=None, *, width=None, help=None, pinned=None, y_min=None, y_max=None, color=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "sales": [\n            [0, 4, 26, 80, 100, 40],\n            [80, 20, 80, 35, 40, 100],\n            [10, 20, 80, 80, 70, 0],\n            [10, 100, 20, 100, 30, 100],\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "sales": st.column_config.LineChartColumn(\n            "Sales (last 6 months)",\n            width="medium",\n            help="The sales volume in the last 6 months",\n            y_min=0,\n            y_max=100,\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a line chart column in st.dataframe or st.data_editor.

\n

Cells need to contain a list of numbers. Chart columns are not editable\nat the moment. This command needs to be used in the column_config parameter\nof st.dataframe or st.data_editor.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "y_min", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the minimum of its data.

\n", + "default": null + }, + { + "name": "y_max", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum value on the y-axis for all cells in the column. If this is\nNone (default), every cell will use the maximum of its data.

\n", + "default": null + }, + { + "name": "color", + "type_name": "\"auto\", \"auto-inverse\", str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color to use for the chart. This can be one of the following:

\n
    \n
  • None (default): The primary color is used.
  • \n
  • "auto": If the data is increasing, the chart is green; if the\ndata is decreasing, the chart is red.
  • \n
  • "auto-inverse": If the data is increasing, the chart is red; if\nthe data is decreasing, the chart is green.
  • \n
  • A single color value that is applied to all charts in the column.\nIn addition to the basic color palette (red, orange, yellow, green,\nblue, violet, gray/grey, and primary), this supports hex codes like\n"#483d8b".
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L1405" + }, + "streamlit.column_config.LinkColumn": { + "name": "LinkColumn", + "signature": "st.column_config.LinkColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, alignment=None, default=None, max_chars=None, validate=None, display_text=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "apps": [\n            "https://roadmap.streamlit.app",\n            "https://extras.streamlit.app",\n            "https://issues.streamlit.app",\n            "https://30days.streamlit.app",\n        ],\n        "creator": [\n            "https://github.com/streamlit",\n            "https://github.com/arnaudmiribel",\n            "https://github.com/streamlit",\n            "https://github.com/streamlit",\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "apps": st.column_config.LinkColumn(\n            "Trending apps",\n            help="The top trending Streamlit apps",\n            validate=r"^https://[a-z]+\\.streamlit\\.app$",\n            max_chars=100,\n            display_text=r"https://(.*?)\\.streamlit\\.app",\n        ),\n        "creator": st.column_config.LinkColumn(\n            "App Creator", display_text="Open profile"\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a link column in st.dataframe or st.data_editor.

\n

The cell values need to be string and will be shown as clickable links.\nThis command needs to be used in the column_config parameter of st.dataframe\nor st.data_editor. When used with st.data_editor, editing will be enabled\nwith a text input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), links without display_text are left-aligned, while links\nwith display_text (including icon-only links) are center-aligned.

\n", + "default": null + }, + { + "name": "default", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of characters that can be entered. If this is\nNone (default), there will be no maximum.

\n", + "default": null + }, + { + "name": "validate", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A JS-flavored regular expression (e.g. "^https://.+$") that edited\nvalues are validated against. If the user input is invalid, it will not\nbe submitted.

\n", + "default": null + }, + { + "name": "display_text", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The text that is displayed in the cell. This can be one of the\nfollowing:

\n
    \n
  • None (default) to display the URL itself.
  • \n
  • A string that is displayed in every cell, e.g. "Open link".
  • \n
  • A Material icon that is displayed in every cell, e.g. ":material/open_in_new:".
  • \n
  • A JS-flavored regular expression (detected by usage of parentheses)\nto extract a part of the URL via a capture group. For example, use\n"https://(.*?)\\.example\\.com" to extract the display text\n"foo" from the URL "https://foo.example.com".
  • \n
\n\n

For more complex cases, you may use Pandas Styler's format\nfunction on the underlying dataframe. Note that this makes the app slow,\ndoesn't work with editable columns, and might be removed in the future.\nText formatting from column_config always takes precedence over\ntext formatting from pandas.Styler.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L832" + }, + "streamlit.column_config.ListColumn": { + "name": "ListColumn", + "signature": "st.column_config.ListColumn(label=None, *, width=None, help=None, pinned=None, disabled=None, required=None, default=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "sales": [\n            [0, 4, 26, 80, 100, 40],\n            [80, 20, 80, 35, 40, 100],\n            [10, 20, 80, 80, 70, 0],\n            [10, 100, 20, 100, 30, 100],\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "sales": st.column_config.ListColumn(\n            "Sales (last 6 months)",\n            help="The sales volume in the last 6 months",\n            width="medium",\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a list column in st.dataframe or st.data_editor.

\n

This is the default column type for list-like values. This command needs to\nbe used in the column_config parameter of st.dataframe or\nst.data_editor. When used with st.data_editor, users can freely\ntype in new options and remove existing ones.

\n
\n

Note

\n

Editing for non-string or mixed type lists can cause issues with Arrow\nserialization. We recommend that you disable editing for these columns\nor convert all list values to strings.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "default", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L1992" + }, + "streamlit.column_config.MarkdownColumn": { + "name": "MarkdownColumn", + "signature": "st.column_config.MarkdownColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, alignment=None, default=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "description": [\n            "# Title\\\\n\\\\nThis is **bold** text",\n            "## Subtitle\\\\n\\\\n- Item 1\\\\n- Item 2",\n            "Regular text with `code`",\n        ],\n    }\n)\n\nst.dataframe(\n    data_df,\n    column_config={\n        "description": st.column_config.MarkdownColumn(\n            "Description",\n            help="Markdown formatted text",\n            width="large",\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a markdown column in st.dataframe or st.data_editor.

\n

This column type displays cell values as plain text within the table cells.\nWhen a cell is clicked, the content is shown in an overlay where the markdown\nis rendered. The overlay supports the same Markdown directives as described\nin the body parameter of st.markdown. This command needs to be used\nin the column_config parameter of st.dataframe or st.data_editor.\nWhen used with st.data_editor, editing will be enabled through a text\neditor overlay.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), text is left-aligned.

\n", + "default": null + }, + { + "name": "default", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L3130" + }, + "streamlit.column_config.MultiselectColumn": { + "name": "MultiselectColumn", + "signature": "st.column_config.MultiselectColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, options=None, accept_new_options=None, color=None, format_func=None)", + "examples": "

Example 1: Editable multiselect column

\n

To customize the label colors, provide a list of colors to the color\nparameter. You can also format the option labels with the format_func\nparameter.

\n
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "category": [\n            ["exploration", "visualization"],\n            ["llm", "visualization"],\n            ["exploration"],\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "category": st.column_config.MultiselectColumn(\n            "App Categories",\n            help="The categories of the app",\n            options=[\n                "exploration",\n                "visualization",\n                "llm",\n            ],\n            color=["#ffa421", "#803df5", "#00c0f2"],\n            format_func=lambda x: x.capitalize(),\n        ),\n    },\n)\n
\n

Example 2: Colored tags for st.dataframe

\n

When using st.dataframe, the multiselect column is read-only\nand can be used to display colored tags. In this example, the dataframe\nuses the primary theme color for all tags.

\n
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "category": [\n            ["exploration", "visualization"],\n            ["llm", "visualization"],\n            ["exploration"],\n        ],\n    }\n)\n\nst.dataframe(\n    data_df,\n    column_config={\n        "category": st.column_config.MultiselectColumn(\n            "App Categories",\n            options=["exploration", "visualization", "llm"],\n            color="primary",\n            format_func=lambda x: x.capitalize(),\n        ),\n    },\n)\n
\n", + "description": "

Configure a multiselect column in st.dataframe or st.data_editor.

\n

This command needs to be used in the column_config parameter of\nst.dataframe or st.data_editor. When used with st.data_editor,\nusers can select options from a dropdown menu. You can configure the\ncolumn to allow freely typed options, too.

\n

You can also use this column type to display colored labels in a read-only\nst.dataframe.

\n
\n

Note

\n

Editing for non-string or mixed type lists can cause issues with Arrow\nserialization. We recommend that you disable editing for these columns\nor convert all list values to strings.

\n
\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If None (default),\nthe column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. Defaults to False.

\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.

\n", + "default": "False" + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "default", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by the user.

\n", + "default": "value" + }, + { + "name": "options", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The options that can be selected during editing.

\n", + "default": null + }, + { + "name": "accept_new_options", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the user can add selections that aren't included in options.\nIf this is False (default), the user can only select from the\nitems in options. If this is True, the user can enter new\nitems that don't exist in options.

\n

When a user enters and selects a new item, it is included in the\nreturned cell list value as a string. The new item is not added to\nthe options drop-down menu.

\n", + "default": null + }, + { + "name": "color", + "type_name": "str, Iterable of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color to use for different options. This can be:

\n
    \n
  • None (default): The options are displayed without color.

    \n
  • \n
  • "auto": The options are colored based on the configured categorical chart colors.

    \n
  • \n
  • A single color value that is used for all options. This can be one of\nthe following strings:

    \n
    \n
      \n
    • "primary" to use the primary theme color.
    • \n
    • A CSS named color name like "darkBlue" or "maroon".
    • \n
    • A hex color code like "#483d8b" or "#6A5ACD80".
    • \n
    • An RGB or RGBA color code like "rgb(255,0,0)" or\n"RGB(70, 130, 180, .7)".
    • \n
    • An HSL or HSLA color code like "hsl(248, 53%, 58%)"\nor "HSL(147, 50%, 47%, .3)".
    • \n
    \n
    \n
  • \n
  • An iterable of color values that are mapped to the options. The colors\nare applied in sequence, cycling through the iterable if there are\nmore options than colors.

    \n
  • \n
\n", + "default": null + }, + { + "name": "format_func", + "type_name": "function or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Function to modify the display of the options. It receives\nthe raw option defined in options as an argument and should output\nthe label to be shown for that option. When used in st.data_editor,\nthis has no impact on the returned value. If this is None\n(default), the raw option is used as the label.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L2114" + }, + "streamlit.column_config.NumberColumn": { + "name": "NumberColumn", + "signature": "st.column_config.NumberColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, alignment=None, default=None, format=None, min_value=None, max_value=None, step=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "price": [20, 950, 250, 500],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "price": st.column_config.NumberColumn(\n            "Price (in USD)",\n            help="The price of the product in USD",\n            min_value=0,\n            max_value=1000,\n            step=1,\n            format="$%d",\n        )\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a number column in st.dataframe or st.data_editor.

\n

This is the default column type for integer and float values. This command needs to\nbe used in the column_config parameter of st.dataframe or st.data_editor.\nWhen used with st.data_editor, editing will be enabled with a numeric input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), numbers are right-aligned. Some number-like types (e.g.,\ndurations) may use a different default alignment.

\n", + "default": "alignment" + }, + { + "name": "default", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str, \"plain\", \"localized\", \"percent\", \"dollar\", \"euro\", \"yen\", \"accounting\", \"compact\", \"scientific\", \"engineering\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A format string controlling how numbers are displayed.\nThis can be one of the following values:

\n
    \n
  • None (default): Streamlit infers the formatting from the data.
  • \n
  • "plain": Show the full number without any formatting (e.g. "1234.567").
  • \n
  • "localized": Show the number in the default locale format (e.g. "1,234.567").
  • \n
  • "percent": Show the number as a percentage (e.g. "123456.70%").
  • \n
  • "dollar": Show the number as a dollar amount (e.g. "$1,234.57").
  • \n
  • "euro": Show the number as a euro amount (e.g. "\u20ac1,234.57").
  • \n
  • "yen": Show the number as a yen amount (e.g. "\u00a51,235").
  • \n
  • "accounting": Show the number in an accounting format (e.g. "1,234.00").
  • \n
  • "bytes": Show the number in a byte format (e.g. "1.2KB").
  • \n
  • "compact": Show the number in a compact format (e.g. "1.2K").
  • \n
  • "scientific": Show the number in scientific notation (e.g. "1.235E3").
  • \n
  • "engineering": Show the number in engineering notation (e.g. "1.235E3").
  • \n
  • printf-style format string: Format the number with a printf\nspecifier, like "%d" to show a signed integer (e.g. "1234") or\n"%X" to show an unsigned hexadecimal integer (e.g. "4D2"). You\ncan also add prefixes and suffixes. To show British pounds, use\n"\u00a3 %.2f" (e.g. "\u00a3 1234.57"). Use , for thousand separators\n(e.g. "%,d" yields "1,234"). For more information, see\nsprintf-js.
  • \n
\n

Formatting from column_config always takes precedence over\nformatting from pandas.Styler. The formatting does not impact the\nreturn value when used in st.data_editor.

\n", + "default": "locale" + }, + { + "name": "min_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum value that can be entered. If this is None (default),\nthere will be no minimum.

\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum value that can be entered. If this is None (default),\nthere will be no maximum.

\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The precision of numbers that can be entered. If this None\n(default), integer columns will have a step of 1 and float columns will\nhave unrestricted precision. In this case, some floats may display like\nintegers. Setting step for float columns will ensure a consistent\nnumber of digits after the decimal are displayed.

\n

If format is a predefined format like "dollar", step\noverrides the display precision. If format is a printf-style format\nstring, step will not change the display precision.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L514" + }, + "streamlit.column_config.ProgressColumn": { + "name": "ProgressColumn", + "signature": "st.column_config.ProgressColumn(label=None, *, width=None, help=None, pinned=None, format=None, min_value=None, max_value=None, step=None, color=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "sales": [200, 550, 1000, 80],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "sales": st.column_config.ProgressColumn(\n            "Sales volume",\n            help="The sales volume in USD",\n            format="$%f",\n            min_value=0,\n            max_value=1000,\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a progress column in st.dataframe or st.data_editor.

\n

Cells need to contain a number. Progress columns are not editable at the moment.\nThis command needs to be used in the column_config parameter of st.dataframe\nor st.data_editor.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "format", + "type_name": "str, \"plain\", \"localized\", \"percent\", \"dollar\", \"euro\", \"yen\", \"accounting\", \"compact\", \"scientific\", \"engineering\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A format string controlling how the numbers are displayed.\nThis can be one of the following values:

\n
    \n
  • None (default): Streamlit infers the formatting from the data.
  • \n
  • "plain": Show the full number without any formatting (e.g. "1234.567").
  • \n
  • "localized": Show the number in the default locale format (e.g. "1,234.567").
  • \n
  • "percent": Show the number as a percentage (e.g. "123456.70%").
  • \n
  • "dollar": Show the number as a dollar amount (e.g. "$1,234.57").
  • \n
  • "euro": Show the number as a euro amount (e.g. "\u20ac1,234.57").
  • \n
  • "yen": Show the number as a yen amount (e.g. "\u00a51,235").
  • \n
  • "accounting": Show the number in an accounting format (e.g. "1,234.00").
  • \n
  • "bytes": Show the number in a byte format (e.g. "1.2KB").
  • \n
  • "compact": Show the number in a compact format (e.g. "1.2K").
  • \n
  • "scientific": Show the number in scientific notation (e.g. "1.235E3").
  • \n
  • "engineering": Show the number in engineering notation (e.g. "1.235E3").
  • \n
  • printf-style format string: Format the number with a printf\nspecifier, like "%d" to show a signed integer (e.g. "1234") or\n"%X" to show an unsigned hexadecimal integer (e.g. "4D2"). You\ncan also add prefixes and suffixes. To show British pounds, use\n"\u00a3 %.2f" (e.g. "\u00a3 1234.57"). Use , for thousand separators\n(e.g. "%,d" yields "1,234"). For more information, see\nsprintf-js.
  • \n
\n

Number formatting from column_config always takes precedence over\nnumber formatting from pandas.Styler. The number formatting does\nnot impact the return value when used in st.data_editor.

\n", + "default": "locale" + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "min_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum value of the progress bar. If this is None (default),\nthe minimum will be 0.

\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum value of the progress bar. If this is None (default),\nthe maximum will be 100 for integer values and 1.0 for float values.

\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The precision of numbers. If this is None (default), integer columns\nwill have a step of 1 and float columns will have a step of 0.01.\nSetting step for float columns will ensure a consistent number of\ndigits after the decimal are displayed.

\n", + "default": null + }, + { + "name": "color", + "type_name": "\"auto\", \"auto-inverse\", str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The color to use for the chart. This can be one of the following:

\n
    \n
  • None (default): The primary color is used.
  • \n
  • "auto": If the value is more than half, the bar is green; if the\nvalue is less than half, the bar is red.
  • \n
  • "auto-inverse": If the value is more than half, the bar is red;\nif the value is less than half, the bar is green.
  • \n
  • A single color value that is applied to all charts in the column.\nIn addition to the basic color palette (red, orange, yellow, green,\nblue, violet, gray/grey, and primary), this supports hex codes like\n"#483d8b".
  • \n
\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L2871" + }, + "streamlit.column_config.SelectboxColumn": { + "name": "SelectboxColumn", + "signature": "st.column_config.SelectboxColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, options=None, format_func=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "category": [\n            "\ud83d\udcca Data Exploration",\n            "\ud83d\udcc8 Data Visualization",\n            "\ud83e\udd16 LLM",\n            "\ud83d\udcca Data Exploration",\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "category": st.column_config.SelectboxColumn(\n            "App Category",\n            help="The category of the app",\n            width="medium",\n            options=[\n                "\ud83d\udcca Data Exploration",\n                "\ud83d\udcc8 Data Visualization",\n                "\ud83e\udd16 LLM",\n            ],\n            required=True,\n        )\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a selectbox column in st.dataframe or st.data_editor.

\n

This is the default column type for Pandas categorical values. This command needs to\nbe used in the column_config parameter of st.dataframe or st.data_editor.\nWhen used with st.data_editor, editing will be enabled with a selectbox widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "default", + "type_name": "str, int, float, bool, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + }, + { + "name": "options", + "type_name": "Iterable[str, int, float, bool] or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The options that can be selected during editing. If this is None\n(default), the options will be inferred from the underlying dataframe\ncolumn if its dtype is "category". For more information, see Pandas docs).

\n", + "default": null + }, + { + "name": "format_func", + "type_name": "function or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Function to modify the display of the options. It receives\nthe raw option defined in options as an argument and should output\nthe label to be shown for that option. If this is None (default),\nthe raw option is used as the label.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L1133" + }, + "streamlit.column_config.TextColumn": { + "name": "TextColumn", + "signature": "st.column_config.TextColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, alignment=None, default=None, max_chars=None, validate=None)", + "examples": "
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "widgets": [\n            "st.selectbox",\n            "st.number_input",\n            "st.text_area",\n            "st.button",\n        ],\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "widgets": st.column_config.TextColumn(\n            "Widgets",\n            help="Streamlit **widget** commands \ud83c\udf88",\n            default="st.",\n            max_chars=50,\n            validate=r"^st\\.[a-z_]+$",\n        )\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a text column in st.dataframe or st.data_editor.

\n

This is the default column type for string values. This command needs to be used in the\ncolumn_config parameter of st.dataframe or st.data_editor. When used with\nst.data_editor, editing will be enabled with a text input widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), text is left-aligned.

\n", + "default": null + }, + { + "name": "default", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of characters that can be entered. If this is\nNone (default), there will be no maximum.

\n", + "default": null + }, + { + "name": "validate", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A JS-flavored regular expression (e.g. "^[a-z]+$") that edited\nvalues are validated against. If the user input is invalid, it will not\nbe submitted.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L694" + }, + "streamlit.column_config.TimeColumn": { + "name": "TimeColumn", + "signature": "st.column_config.TimeColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, alignment=None, default=None, format=None, min_value=None, max_value=None, step=None)", + "examples": "
\nfrom datetime import time\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "appointment": [\n            time(12, 30),\n            time(18, 0),\n            time(9, 10),\n            time(16, 25),\n        ]\n    }\n)\n\nst.data_editor(\n    data_df,\n    column_config={\n        "appointment": st.column_config.TimeColumn(\n            "Appointment",\n            min_value=time(8, 0, 0),\n            max_value=time(19, 0, 0),\n            format="hh:mm a",\n            step=60,\n        ),\n    },\n    hide_index=True,\n)\n
\n", + "description": "

Configure a time column in st.dataframe or st.data_editor.

\n

This is the default column type for time values. This command needs to be used in\nthe column_config parameter of st.dataframe or st.data_editor. When\nused with st.data_editor, editing will be enabled with a time picker widget.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether editing should be disabled for this column. If this is None\n(default), Streamlit will enable editing wherever possible.

\n

If a column has mixed types, it may become uneditable regardless of\ndisabled.

\n", + "default": null + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether edited cells in the column need to have a value. If this is\nFalse (default), the user can submit empty values for this column.\nIf this is True, an edited cell in this column can only be\nsubmitted if its value is not None, and a new row will only be\nsubmitted after the user fills in this column.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), times are left-aligned.

\n", + "default": null + }, + { + "name": "default", + "type_name": "datetime.time or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies the default value in this column when a new row is added by\nthe user. This defaults to None.

\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str, \"localized\", \"iso8601\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A format string controlling how times are displayed.\nThis can be one of the following values:

\n
    \n
  • None (default): Show the time in "HH:mm:ss" format (e.g.\n"20:00:00").
  • \n
  • "localized": Show the time in the default locale format (e.g.\n"12:00:00 PM" in the America/Los_Angeles timezone).
  • \n
  • "iso8601": Show the time in ISO 8601 format (e.g.\n"20:00:00.000Z").
  • \n
  • A momentJS format string: Format the time with a string, like\n"ha" to show "8pm". For available formats, see\nmomentJS.
  • \n
\n

Formatting from column_config always takes precedence over\nformatting from pandas.Styler. The formatting does not impact the\nreturn value when used in st.data_editor.

\n", + "default": "locale" + }, + { + "name": "min_value", + "type_name": "datetime.time or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The minimum time that can be entered. If this is None (default),\nthere will be no minimum.

\n", + "default": null + }, + { + "name": "max_value", + "type_name": "datetime.time or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum time that can be entered. If this is None (default),\nthere will be no maximum.

\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, datetime.timedelta, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The stepping interval in seconds. If this is None (default), the\nstep will be 1 second.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L2538" + }, + "streamlit.column_config.VideoColumn": { + "name": "VideoColumn", + "signature": "st.column_config.VideoColumn(label=None, *, width=None, help=None, pinned=None, alignment=None)", + "examples": "

To show the playback controls, double click a cell in the video column.

\n
\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n    {\n        "description": [\n            "Get started with Streamlit",\n            "Get started with Community Cloud",\n        ],\n        "video": [\n            "https://s3-us-west-2.amazonaws.com/assets.streamlit.io/videos/hero-video.mp4",\n            "https://s3-us-west-2.amazonaws.com/assets.streamlit.io/videos/streamlit_sharing_silent.mp4",\n        ],\n    }\n)\n\nst.dataframe(\n    data_df,\n    column_config={\n        "video": st.column_config.VideoColumn("Preview Video"),\n    },\n)\n
\n", + "description": "

Configure a video column in st.dataframe or st.data_editor.

\n

Video columns display an icon. When a user double clicks the icon in a cell,\nStreamlit displays playback controls. To display a video, a cell must have\none of the following values:

\n
    \n
  • A URL to fetch the video from. If you use static file serving, the\nURL can be relative to your app's URL. Otherwise, the URL must be fully qualified with\na scheme, like "https://example.com/my_video.mp4".

    \n

    Paths to local video files and YouTube URLs aren't supported.

    \n
  • \n
  • A data URL containing a Base64-encoded video, like "data:video/mp4;base64,AAAA...".

    \n
  • \n
\n

Video columns aren't editable at this time. This command must be used in the\ncolumn_config parameter of st.dataframe or st.data_editor.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The label shown at the top of the column. If this is None\n(default), the column name is used.

\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The display width of the column. If this is None (default), the\ncolumn will be sized to fit the cell contents. Otherwise, this can be\none of the following:

\n
    \n
  • "small": 75px wide
  • \n
  • "medium": 200px wide
  • \n
  • "large": 400px wide
  • \n
  • An integer specifying the width in pixels
  • \n
\n

If the total width of all columns is less than the width of the\ndataframe, the remaining space will be distributed evenly among all\ncolumns.

\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A tooltip that gets displayed when hovering over the column label. If\nthis is None (default), no tooltip is displayed.

\n

The tooltip can optionally contain GitHub-flavored Markdown, including\nthe Markdown directives described in the body parameter of\nst.markdown.

\n", + "default": null + }, + { + "name": "pinned", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether the column is pinned. A pinned column will stay visible on the\nleft side no matter where the user scrolls. If this is None\n(default), Streamlit will decide: index columns are pinned, and data\ncolumns are not pinned.

\n", + "default": null + }, + { + "name": "alignment", + "type_name": "\"left\", \"center\", \"right\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The horizontal alignment of cell content. If this is None\n(default), video icons are center-aligned.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_types.py#L1882" + }, + "streamlit.components.v1.declare_component": { + "name": "declare_component", + "signature": "st.components.v1.declare_component(name, path=None, url=None)", + "description": "

Create a custom component and register it if there is a ScriptRunContext.

\n

The component is not registered when there is no ScriptRunContext.\nThis can happen when a CustomComponent is executed as standalone\ncommand (e.g. for testing).

\n

To use this function, import it from the streamlit.components.v1\nmodule.

\n
\n

Warning

\n

Using st.components.v1.declare_component directly (instead of\nimporting its module) is deprecated and will be disallowed in a later\nversion.

\n
\n", + "args": [ + { + "name": "name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short, descriptive name for the component, like "slider".

\n", + "default": null + }, + { + "name": "path", + "type_name": "str, Path, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The path to serve the component's frontend files from. The path should\nbe absolute. If path is None (default), Streamlit will serve\nthe component from the location in url. Either path or url\nmust be specified. If both are specified, then url will take\nprecedence.

\n", + "default": null + }, + { + "name": "url", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The URL that the component is served from. If url is None\n(default), Streamlit will serve the component from the location in\npath. Either path or url must be specified. If both are\nspecified, then url will take precedence.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "CustomComponent", + "is_generator": false, + "description": "

A CustomComponent that can be called like a function.\nCalling the component will create a new instance of the component\nin the Streamlit app.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/components/v1/component_registry.py#L53" + }, + "streamlit.components.v1.deprecate_func_name": { + "name": "deprecate_func_name", + "signature": "st.components.v1.deprecate_func_name(func, old_name, removal_date, extra_message=None, name_override=None, include_st_prefix=True, show_in_browser=True, show_once=False)", + "description": "

Wrap an st function whose name has changed.

\n

Wrapped functions will run as normal, but will also show an st.warning\nsaying that the old name will be removed after removal_date.

\n

(We generally set removal_date to 3 months from the deprecation date.)

\n", + "args": [ + { + "name": "func", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

The st. function whose name has changed.

\n", + "default": null + }, + { + "name": "old_name", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

The function's deprecated name within __init__.py.

\n", + "default": null + }, + { + "name": "removal_date", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

A date like "2020-01-01", indicating the last day we'll guarantee\nsupport for the deprecated name.

\n", + "default": null + }, + { + "name": "extra_message", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

An optional extra message to show in the deprecation warning.

\n", + "default": null + }, + { + "name": "name_override", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

An optional name to use in place of func.__name__.

\n", + "default": null + }, + { + "name": "include_st_prefix", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

If False, does not prefix each of the function names in the deprecation\nmessage with st.*. Defaults to True.

\n", + "default": "True" + }, + { + "name": "show_in_browser", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

Whether to show the deprecation warning in the browser. Defaults to True.\nSet to False for less intrusive deprecation warnings that only log to\nthe console.

\n", + "default": "True" + }, + { + "name": "show_once", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

If True, the warning will only be shown once per unique message.\nDefaults to False.

\n", + "default": "False" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/deprecation_util.py#L102" + }, + "streamlit.components.v1.html": { + "name": "html", + "signature": "st.components.v1.html(html, width=None, height=None, scrolling=False, *, tab_index=None)", + "examples": "
\nimport streamlit.components.v1 as components\n\ncomponents.html(\n    "<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>"\n)\n
\n", + "description": "

Display an HTML string in an iframe.

\n

To use this function, import it from the streamlit.components.v1\nmodule.

\n

If you want to insert HTML text into your app without an iframe, try\nst.html instead.

\n
\n

Warning

\n

The HTML string is embedded as-is in an iframe that allows\nJavaScript execution and same-origin access to the Streamlit app.\nNever pass untrusted HTML from users, query parameters, databases,\nuploaded files, LLM output, or other external sources to this\nfunction. Use st.html for sanitized HTML snippets that don't\nneed full iframe behavior.

\n
\n", + "args": [ + { + "name": "html", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The HTML string to embed in the iframe.

\n", + "default": null + }, + { + "name": "width", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The width of the iframe in CSS pixels. By default, this is the\napp's default element width.

\n", + "default": "element" + }, + { + "name": "height", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The height of the frame in CSS pixels. By default, this is 150.

\n", + "default": null + }, + { + "name": "scrolling", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Whether to allow scrolling in the iframe. If this False\n(default), Streamlit crops any content larger than the iframe and\ndoes not show a scrollbar. If this is True, Streamlit shows a\nscrollbar when the content is larger than the iframe.

\n", + "default": null + }, + { + "name": "tab_index", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies how and if the iframe is sequentially focusable.\nUsers typically use the Tab key for sequential focus\nnavigation.

\n

This can be one of the following values:

\n
    \n
  • None (default): Uses the browser's default behavior.
  • \n
  • -1: Removes the iframe from sequential navigation, but still\nallows it to be focused programmatically.
  • \n
  • 0: Includes the iframe in sequential navigation in the order\nit appears in the document but after all elements with a positive\ntab_index.
  • \n
  • Positive integer: Includes the iframe in sequential navigation.\nElements are navigated in ascending order of their positive\ntab_index.
  • \n
\n

For more information, see the tabindex\ndocumentation on MDN.

\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/iframe.py#L163" + }, + "streamlit.components.v1.iframe": { + "name": "iframe", + "signature": "st.components.v1.iframe(src, width=None, height=None, scrolling=False, *, tab_index=None)", + "examples": "
\nimport streamlit.components.v1 as components\n\ncomponents.iframe("https://example.com", height=500)\n
\n", + "description": "

Load a remote URL in an iframe.

\n

To use this function, import it from the streamlit.components.v1\nmodule.

\n", + "args": [ + { + "name": "src", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The URL of the page to embed.

\n", + "default": null + }, + { + "name": "width", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The width of the iframe in CSS pixels. By default, this is the\napp's default element width.

\n", + "default": "element" + }, + { + "name": "height", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The height of the frame in CSS pixels. By default, this is 150.

\n", + "default": null + }, + { + "name": "scrolling", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Whether to allow scrolling in the iframe. If this False\n(default), Streamlit crops any content larger than the iframe and\ndoes not show a scrollbar. If this is True, Streamlit shows a\nscrollbar when the content is larger than the iframe.

\n", + "default": null + }, + { + "name": "tab_index", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Specifies how and if the iframe is sequentially focusable.\nUsers typically use the Tab key for sequential focus\nnavigation.

\n

This can be one of the following values:

\n
    \n
  • None (default): Uses the browser's default behavior.
  • \n
  • -1: Removes the iframe from sequential navigation, but still\nallows it to be focused programmatically.
  • \n
  • 0: Includes the iframe in sequential navigation in the order\nit appears in the document but after all elements with a positive\ntab_index.
  • \n
  • Positive integer: Includes the iframe in sequential navigation.\nElements are navigated in ascending order of their positive\ntab_index.
  • \n
\n

For more information, see the tabindex\ndocumentation on MDN.

\n", + "default": "behavior" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/iframe.py#L79" + }, + "streamlit.components.v2.build_definition_with_validation": { + "name": "build_definition_with_validation", + "signature": "st.components.v2.build_definition_with_validation(*, manager, component_key, html, css, js)", + "notes": "
    \n
  • Inline strings are treated as content (no manifest required).
  • \n
  • Path-like strings require the component to be declared in the package\nmanifest with an asset_dir.
  • \n
  • Globs are supported only within asset_dir and must resolve to exactly\none file.
  • \n
  • Relative paths are resolved strictly against the component's asset_dir\nand must remain within it after resolution. Absolute paths are not\nallowed.
  • \n
  • For file-backed entries, the URL sent to the frontend is the\nasset_dir-relative path, served under\n/_stcore/bidi-components/<component>/<relative_path>.
  • \n
\n", + "description": "

Construct a definition and validate js/css inputs against asset_dir.

\n", + "args": [ + { + "name": "manager", + "type_name": "BidiComponentManager", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Component manager used to resolve the component's asset_dir and\nrelated metadata.

\n", + "default": null + }, + { + "name": "component_key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Fully-qualified name of the component to build a definition for.

\n", + "default": null + }, + { + "name": "html", + "type_name": "str | None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Inline HTML content to include in the definition. If None, the\ncomponent will not include HTML content.

\n", + "default": null + }, + { + "name": "css", + "type_name": "str | None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Either inline CSS content or a path/glob to a CSS file inside the\ncomponent's asset_dir. Inline strings are kept as-is; file-backed\ninputs are validated and converted to an asset_dir-relative URL.

\n", + "default": null + }, + { + "name": "js", + "type_name": "str | None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Either inline JavaScript content or a path/glob to a JS file inside the\ncomponent's asset_dir. Inline strings are kept as-is; file-backed\ninputs are validated and converted to an asset_dir-relative URL.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "BidiComponentDefinition", + "is_generator": false, + "description": "

A component definition with inline content preserved and file-backed\nentries resolved to absolute filesystem paths plus their\nasset_dir-relative URLs.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/components/v2/component_definition_resolver.py#L36" + }, + "streamlit.components.v2.component": { + "name": "component", + "signature": "st.components.v2.component(name, *, html=None, css=None, js=None, isolate_styles=True)", + "examples": "

Example 1: Create a JavaScript-only component that captures link clicks

\n

You can create a simple component that allows inline links to communicate\nwith Python. Normally, clicking links in a Streamlit app would start a new\nsession. This component captures link clicks and sends them to Python as\ntrigger values.

\n
\nimport streamlit as st\n\nJS = """\nexport default function(component) {\n    const { setTriggerValue } = component;\n    const links = document.querySelectorAll('a[href="#"]');\n\n    links.forEach((link) => {\n        link.onclick = (e) => {\n            setTriggerValue('clicked', link.innerHTML);\n        };\n    });\n}\n"""\n\nmy_component = st.components.v2.component(\n    "inline_links",\n    js=JS,\n)\n\nresult = my_component(on_clicked_change=lambda: None)\n\nst.markdown(\n    "Components aren't [sandboxed](#), so you can write JS that [interacts](#) with the main [document](#)."\n)\n\nif result.clicked:\n    st.write(f"You clicked {result.clicked}!")\n
\n

Example 2: Display a paragraph with custom inline links

\n

If you want to dynamically pass custom data from inline links, you can pass\nHTML to the data parameter of the component's mount command. When a\nlink is clicked, the component sets a trigger value from the link's\ndata-link HTML attribute.

\n
\n

Warning

\n

Only render trusted HTML this way. If you directly modify the inner\nHTML of the parent element, you will overwrite the HTML and CSS passed\nto the component. Instead, create a new child element and set its\ninner HTML. You can create the placeholder dynamically in JavaScript\nor include it in the html parameter.

\n
\n
\nimport streamlit as st\n\nCSS = """\na {\n    color: var(--st-link-color);\n}\n"""\n\nJS = """\nexport default function(component) {\n    const { data, setTriggerValue, parentElement } = component;\n    const newElement = document.createElement('div');\n    parentElement.appendChild(newElement);\n    newElement.innerHTML = data;\n\n    const links = newElement.querySelectorAll('a');\n\n    links.forEach((link) => {\n        link.onclick = (e) => {\n            setTriggerValue('clicked', link.getAttribute('data-link'));\n        };\n    });\n}\n"""\n\nmy_component = st.components.v2.component(\n    "inline_links",\n    css=CSS,\n    js=JS,\n)\n\nparagraph_html = """\n<p>This is an example paragraph with inline links. To see the response in\nPython, click on the <a href="#" data-link="link_1">first link</a> or\n<a href="#" data-link="link_2">second link</a>.</p>\n"""\n\nresult = my_component(data=paragraph_html, on_clicked_change=lambda: None)\nif result.clicked == "link_1":\n    st.write("You clicked the first link!")\nelif result.clicked == "link_2":\n    st.write("You clicked the second link!")\n
\n

Example 3: Display an interactive SVG image

\n

You can create a component that displays an SVG image with clickable\nshapes. When a shape is clicked, the component sends the shape type to\nPython as a trigger value.

\n
\nimport streamlit as st\n\nHTML = """\n<p>Click on the triangle, square, or circle to interact with the shapes:</p>\n\n<svg width="400" height="300">\n    <polygon points="100,50 50,150 150,150" data-shape="triangle"></polygon>\n    <rect x="200" y="75" width="100" height="100" data-shape="square"></rect>\n    <circle cx="125" cy="225" r="40" data-shape="circle"></circle>\n</svg>\n"""\n\nJS = """\nexport default function(component) {\n    const { setTriggerValue, parentElement } = component;\n    const shapes = parentElement.querySelectorAll('[data-shape]');\n\n    shapes.forEach((shape) => {\n        shape.onclick = (e) => {\n            setTriggerValue('clicked', shape.getAttribute('data-shape'));\n        };\n    });\n}\n"""\n\nCSS = """\npolygon, rect, circle {\n    stroke: var(--st-primary-color);\n    stroke-width: 2;\n    fill: transparent;\n    cursor: pointer;\n}\npolygon:hover, rect:hover, circle:hover {\n    fill: var(--st-secondary-background-color);\n}\n"""\n\nmy_component = st.components.v2.component(\n    "clickable_svg",\n    html=HTML,\n    css=CSS,\n    js=JS,\n)\n\nresult = my_component(on_clicked_change=lambda: None)\nresult\n
\n

Example 4: Clean up your component's resources

\n

You can use the return value of the component's JavaScript function to\nclean up any resources when the component is unmounted. For example, you\ncan disconnect a MutationObserver that was monitoring changes in the DOM.

\n
\nimport streamlit as st\n\nJS = """\nexport default function(component) {\n    const { setStateValue, parentElement } = component;\n    const sidebar = document.querySelector('section.stSidebar');\n    const initialState = sidebar.getAttribute('aria-expanded') === 'true';\n\n    // Create observer to watch for aria-expanded attribute changes\n    const observer = new MutationObserver((mutations) => {\n        mutations.forEach((mutation) => {\n            if (mutation.type === 'attributes' && mutation.attributeName === 'aria-expanded') {\n                const newIsExpanded = sidebar.getAttribute('aria-expanded') === 'true';\n                setStateValue('expanded', newIsExpanded);\n            }\n        });\n    });\n\n    // Start observing\n    observer.observe(sidebar, {\n        attributes: true,\n        attributeFilter: ['aria-expanded']\n    });\n\n    // Set initial state\n    setStateValue('expanded', initialState);\n\n    // Cleanup function to remove the observer\n    return () => {\n        observer.disconnect();\n    };\n\n};\n"""\n\nmy_component = st.components.v2.component(\n    "sidebar_expansion_detector",\n    js=JS,\n)\n\nst.sidebar.write("Sidebar content")\nresult = my_component(on_expanded_change=lambda: None)\nresult\n
\n", + "description": "

Register an st.components.v2 component and return a callable to mount it.

\n

Components can have any combination of HTML, CSS, and JavaScript. If none\nare provided, the component renders as an empty element without raising\nan error.

\n
\n

Warning

\n

Components are trusted code. Streamlit does not sanitize the html,\ncss, or js content passed to this function. HTML may include\n<script> tags, and JavaScript executes with normal app-page DOM\nprivileges. Never pass untrusted or user-provided content to html,\ncss, or js, including content from widgets, query parameters,\ndatabases, uploaded files, LLM output, or other external sources.\nSanitize or escape untrusted data before a component renders it as\nHTML.

\n
\n

If your component is defined in an installed package, you can declare an\nasset directory (asset_dir) through pyproject.toml files in the\npackage. This allows you to serve component assets and reference them by\npath or glob in the html, css, and js parameters. Otherwise,\nyou must provide raw HTML, CSS, and/or JavaScript strings directly to these\nparameters.

\n
\n

Important

\n

When using paths or globs to define one or more component assets, the\npaths must be relative to the component's asset_dir as declared in\nthe component manifest. This is only possible for installed components.

\n

For security reasons, absolute paths and path traversals are rejected.\nBecause of runtime constraints, paths and globs must be provided as\nstrings and not Path objects.

\n
\n", + "args": [ + { + "name": "name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A short, descriptive identifier for the component. This is used\ninternally by Streamlit to manage instances of the component.

\n

Component names must be unique across an app. The names of imported\ncomponents are prefixed by their module name to avoid collisions.

\n

If you register multiple components with the same name, a warning is\nlogged and the last-registered component is used. Because this can lead\nto unexpected behavior, ensure that component names are unique. If you\nintend to have multiple instances of a component in one app, avoid\nwrapping a component definition together with its mounting command so\nyou don't re-register your component with each instance.

\n", + "default": null + }, + { + "name": "html", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Inline HTML markup for the component root. This can be one of the\nfollowing strings:

\n
    \n
  • Raw HTML. This doesn't require any <html>, <head>, or\n<body> tags; just provide the inner HTML.
  • \n
  • A path or glob to an HTML file, relative to the component's\nasset directory.
  • \n
\n

This is trusted component content. Streamlit does not sanitize it, and\nany scripts in the HTML can execute in the app page.

\n

If any HTML depends on data passed at mount time, use a placeholder\nelement and populate it via JavaScript. Alternatively, you can append\na new element to the parent. For more information, see Example 2.

\n", + "default": null + }, + { + "name": "css", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Inline CSS. This can be one of the following strings:

\n
    \n
  • Raw CSS (without a <style> block).
  • \n
  • A path or glob to a CSS file, relative to the component's\nasset directory.
  • \n
\n", + "default": null + }, + { + "name": "js", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Inline JavaScript. This can be one of the following strings:

\n
    \n
  • Raw JavaScript (without a <script> block).
  • \n
  • A path or glob to a JS file, relative to the component's\nasset directory.
  • \n
\n

This is trusted component code. It executes with normal app-page DOM\nprivileges.

\n", + "default": null + }, + { + "name": "isolate_styles", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Whether to isolate the component styles in a shadow root. If this is\nTrue (default), the component's HTML is mounted inside a shadow DOM\nand, in your component's JavaScript, parentElement returns a\nShadowRoot. If this is False, the component's HTML is mounted\ndirectly into the app's DOM tree, and parentElement returns a\nregular HTMLElement.

\n

This is style isolation only. It is not a security boundary and does\nnot sandbox the component's JavaScript.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "ComponentRenderer", + "is_generator": false, + "description": "

The component's mounting command.

\n

This callable accepts the component parameters like key and\ndata and returns a ComponentResult object with the\ncomponent's state. The mounting command can be included in a\nuser-friendly wrapper function to provide a simpler API. A mounting\ncommand can be called multiple times in an app to create multiple\ninstances of the component.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/components/v2/__init__.py#L207" + }, + "streamlit.components.v2.get_bidi_component_manager": { + "name": "get_bidi_component_manager", + "signature": "st.components.v2.get_bidi_component_manager()", + "notes": "

If the Streamlit runtime is not running, a local BidiComponentManager\nis created and returned.

\n", + "description": "

Return the singleton BidiComponentManager instance.

\n", + "args": [], + "returns": [ + { + "type_name": "BidiComponentManager", + "is_generator": false, + "description": "

The singleton BidiComponentManager instance.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/components/v2/get_bidi_component_manager.py#L30" + }, + "StatusContainer.update": { + "name": "update", + "signature": "StatusContainer.update(*, label=None, expanded=None, state=None)", + "description": "

Update the status container.

\n

Only specified arguments are updated. Container contents and unspecified\narguments remain unchanged.

\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

A new label of the status container. If None, the label is not\nchanged.

\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The new expanded state of the status container. If None,\nthe expanded state is not changed.

\n", + "default": null + }, + { + "name": "state", + "type_name": "\"running\", \"complete\", \"error\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The new state of the status container. This mainly changes the\nicon. If None, the state is not changed.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/mutable_status_container.py#L112" + }, + "streamlit.testing.v1.AppTest": { + "name": "AppTest", + "signature": "st.testing.v1.AppTest(script_path, *, default_timeout, args=None, kwargs=None)", + "is_class": true, + "methods": [ + { + "name": "get", + "signature": "st.testing.v1.get.get(element_type)", + "description": "

Get elements or widgets of the specified type.

", + "args": [ + { + "name": "element_type", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An element attribute of AppTest. For example, "button",\n"caption", or "chat_input".

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Sequence of Elements", + "is_generator": false, + "description": "

Sequence of elements of the given type. Individual elements can\nbe accessed from a Sequence by index (order on the page). When\ngetting and element_type that is a widget, individual widgets\ncan be accessed by key. For example, at.get("text")[0] for the\nfirst st.text element or at.get("slider")(key="my_key") for\nthe st.slider widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1229" + }, + { + "name": "run", + "signature": "st.testing.v1.run.run(*, timeout=None)", + "description": "

Run the script from the current state.

", + "args": [ + { + "name": "timeout", + "type_name": "float or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. If timeout is\nNone (default), Streamlit uses the default timeout set for the\ninstance of AppTest.

\n", + "default": "timeout" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "

self

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L442" + }, + { + "name": "switch_page", + "signature": "st.testing.v1.switch_page.switch_page(page_path)", + "examples": "
\nat = AppTest.from_file("app.py").run()\nat.switch_page("pages/settings.py").run()\n
\n", + "description": "

Switch to a file-based page relative to the app's main script.

", + "args": [ + { + "name": "page_path", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Path of the page to switch to. The path must be relative to the\nmain script's location (e.g. "pages/my_page.py").

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "

self

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L465" + } + ], + "properties": [ + { + "name": "button", + "signature": "st.testing.v1.button.button", + "description": "

Sequence of all st.button and st.form_submit_button widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Button", + "is_generator": false, + "description": "

Sequence of all st.button and st.form_submit_button\nwidgets. Individual widgets can be accessed from a WidgetList by\nindex (order on the page) or key. For example, at.button[0] for\nthe first widget or at.button(key="my_key") for a widget with a\ngiven key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L535" + }, + { + "name": "button_group", + "signature": "st.testing.v1.button_group.button_group", + "description": "

Sequence of all st.pills and st.segmented_control widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ButtonGroup", + "is_generator": false, + "description": "

Sequence of all st.pills and st.segmented_control widgets.\nIndividual widgets can be accessed from a WidgetList by index\n(order on the page) or key. For example, at.button_group[0] for\nthe first widget or at.button_group(key="my_key") for a widget\nwith a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L550" + }, + { + "name": "caption", + "signature": "st.testing.v1.caption.caption", + "description": "

Sequence of all st.caption elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Caption", + "is_generator": false, + "description": "

Sequence of all st.caption elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.caption[0] for the first element. Caption is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L595" + }, + { + "name": "chat_input", + "signature": "st.testing.v1.chat_input.chat_input", + "description": "

Sequence of all st.chat_input widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ChatInput", + "is_generator": false, + "description": "

Sequence of all st.chat_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.chat_input[0] for the first widget or\nat.chat_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L609" + }, + { + "name": "chat_message", + "signature": "st.testing.v1.chat_message.chat_message", + "description": "

Sequence of all st.chat_message elements.

", + "args": [], + "returns": [ + { + "type_name": "Sequence of ChatMessage", + "is_generator": false, + "description": "

Sequence of all st.chat_message elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.chat_message[0] for the first element. ChatMessage\nis an extension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L623" + }, + { + "name": "checkbox", + "signature": "st.testing.v1.checkbox.checkbox", + "description": "

Sequence of all st.checkbox widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Checkbox", + "is_generator": false, + "description": "

Sequence of all st.checkbox widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.checkbox[0] for the first widget or\nat.checkbox(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L637" + }, + { + "name": "code", + "signature": "st.testing.v1.code.code", + "description": "

Sequence of all st.code elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Code", + "is_generator": false, + "description": "

Sequence of all st.code elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.code[0] for the first element. Code is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L651" + }, + { + "name": "color_picker", + "signature": "st.testing.v1.color_picker.color_picker", + "description": "

Sequence of all st.color_picker widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ColorPicker", + "is_generator": false, + "description": "

Sequence of all st.color_picker widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.color_picker[0] for the first widget or\nat.color_picker(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L665" + }, + { + "name": "columns", + "signature": "st.testing.v1.columns.columns", + "description": "

Sequence of all columns within st.columns elements.

", + "args": [], + "returns": [ + { + "type_name": "Sequence of Column", + "is_generator": false, + "description": "

Sequence of all columns within st.columns elements. Individual\ncolumns can be accessed from an ElementList by index (order on the\npage). For example, at.columns[0] for the first column. Column\nis an extension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L679" + }, + { + "name": "dataframe", + "signature": "st.testing.v1.dataframe.dataframe", + "description": "

Sequence of all st.dataframe elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Dataframe", + "is_generator": false, + "description": "

Sequence of all st.dataframe elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.dataframe[0] for the first element. Dataframe is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L696" + }, + { + "name": "date_input", + "signature": "st.testing.v1.date_input.date_input", + "description": "

Sequence of all st.date_input widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DateInput", + "is_generator": false, + "description": "

Sequence of all st.date_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.date_input[0] for the first widget or\nat.date_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L710" + }, + { + "name": "datetime_input", + "signature": "st.testing.v1.datetime_input.datetime_input", + "description": "

Sequence of all st.datetime_input widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DateTimeInput", + "is_generator": false, + "description": "

Sequence of all st.datetime_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.datetime_input[0] for the first widget or\nat.datetime_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L724" + }, + { + "name": "divider", + "signature": "st.testing.v1.divider.divider", + "description": "

Sequence of all st.divider elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Divider", + "is_generator": false, + "description": "

Sequence of all st.divider elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.divider[0] for the first element. Divider is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L738" + }, + { + "name": "download_button", + "signature": "st.testing.v1.download_button.download_button", + "description": "

Sequence of all st.download_button widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DownloadButton", + "is_generator": false, + "description": "

Sequence of all st.download_button widgets. Individual widgets\ncan be accessed from a WidgetList by index (order on the page) or\nkey. For example, at.download_button[0] for the first widget or\nat.download_button(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L752" + }, + { + "name": "error", + "signature": "st.testing.v1.error.error", + "description": "

Sequence of all st.error elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Error", + "is_generator": false, + "description": "

Sequence of all st.error elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.error[0] for the first element. Error is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L766" + }, + { + "name": "exception", + "signature": "st.testing.v1.exception.exception", + "description": "

Sequence of all st.exception elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Exception", + "is_generator": false, + "description": "

Sequence of all st.exception elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.exception[0] for the first element. Exception is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L780" + }, + { + "name": "expander", + "signature": "st.testing.v1.expander.expander", + "description": "

Sequence of all st.expander elements.

", + "args": [], + "returns": [ + { + "type_name": "Sequence of Expandable", + "is_generator": false, + "description": "

Sequence of all st.expander elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, at.expander[0] for the first element. Expandable is an\nextension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L822" + }, + { + "name": "feedback", + "signature": "st.testing.v1.feedback.feedback", + "description": "

Sequence of all st.feedback widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Feedback", + "is_generator": false, + "description": "

Sequence of all st.feedback widgets. Individual widgets can be\naccessed from a WidgetList by index (order on the page) or key. For\nexample, at.feedback[0] for the first widget or\nat.feedback(key="my_key") to access by key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L794" + }, + { + "name": "file_uploader", + "signature": "st.testing.v1.file_uploader.file_uploader", + "description": "

Sequence of all st.file_uploader widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of FileUploader", + "is_generator": false, + "description": "

Sequence of all st.file_uploader widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.file_uploader[0] for the first widget or\nat.file_uploader(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L808" + }, + { + "name": "header", + "signature": "st.testing.v1.header.header", + "description": "

Sequence of all st.header elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Header", + "is_generator": false, + "description": "

Sequence of all st.header elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.header[0] for the first element. Header is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L836" + }, + { + "name": "image", + "signature": "st.testing.v1.image.image", + "description": "

Sequence of all st.image elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Image", + "is_generator": false, + "description": "

Sequence of all st.image elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.image[0] for the first element. Image is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L850" + }, + { + "name": "info", + "signature": "st.testing.v1.info.info", + "description": "

Sequence of all st.info elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Info", + "is_generator": false, + "description": "

Sequence of all st.info elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.info[0] for the first element. Info is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L864" + }, + { + "name": "json", + "signature": "st.testing.v1.json.json", + "description": "

Sequence of all st.json elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Json", + "is_generator": false, + "description": "

Sequence of all st.json elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.json[0] for the first element. Json is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L878" + }, + { + "name": "latex", + "signature": "st.testing.v1.latex.latex", + "description": "

Sequence of all st.latex elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Latex", + "is_generator": false, + "description": "

Sequence of all st.latex elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.latex[0] for the first element. Latex is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L892" + }, + { + "name": "main", + "signature": "st.testing.v1.main.main", + "description": "

Sequence of elements within the main body of the app.

", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "

A container of elements. Block can be queried for elements in the\nsame manner as AppTest. For example, Block.checkbox will\nreturn all st.checkbox within the associated container.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L509" + }, + { + "name": "markdown", + "signature": "st.testing.v1.markdown.markdown", + "description": "

Sequence of all st.markdown elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Markdown", + "is_generator": false, + "description": "

Sequence of all st.markdown elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.markdown[0] for the first element. Markdown is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L906" + }, + { + "name": "menu_button", + "signature": "st.testing.v1.menu_button.menu_button", + "description": "

Sequence of all st.menu_button widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of MenuButton", + "is_generator": false, + "description": "

Sequence of all st.menu_button widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.menu_button[0] for the first widget or\nat.menu_button(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L934" + }, + { + "name": "metric", + "signature": "st.testing.v1.metric.metric", + "description": "

Sequence of all st.metric elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Metric", + "is_generator": false, + "description": "

Sequence of all st.metric elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.metric[0] for the first element. Metric is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L920" + }, + { + "name": "multiselect", + "signature": "st.testing.v1.multiselect.multiselect", + "description": "

Sequence of all st.multiselect widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Multiselect", + "is_generator": false, + "description": "

Sequence of all st.multiselect widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.multiselect[0] for the first widget or\nat.multiselect(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L948" + }, + { + "name": "number_input", + "signature": "st.testing.v1.number_input.number_input", + "description": "

Sequence of all st.number_input widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of NumberInput", + "is_generator": false, + "description": "

Sequence of all st.number_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.number_input[0] for the first widget or\nat.number_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L962" + }, + { + "name": "pills", + "signature": "st.testing.v1.pills.pills", + "description": "

Sequence of all st.pills widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ButtonGroup", + "is_generator": false, + "description": "

Sequence of all st.pills widgets (filtered by style).\nIndividual widgets can be accessed from a WidgetList by index\n(order on the page) or key. For example, at.pills[0] for\nthe first widget or at.pills(key="my_key") for a widget\nwith a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L565" + }, + { + "name": "radio", + "signature": "st.testing.v1.radio.radio", + "description": "

Sequence of all st.radio widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Radio", + "is_generator": false, + "description": "

Sequence of all st.radio widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.radio[0] for the first widget or\nat.radio(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L976" + }, + { + "name": "segmented_control", + "signature": "st.testing.v1.segmented_control.segmented_control", + "description": "

Sequence of all st.segmented_control widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ButtonGroup", + "is_generator": false, + "description": "

Sequence of all st.segmented_control widgets (filtered by style).\nIndividual widgets can be accessed from a WidgetList by index\n(order on the page) or key. For example, at.segmented_control[0]\nfor the first widget or at.segmented_control(key="my_key")\nfor a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L580" + }, + { + "name": "select_slider", + "signature": "st.testing.v1.select_slider.select_slider", + "description": "

Sequence of all st.select_slider widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of SelectSlider", + "is_generator": false, + "description": "

Sequence of all st.select_slider widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.select_slider[0] for the first widget or\nat.select_slider(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L990" + }, + { + "name": "selectbox", + "signature": "st.testing.v1.selectbox.selectbox", + "description": "

Sequence of all st.selectbox widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Selectbox", + "is_generator": false, + "description": "

Sequence of all st.selectbox widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.selectbox[0] for the first widget or\nat.selectbox(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1004" + }, + { + "name": "sidebar", + "signature": "st.testing.v1.sidebar.sidebar", + "description": "

Sequence of all elements within st.sidebar.

", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "

A container of elements. Block can be queried for elements in the\nsame manner as AppTest. For example, Block.checkbox will\nreturn all st.checkbox within the associated container.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L522" + }, + { + "name": "slider", + "signature": "st.testing.v1.slider.slider", + "description": "

Sequence of all st.slider widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Slider", + "is_generator": false, + "description": "

Sequence of all st.slider widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.slider[0] for the first widget or\nat.slider(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1018" + }, + { + "name": "status", + "signature": "st.testing.v1.status.status", + "description": "

Sequence of all st.status elements.

", + "args": [], + "returns": [ + { + "type_name": "Sequence of Status", + "is_generator": false, + "description": "

Sequence of all st.status elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, at.status[0] for the first element. Status is an\nextension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1060" + }, + { + "name": "subheader", + "signature": "st.testing.v1.subheader.subheader", + "description": "

Sequence of all st.subheader elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Subheader", + "is_generator": false, + "description": "

Sequence of all st.subheader elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.subheader[0] for the first element. Subheader is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1032" + }, + { + "name": "success", + "signature": "st.testing.v1.success.success", + "description": "

Sequence of all st.success elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Success", + "is_generator": false, + "description": "

Sequence of all st.success elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.success[0] for the first element. Success is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1046" + }, + { + "name": "table", + "signature": "st.testing.v1.table.table", + "description": "

Sequence of all st.table elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Table", + "is_generator": false, + "description": "

Sequence of all st.table elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.table[0] for the first element. Table is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1074" + }, + { + "name": "tabs", + "signature": "st.testing.v1.tabs.tabs", + "description": "

Sequence of all tabs within st.tabs elements.

", + "args": [], + "returns": [ + { + "type_name": "Sequence of Tab", + "is_generator": false, + "description": "

Sequence of all tabs within st.tabs elements. Individual\ntabs can be accessed from an ElementList by index (order on the\npage). For example, at.tabs[0] for the first tab. Tab is an\nextension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1088" + }, + { + "name": "text", + "signature": "st.testing.v1.text.text", + "description": "

Sequence of all st.text elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Text", + "is_generator": false, + "description": "

Sequence of all st.text elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.text[0] for the first element. Text is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1108" + }, + { + "name": "text_area", + "signature": "st.testing.v1.text_area.text_area", + "description": "

Sequence of all st.text_area widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextArea", + "is_generator": false, + "description": "

Sequence of all st.text_area widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.text_area[0] for the first widget or\nat.text_area(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1122" + }, + { + "name": "text_input", + "signature": "st.testing.v1.text_input.text_input", + "description": "

Sequence of all st.text_input widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextInput", + "is_generator": false, + "description": "

Sequence of all st.text_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.text_input[0] for the first widget or\nat.text_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1136" + }, + { + "name": "time_input", + "signature": "st.testing.v1.time_input.time_input", + "description": "

Sequence of all st.time_input widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TimeInput", + "is_generator": false, + "description": "

Sequence of all st.time_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.time_input[0] for the first widget or\nat.time_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1150" + }, + { + "name": "title", + "signature": "st.testing.v1.title.title", + "description": "

Sequence of all st.title elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Title", + "is_generator": false, + "description": "

Sequence of all st.title elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.title[0] for the first element. Title is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1164" + }, + { + "name": "toast", + "signature": "st.testing.v1.toast.toast", + "description": "

Sequence of all st.toast elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Toast", + "is_generator": false, + "description": "

Sequence of all st.toast elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.toast[0] for the first element. Toast is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1178" + }, + { + "name": "toggle", + "signature": "st.testing.v1.toggle.toggle", + "description": "

Sequence of all st.toggle widgets.

", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Toggle", + "is_generator": false, + "description": "

Sequence of all st.toggle widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.toggle[0] for the first widget or\nat.toggle(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1192" + }, + { + "name": "warning", + "signature": "st.testing.v1.warning.warning", + "description": "

Sequence of all st.warning elements.

", + "args": [], + "returns": [ + { + "type_name": "ElementList of Warning", + "is_generator": false, + "description": "

Sequence of all st.warning elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.warning[0] for the first element. Warning is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1206" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L106", + "description": "

A simulated Streamlit app to check the correctness of displayed elements and outputs.

\n

An instance of AppTest simulates a running Streamlit app. This class\nprovides methods to set up, manipulate, and inspect the app contents via\nAPI instead of a browser UI. It can be used to write automated tests of an\napp in various scenarios. These can then be run using a tool like pytest.

\n

AppTest can be initialized by one of three class methods:

\n\n

Once initialized, Session State and widget values can be updated and the\nscript can be run. Unlike an actual live-running Streamlit app, you need to\ncall AppTest.run() explicitly to re-run the app after changing a widget\nvalue. Switching pages also requires an explicit, follow-up call to\nAppTest.run().

\n

AppTest enables developers to build tests on their app as-is, in the\nfamiliar Python test format, without major refactoring or abstracting out\nlogic to be tested separately from the UI. Tests can run quickly with very\nlow overhead. A typical pattern is to build a suite of tests for an app\nthat ensure consistent functionality as the app evolves, and run the tests\nlocally and/or in a CI environment like GitHub Actions.

\n
\n

Note

\n

AppTest renders one page at a time. For a multipage app, initialize\nAppTest with the app's entrypoint script, which is the same file\nyou would pass to streamlit run. This applies to apps that use\nst.navigation or a pages/ directory. To test another\nfile-based page, call AppTest.switch_page() followed by\nAppTest.run(). Passing a page directly to AppTest.from_file()\nmakes that page the main script and changes how relative page paths\nare resolved.

\n
\n", + "args": [ + { + "name": "secrets", + "type_name": "dict[str, Any]", + "is_optional": false, + "description": "

Dictionary of secrets to be used by the simulated app. Use dict-like\nsyntax to set secret values for the simulated app.

\n", + "default": null + }, + { + "name": "session_state", + "type_name": "SafeSessionState", + "is_optional": false, + "description": "

Session State for the simulated app. SafeSessionState object supports\nread and write operations as usual for Streamlit apps.

\n", + "default": null + }, + { + "name": "query_params", + "type_name": "dict[str, Any]", + "is_optional": false, + "description": "

Dictionary of query parameters to be used by the simulated app. Use\ndict-like syntax to set query_params values for the simulated app.

\n", + "default": null + } + ], + "returns": [] + }, + "AppTest.button": { + "name": "button", + "signature": "AppTest.button", + "description": "

Sequence of all st.button and st.form_submit_button widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Button", + "is_generator": false, + "description": "

Sequence of all st.button and st.form_submit_button\nwidgets. Individual widgets can be accessed from a WidgetList by\nindex (order on the page) or key. For example, at.button[0] for\nthe first widget or at.button(key="my_key") for a widget with a\ngiven key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L535" + }, + "AppTest.button_group": { + "name": "button_group", + "signature": "AppTest.button_group", + "description": "

Sequence of all st.pills and st.segmented_control widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ButtonGroup", + "is_generator": false, + "description": "

Sequence of all st.pills and st.segmented_control widgets.\nIndividual widgets can be accessed from a WidgetList by index\n(order on the page) or key. For example, at.button_group[0] for\nthe first widget or at.button_group(key="my_key") for a widget\nwith a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L550" + }, + "AppTest.caption": { + "name": "caption", + "signature": "AppTest.caption", + "description": "

Sequence of all st.caption elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Caption", + "is_generator": false, + "description": "

Sequence of all st.caption elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.caption[0] for the first element. Caption is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L595" + }, + "AppTest.chat_input": { + "name": "chat_input", + "signature": "AppTest.chat_input", + "description": "

Sequence of all st.chat_input widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ChatInput", + "is_generator": false, + "description": "

Sequence of all st.chat_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.chat_input[0] for the first widget or\nat.chat_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L609" + }, + "AppTest.chat_message": { + "name": "chat_message", + "signature": "AppTest.chat_message", + "description": "

Sequence of all st.chat_message elements.

\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of ChatMessage", + "is_generator": false, + "description": "

Sequence of all st.chat_message elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.chat_message[0] for the first element. ChatMessage\nis an extension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L623" + }, + "AppTest.checkbox": { + "name": "checkbox", + "signature": "AppTest.checkbox", + "description": "

Sequence of all st.checkbox widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Checkbox", + "is_generator": false, + "description": "

Sequence of all st.checkbox widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.checkbox[0] for the first widget or\nat.checkbox(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L637" + }, + "AppTest.code": { + "name": "code", + "signature": "AppTest.code", + "description": "

Sequence of all st.code elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Code", + "is_generator": false, + "description": "

Sequence of all st.code elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.code[0] for the first element. Code is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L651" + }, + "AppTest.color_picker": { + "name": "color_picker", + "signature": "AppTest.color_picker", + "description": "

Sequence of all st.color_picker widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ColorPicker", + "is_generator": false, + "description": "

Sequence of all st.color_picker widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.color_picker[0] for the first widget or\nat.color_picker(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L665" + }, + "AppTest.columns": { + "name": "columns", + "signature": "AppTest.columns", + "description": "

Sequence of all columns within st.columns elements.

\n

Each column within a single st.columns will be returned as a\nseparate Column in the Sequence.

\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Column", + "is_generator": false, + "description": "

Sequence of all columns within st.columns elements. Individual\ncolumns can be accessed from an ElementList by index (order on the\npage). For example, at.columns[0] for the first column. Column\nis an extension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L679" + }, + "AppTest.dataframe": { + "name": "dataframe", + "signature": "AppTest.dataframe", + "description": "

Sequence of all st.dataframe elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Dataframe", + "is_generator": false, + "description": "

Sequence of all st.dataframe elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.dataframe[0] for the first element. Dataframe is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L696" + }, + "AppTest.date_input": { + "name": "date_input", + "signature": "AppTest.date_input", + "description": "

Sequence of all st.date_input widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DateInput", + "is_generator": false, + "description": "

Sequence of all st.date_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.date_input[0] for the first widget or\nat.date_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L710" + }, + "AppTest.datetime_input": { + "name": "datetime_input", + "signature": "AppTest.datetime_input", + "description": "

Sequence of all st.datetime_input widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DateTimeInput", + "is_generator": false, + "description": "

Sequence of all st.datetime_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.datetime_input[0] for the first widget or\nat.datetime_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L724" + }, + "AppTest.divider": { + "name": "divider", + "signature": "AppTest.divider", + "description": "

Sequence of all st.divider elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Divider", + "is_generator": false, + "description": "

Sequence of all st.divider elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.divider[0] for the first element. Divider is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L738" + }, + "AppTest.download_button": { + "name": "download_button", + "signature": "AppTest.download_button", + "description": "

Sequence of all st.download_button widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DownloadButton", + "is_generator": false, + "description": "

Sequence of all st.download_button widgets. Individual widgets\ncan be accessed from a WidgetList by index (order on the page) or\nkey. For example, at.download_button[0] for the first widget or\nat.download_button(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L752" + }, + "AppTest.error": { + "name": "error", + "signature": "AppTest.error", + "description": "

Sequence of all st.error elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Error", + "is_generator": false, + "description": "

Sequence of all st.error elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.error[0] for the first element. Error is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L766" + }, + "AppTest.exception": { + "name": "exception", + "signature": "AppTest.exception", + "description": "

Sequence of all st.exception elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Exception", + "is_generator": false, + "description": "

Sequence of all st.exception elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.exception[0] for the first element. Exception is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L780" + }, + "AppTest.expander": { + "name": "expander", + "signature": "AppTest.expander", + "description": "

Sequence of all st.expander elements.

\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Expandable", + "is_generator": false, + "description": "

Sequence of all st.expander elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, at.expander[0] for the first element. Expandable is an\nextension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L822" + }, + "AppTest.feedback": { + "name": "feedback", + "signature": "AppTest.feedback", + "description": "

Sequence of all st.feedback widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Feedback", + "is_generator": false, + "description": "

Sequence of all st.feedback widgets. Individual widgets can be\naccessed from a WidgetList by index (order on the page) or key. For\nexample, at.feedback[0] for the first widget or\nat.feedback(key="my_key") to access by key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L794" + }, + "AppTest.file_uploader": { + "name": "file_uploader", + "signature": "AppTest.file_uploader", + "description": "

Sequence of all st.file_uploader widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of FileUploader", + "is_generator": false, + "description": "

Sequence of all st.file_uploader widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.file_uploader[0] for the first widget or\nat.file_uploader(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L808" + }, + "AppTest.from_file": { + "name": "from_file", + "signature": "AppTest.from_file(cls, script_path, *, default_timeout=3)", + "examples": "

Initialize a multipage app from its entrypoint, then switch to a page:

\n
\nat = AppTest.from_file("app.py").run()\nat.switch_page("pages/settings.py").run()\n
\n", + "description": "

Create an AppTest for an app entrypoint defined in a file.

\n

This option is most convenient for CI workflows and testing of\npublished apps. The script must be executable on its own and so must\ncontain all necessary imports. For a multipage app, pass the main\nscript that you would supply to streamlit run. To test a\nfile-based child page, initialize from the main script and use\nAppTest.switch_page().

\n", + "args": [ + { + "name": "script_path", + "type_name": "str | Path", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Path to the app's entrypoint script. An absolute path is used as\ngiven. A relative path is resolved against the Python file that\ncalls AppTest.from_file().

\n", + "default": null + }, + { + "name": "default_timeout", + "type_name": "float", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Default time in seconds before a script run is timed out. Can be\noverridden for individual .run() calls.

\n", + "default": "time" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "

A simulated Streamlit app for testing. The simulated app can be\nexecuted via .run().

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L290" + }, + "AppTest.from_function": { + "name": "from_function", + "signature": "AppTest.from_function(cls, script, *, default_timeout=3, args=None, kwargs=None)", + "description": "

Create an instance of AppTest to simulate an app page defined within a function.

\n

This is similar to AppTest.from_string(), but more convenient to\nwrite with IDE assistance. The script must be executable on its own and\nso must contain all necessary imports.

\n", + "args": [ + { + "name": "script", + "type_name": "Callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "

A function whose body will be used as a script. Must be runnable\nin isolation, so it must include any necessary imports.

\n", + "default": null + }, + { + "name": "default_timeout", + "type_name": "float", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Default time in seconds before a script run is timed out. Can be\noverridden for individual .run() calls.

\n", + "default": "time" + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional tuple of args to pass to the script function.

\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "

An optional dict of kwargs to pass to the script function.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "

A simulated Streamlit app for testing. The simulated app can be\nexecuted via .run().

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L240" + }, + "AppTest.from_string": { + "name": "from_string", + "signature": "AppTest.from_string(cls, script, *, default_timeout=3)", + "description": "

Create an instance of AppTest to simulate an app page defined within a string.

\n

This is useful for testing short scripts that fit comfortably as an\ninline string in the test itself, without having to create a separate\nfile for it. The script must be executable on its own and so must\ncontain all necessary imports.

\n", + "args": [ + { + "name": "script", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The string contents of the script to be run.

\n", + "default": null + }, + { + "name": "default_timeout", + "type_name": "float", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Default time in seconds before a script run is timed out. Can be\noverridden for individual .run() calls.

\n", + "default": "time" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "

A simulated Streamlit app for testing. The simulated app can be\nexecuted via .run().

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L193" + }, + "AppTest.get": { + "name": "get", + "signature": "AppTest.get(element_type)", + "description": "

Get elements or widgets of the specified type.

\n

This method returns the collection of all elements or widgets of\nthe specified type on the current page. Retrieve a specific element by\nusing its index (order on page) or key lookup.

\n", + "args": [ + { + "name": "element_type", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

An element attribute of AppTest. For example, "button",\n"caption", or "chat_input".

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Sequence of Elements", + "is_generator": false, + "description": "

Sequence of elements of the given type. Individual elements can\nbe accessed from a Sequence by index (order on the page). When\ngetting and element_type that is a widget, individual widgets\ncan be accessed by key. For example, at.get("text")[0] for the\nfirst st.text element or at.get("slider")(key="my_key") for\nthe st.slider widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1229" + }, + "AppTest.header": { + "name": "header", + "signature": "AppTest.header", + "description": "

Sequence of all st.header elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Header", + "is_generator": false, + "description": "

Sequence of all st.header elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.header[0] for the first element. Header is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L836" + }, + "AppTest.image": { + "name": "image", + "signature": "AppTest.image", + "description": "

Sequence of all st.image elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Image", + "is_generator": false, + "description": "

Sequence of all st.image elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.image[0] for the first element. Image is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L850" + }, + "AppTest.info": { + "name": "info", + "signature": "AppTest.info", + "description": "

Sequence of all st.info elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Info", + "is_generator": false, + "description": "

Sequence of all st.info elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.info[0] for the first element. Info is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L864" + }, + "AppTest.json": { + "name": "json", + "signature": "AppTest.json", + "description": "

Sequence of all st.json elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Json", + "is_generator": false, + "description": "

Sequence of all st.json elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.json[0] for the first element. Json is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L878" + }, + "AppTest.latex": { + "name": "latex", + "signature": "AppTest.latex", + "description": "

Sequence of all st.latex elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Latex", + "is_generator": false, + "description": "

Sequence of all st.latex elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.latex[0] for the first element. Latex is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L892" + }, + "AppTest.main": { + "name": "main", + "signature": "AppTest.main", + "description": "

Sequence of elements within the main body of the app.

\n", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "

A container of elements. Block can be queried for elements in the\nsame manner as AppTest. For example, Block.checkbox will\nreturn all st.checkbox within the associated container.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L509" + }, + "AppTest.markdown": { + "name": "markdown", + "signature": "AppTest.markdown", + "description": "

Sequence of all st.markdown elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Markdown", + "is_generator": false, + "description": "

Sequence of all st.markdown elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.markdown[0] for the first element. Markdown is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L906" + }, + "AppTest.menu_button": { + "name": "menu_button", + "signature": "AppTest.menu_button", + "description": "

Sequence of all st.menu_button widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of MenuButton", + "is_generator": false, + "description": "

Sequence of all st.menu_button widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.menu_button[0] for the first widget or\nat.menu_button(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L934" + }, + "AppTest.metric": { + "name": "metric", + "signature": "AppTest.metric", + "description": "

Sequence of all st.metric elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Metric", + "is_generator": false, + "description": "

Sequence of all st.metric elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.metric[0] for the first element. Metric is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L920" + }, + "AppTest.multiselect": { + "name": "multiselect", + "signature": "AppTest.multiselect", + "description": "

Sequence of all st.multiselect widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Multiselect", + "is_generator": false, + "description": "

Sequence of all st.multiselect widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.multiselect[0] for the first widget or\nat.multiselect(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L948" + }, + "AppTest.number_input": { + "name": "number_input", + "signature": "AppTest.number_input", + "description": "

Sequence of all st.number_input widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of NumberInput", + "is_generator": false, + "description": "

Sequence of all st.number_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.number_input[0] for the first widget or\nat.number_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L962" + }, + "AppTest.pills": { + "name": "pills", + "signature": "AppTest.pills", + "description": "

Sequence of all st.pills widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ButtonGroup", + "is_generator": false, + "description": "

Sequence of all st.pills widgets (filtered by style).\nIndividual widgets can be accessed from a WidgetList by index\n(order on the page) or key. For example, at.pills[0] for\nthe first widget or at.pills(key="my_key") for a widget\nwith a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L565" + }, + "AppTest.radio": { + "name": "radio", + "signature": "AppTest.radio", + "description": "

Sequence of all st.radio widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Radio", + "is_generator": false, + "description": "

Sequence of all st.radio widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.radio[0] for the first widget or\nat.radio(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L976" + }, + "AppTest.run": { + "name": "run", + "signature": "AppTest.run(*, timeout=None)", + "description": "

Run the script from the current state.

\n

This is equivalent to manually rerunning the app or the rerun that\noccurs upon user interaction. AppTest.run() must be manually called\nafter updating a widget value or switching pages as script reruns do\nnot occur automatically as they do for live-running Streamlit apps.

\n", + "args": [ + { + "name": "timeout", + "type_name": "float or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. If timeout is\nNone (default), Streamlit uses the default timeout set for the\ninstance of AppTest.

\n", + "default": "timeout" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "

self

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L442" + }, + "AppTest.segmented_control": { + "name": "segmented_control", + "signature": "AppTest.segmented_control", + "description": "

Sequence of all st.segmented_control widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ButtonGroup", + "is_generator": false, + "description": "

Sequence of all st.segmented_control widgets (filtered by style).\nIndividual widgets can be accessed from a WidgetList by index\n(order on the page) or key. For example, at.segmented_control[0]\nfor the first widget or at.segmented_control(key="my_key")\nfor a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L580" + }, + "AppTest.select_slider": { + "name": "select_slider", + "signature": "AppTest.select_slider", + "description": "

Sequence of all st.select_slider widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of SelectSlider", + "is_generator": false, + "description": "

Sequence of all st.select_slider widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.select_slider[0] for the first widget or\nat.select_slider(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L990" + }, + "AppTest.selectbox": { + "name": "selectbox", + "signature": "AppTest.selectbox", + "description": "

Sequence of all st.selectbox widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Selectbox", + "is_generator": false, + "description": "

Sequence of all st.selectbox widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.selectbox[0] for the first widget or\nat.selectbox(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1004" + }, + "AppTest.sidebar": { + "name": "sidebar", + "signature": "AppTest.sidebar", + "description": "

Sequence of all elements within st.sidebar.

\n", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "

A container of elements. Block can be queried for elements in the\nsame manner as AppTest. For example, Block.checkbox will\nreturn all st.checkbox within the associated container.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L522" + }, + "AppTest.slider": { + "name": "slider", + "signature": "AppTest.slider", + "description": "

Sequence of all st.slider widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Slider", + "is_generator": false, + "description": "

Sequence of all st.slider widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.slider[0] for the first widget or\nat.slider(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1018" + }, + "AppTest.status": { + "name": "status", + "signature": "AppTest.status", + "description": "

Sequence of all st.status elements.

\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Status", + "is_generator": false, + "description": "

Sequence of all st.status elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, at.status[0] for the first element. Status is an\nextension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1060" + }, + "AppTest.subheader": { + "name": "subheader", + "signature": "AppTest.subheader", + "description": "

Sequence of all st.subheader elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Subheader", + "is_generator": false, + "description": "

Sequence of all st.subheader elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.subheader[0] for the first element. Subheader is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1032" + }, + "AppTest.success": { + "name": "success", + "signature": "AppTest.success", + "description": "

Sequence of all st.success elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Success", + "is_generator": false, + "description": "

Sequence of all st.success elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.success[0] for the first element. Success is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1046" + }, + "AppTest.switch_page": { + "name": "switch_page", + "signature": "AppTest.switch_page(page_path)", + "examples": "
\nat = AppTest.from_file("app.py").run()\nat.switch_page("pages/settings.py").run()\n
\n", + "description": "

Switch to a file-based page relative to the app's main script.

\n

This method does not automatically rerun the app. Use a follow-up call\nto AppTest.run() to obtain the elements on the selected page. The\nmain script supplied to AppTest.from_file() remains the path root\nafter switching pages.

\n", + "args": [ + { + "name": "page_path", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Path of the page to switch to. The path must be relative to the\nmain script's location (e.g. "pages/my_page.py").

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "

self

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L465" + }, + "AppTest.table": { + "name": "table", + "signature": "AppTest.table", + "description": "

Sequence of all st.table elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Table", + "is_generator": false, + "description": "

Sequence of all st.table elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.table[0] for the first element. Table is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1074" + }, + "AppTest.tabs": { + "name": "tabs", + "signature": "AppTest.tabs", + "description": "

Sequence of all tabs within st.tabs elements.

\n

Each tab within a single st.tabs will be returned as a separate Tab\nin the Sequence. Additionally, the tab labels are forwarded to each\nTab element as a property. For example, st.tabs("A","B") will\nyield two Tab objects, with Tab.label returning "A" and "B",\nrespectively.

\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Tab", + "is_generator": false, + "description": "

Sequence of all tabs within st.tabs elements. Individual\ntabs can be accessed from an ElementList by index (order on the\npage). For example, at.tabs[0] for the first tab. Tab is an\nextension of the Block class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1088" + }, + "AppTest.text": { + "name": "text", + "signature": "AppTest.text", + "description": "

Sequence of all st.text elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Text", + "is_generator": false, + "description": "

Sequence of all st.text elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.text[0] for the first element. Text is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1108" + }, + "AppTest.text_area": { + "name": "text_area", + "signature": "AppTest.text_area", + "description": "

Sequence of all st.text_area widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextArea", + "is_generator": false, + "description": "

Sequence of all st.text_area widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.text_area[0] for the first widget or\nat.text_area(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1122" + }, + "AppTest.text_input": { + "name": "text_input", + "signature": "AppTest.text_input", + "description": "

Sequence of all st.text_input widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextInput", + "is_generator": false, + "description": "

Sequence of all st.text_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.text_input[0] for the first widget or\nat.text_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1136" + }, + "AppTest.time_input": { + "name": "time_input", + "signature": "AppTest.time_input", + "description": "

Sequence of all st.time_input widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TimeInput", + "is_generator": false, + "description": "

Sequence of all st.time_input widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.time_input[0] for the first widget or\nat.time_input(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1150" + }, + "AppTest.title": { + "name": "title", + "signature": "AppTest.title", + "description": "

Sequence of all st.title elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Title", + "is_generator": false, + "description": "

Sequence of all st.title elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.title[0] for the first element. Title is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1164" + }, + "AppTest.toast": { + "name": "toast", + "signature": "AppTest.toast", + "description": "

Sequence of all st.toast elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Toast", + "is_generator": false, + "description": "

Sequence of all st.toast elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.toast[0] for the first element. Toast is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1178" + }, + "AppTest.toggle": { + "name": "toggle", + "signature": "AppTest.toggle", + "description": "

Sequence of all st.toggle widgets.

\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Toggle", + "is_generator": false, + "description": "

Sequence of all st.toggle widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, at.toggle[0] for the first widget or\nat.toggle(key="my_key") for a widget with a given key.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1192" + }, + "AppTest.warning": { + "name": "warning", + "signature": "AppTest.warning", + "description": "

Sequence of all st.warning elements.

\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Warning", + "is_generator": false, + "description": "

Sequence of all st.warning elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, at.warning[0] for the first element. Warning is an\nextension of the Element class.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/app_test.py#L1206" + }, + "streamlit.testing.v1.element_tree.Button": { + "name": "Button", + "signature": "st.testing.v1.element_tree.Button(proto, root)", + "is_class": true, + "methods": [ + { + "name": "click", + "signature": "st.testing.v1.element_tree.click.click()", + "description": "

Set the value of the button to True.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L367" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the button.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L362" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The value of the button. (bool)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L353" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L330", + "description": "

A representation of st.button and st.form_submit_button.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.ButtonGroup": { + "name": "ButtonGroup", + "signature": "st.testing.v1.element_tree.ButtonGroup(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "select", + "signature": "st.testing.v1.element_tree.select.select(v)", + "description": "

Add a selection to the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L892" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L883" + }, + { + "name": "unselect", + "signature": "st.testing.v1.element_tree.unselect.unselect(v)", + "description": "

Remove a selection from the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L908" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "

The widget's formatting function for displaying options. (callable)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L877" + }, + { + "name": "formatted_values", + "signature": "st.testing.v1.element_tree.formatted_values.formatted_values", + "description": "

The formatted string values for the current selection.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L862" + }, + { + "name": "indices", + "signature": "st.testing.v1.element_tree.indices.indices", + "description": "

The indices of the currently selected values from the options. (list)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L857" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The currently selected value(s) from the options.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L844" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L812", + "description": "

A representation of st.pills and st.segmented_control.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.ChatInput": { + "name": "ChatInput", + "signature": "st.testing.v1.element_tree.ChatInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L426" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The value of the widget. (str)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L439" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L414", + "description": "

A representation of st.chat_input.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Checkbox": { + "name": "Checkbox", + "signature": "st.testing.v1.element_tree.Checkbox(proto, root)", + "is_class": true, + "methods": [ + { + "name": "check", + "signature": "st.testing.v1.element_tree.check.check()", + "description": "

Set the value of the widget to True.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L485" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L480" + }, + { + "name": "uncheck", + "signature": "st.testing.v1.element_tree.uncheck.uncheck()", + "description": "

Set the value of the widget to False.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L489" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The value of the widget. (bool)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L471" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L449", + "description": "

A representation of st.checkbox.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.ColorPicker": { + "name": "ColorPicker", + "signature": "st.testing.v1.element_tree.ColorPicker(proto, root)", + "is_class": true, + "methods": [ + { + "name": "pick", + "signature": "st.testing.v1.element_tree.pick.pick(v)", + "description": "

Set the value of the widget as a hex string. May omit the "#" prefix.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L556" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget as a hex string.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L551" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The currently selected value as a hex string. (str)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L531" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L516", + "description": "

A representation of st.color_picker.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.DateInput": { + "name": "DateInput", + "signature": "st.testing.v1.element_tree.DateInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L610" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The value of the widget. (date or Tuple of date)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L624" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L590", + "description": "

A representation of st.date_input.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.DateTimeInput": { + "name": "DateTimeInput", + "signature": "st.testing.v1.element_tree.DateTimeInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1896" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The current value of the widget. (datetime)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1924" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1877", + "description": "

A representation of st.datetime_input.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.DownloadButton": { + "name": "DownloadButton", + "signature": "st.testing.v1.element_tree.DownloadButton(proto, root)", + "is_class": true, + "methods": [ + { + "name": "click", + "signature": "st.testing.v1.element_tree.click.click()", + "description": "

Set the value of the download button to True.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L409" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the download button.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L404" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The value of the download button. (bool)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L395" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L372", + "description": "

A representation of st.download_button.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Element": { + "name": "Element", + "signature": "st.testing.v1.element_tree.Element(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The value or contents of the element.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L160" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L131", + "description": "

Element base class for testing.

\n

This class's methods and attributes are universal for all elements\nimplemented in testing. For example, Caption, Code, Text, and\nTitle inherit from Element. All widget classes also\ninherit from Element, but have additional methods specific to each\nwidget type. See the AppTest class for the full list of supported\nelements.

\n

For all element classes, parameters of the original element can be obtained\nas properties. For example, Button.label, Caption.help, and\nToast.icon.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Feedback": { + "name": "Feedback", + "signature": "st.testing.v1.element_tree.Feedback(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the feedback widget. (int or None)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L974" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The currently selected feedback value. (int or None)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L965" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L928", + "description": "

A representation of st.feedback.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.FileUploader": { + "name": "FileUploader", + "signature": "st.testing.v1.element_tree.FileUploader(proto, root)", + "is_class": true, + "methods": [ + { + "name": "clear", + "signature": "st.testing.v1.element_tree.clear.clear()", + "description": "

Clear all uploaded files.

", + "args": [], + "returns": [ + { + "type_name": "FileUploader", + "is_generator": false, + "description": "

The FileUploader instance for method chaining.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1097" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(files)", + "description": "

Set the uploaded file(s) for testing.

", + "args": [ + { + "name": "files", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

A tuple of (filename, content, mime_type) for single file upload,\nor a sequence of such tuples for multiple file upload.\nSet to None to clear uploaded files.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "FileUploader", + "is_generator": false, + "description": "

The FileUploader instance for method chaining.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1030" + }, + { + "name": "upload", + "signature": "st.testing.v1.element_tree.upload.upload(filename, content, mime_type=\"application/octet-stream\")", + "description": "

Upload a single file for testing.

", + "args": [ + { + "name": "filename", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

The name of the file.

\n", + "default": null + }, + { + "name": "content", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

The file content as bytes.

\n", + "default": null + }, + { + "name": "mime_type", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "

The MIME type of the file. Defaults to "application/octet-stream".

\n", + "default": "\"application/octet-stream\"" + } + ], + "returns": [ + { + "type_name": "FileUploader", + "is_generator": false, + "description": "

The FileUploader instance for method chaining.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1068" + } + ], + "properties": [ + { + "name": "accept_directory", + "signature": "st.testing.v1.element_tree.accept_directory.accept_directory", + "description": "

Whether directory uploads are accepted. (bool)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1020" + }, + { + "name": "accept_multiple_files", + "signature": "st.testing.v1.element_tree.accept_multiple_files.accept_multiple_files", + "description": "

Whether multiple files can be uploaded. (bool)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1015" + }, + { + "name": "allowed_type", + "signature": "st.testing.v1.element_tree.allowed_type.allowed_type", + "description": "

Allowed file types for upload. (list of str)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1025" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The current uploaded file(s).

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1179" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L980", + "example": "
\nat = AppTest.from_string('''\n    import streamlit as st\n    uploaded = st.file_uploader("Upload a file")\n    if uploaded:\n        st.write(f"Uploaded: {uploaded.name}")\n''')\nat.run()\nat.file_uploader[0].set_value(("data.csv", b"col1,col2\\n1,2", "text/csv"))\nat.run()\nat.markdown[0].value\n'Uploaded: data.csv'\n
\n", + "description": "

A representation of st.file_uploader.

\n

Files are provided as tuples of (filename, content, mime_type).

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.MenuButton": { + "name": "MenuButton", + "signature": "st.testing.v1.element_tree.MenuButton(proto, root)", + "is_class": true, + "methods": [ + { + "name": "click", + "signature": "st.testing.v1.element_tree.click.click(v)", + "description": "

Click an option by value, simulating user selection.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1246" + }, + { + "name": "click_index", + "signature": "st.testing.v1.element_tree.click_index.click_index(index)", + "description": "

Click an option by index, simulating user selection.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1250" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the selected option value.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1241" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "

The widget's formatting function for displaying options. (callable)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1234" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The selected option value, or None if no option was clicked. (Any)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1223" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1191", + "description": "

A representation of st.menu_button.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Multiselect": { + "name": "Multiselect", + "signature": "st.testing.v1.element_tree.Multiselect(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "select", + "signature": "st.testing.v1.element_tree.select.select(v)", + "description": "

Add a selection to the widget. Do nothing if the value is already selected. If testing a multiselect widget with repeated options, use set_value instead.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1320" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the multiselect widget. (list)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1314" + }, + { + "name": "unselect", + "signature": "st.testing.v1.element_tree.unselect.unselect(v)", + "description": "

Remove a selection from the widget. Do nothing if the value is not already selected. If a value is selected multiple times, the first instance is removed.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1334" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "

The widget's formatting function for displaying options. (callable)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1308" + }, + { + "name": "indices", + "signature": "st.testing.v1.element_tree.indices.indices", + "description": "

The indices of the currently selected values from the options. (list)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1297" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The currently selected values from the options. (list)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1288" + }, + { + "name": "values", + "signature": "st.testing.v1.element_tree.values.values", + "description": "

The currently selected values from the options. (list)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1302" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1259", + "description": "

A representation of st.multiselect.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.NumberInput": { + "name": "NumberInput", + "signature": "st.testing.v1.element_tree.NumberInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "decrement", + "signature": "st.testing.v1.element_tree.decrement.decrement()", + "description": "

Decrement the st.number_input widget as if the user clicked "-".

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1405" + }, + { + "name": "increment", + "signature": "st.testing.v1.element_tree.increment.increment()", + "description": "

Increment the st.number_input widget as if the user clicked "+".

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1397" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the st.number_input widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1373" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The current value of the st.number_input widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1386" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1353", + "description": "

A representation of st.number_input.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Radio": { + "name": "Radio", + "signature": "st.testing.v1.element_tree.Radio(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the selection by value.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1456" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "

The widget's formatting function for displaying options. (callable)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1450" + }, + { + "name": "index", + "signature": "st.testing.v1.element_tree.index.index", + "description": "

The index of the current selection. (int)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1433" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The currently selected value from the options. (Any)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1441" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1414", + "description": "

A representation of st.radio.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.SelectSlider": { + "name": "SelectSlider", + "signature": "st.testing.v1.element_tree.SelectSlider(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_range", + "signature": "st.testing.v1.element_tree.set_range.set_range(lower, upper)", + "description": "

Set the ranged selection by values.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1616" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the (single) selection by value.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1564" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "

The widget's formatting function for displaying options. (callable)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1610" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The currently selected value or range. (Any or Sequence of Any)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1600" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1546", + "description": "

A representation of st.select_slider.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Selectbox": { + "name": "Selectbox", + "signature": "st.testing.v1.element_tree.Selectbox(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "select", + "signature": "st.testing.v1.element_tree.select.select(v)", + "description": "

Set the selection by value.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1523" + }, + { + "name": "select_index", + "signature": "st.testing.v1.element_tree.select_index.select_index(index)", + "description": "

Set the selection by index.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1527" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the selection by value.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1518" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "

The widget's formatting function for displaying options. (callable)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1512" + }, + { + "name": "index", + "signature": "st.testing.v1.element_tree.index.index", + "description": "

The index of the current selection. (int)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1492" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The currently selected value from the options. (Any)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1503" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1474", + "description": "

A representation of st.selectbox.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Slider": { + "name": "Slider", + "signature": "st.testing.v1.element_tree.Slider(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_range", + "signature": "st.testing.v1.element_tree.set_range.set_range(lower, upper)", + "description": "

Set the ranged value of the slider.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1671" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the (single) value of the slider.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1643" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The currently selected value or range. (Any or Sequence of Any)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1661" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1624", + "description": "

A representation of st.slider.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.TextArea": { + "name": "TextArea", + "signature": "st.testing.v1.element_tree.TextArea(proto, root)", + "is_class": true, + "methods": [ + { + "name": "input", + "signature": "st.testing.v1.element_tree.input.input(v)", + "description": "

Set the value of the widget only if the value does not exceed the maximum allowed characters.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1753" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1730" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The current value of the widget. (str)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1743" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1712", + "description": "

A representation of st.text_area.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.TextInput": { + "name": "TextInput", + "signature": "st.testing.v1.element_tree.TextInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "input", + "signature": "st.testing.v1.element_tree.input.input(v)", + "description": "

Set the value of the widget only if the value does not exceed the maximum allowed characters.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1805" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1782" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The current value of the widget. (str)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1795" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1764", + "description": "

A representation of st.text_input.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.TimeInput": { + "name": "TimeInput", + "signature": "st.testing.v1.element_tree.TimeInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "decrement", + "signature": "st.testing.v1.element_tree.decrement.decrement()", + "description": "

Select the previous available time.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1869" + }, + { + "name": "increment", + "signature": "st.testing.v1.element_tree.increment.increment()", + "description": "

Select the next available time.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1862" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1836" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The current value of the widget. (time)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1852" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1820", + "description": "

A representation of st.time_input.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Toggle": { + "name": "Toggle", + "signature": "st.testing.v1.element_tree.Toggle(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1982" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The current value of the widget. (bool)

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1973" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L1950", + "description": "

A representation of st.toggle.

\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Widget": { + "name": "Widget", + "signature": "st.testing.v1.element_tree.Widget(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "

Run the AppTest script which contains the element.

", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "

The maximum number of seconds to run the script. None means\nuse the AppTest's default.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L170" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "

Set the value of the widget.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L221" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "

The value or contents of the element.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L160" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/testing/v1/element_tree.py#L206", + "description": "

Widget base class for testing.

\n", + "args": [], + "returns": [] + }, + "streamlit.user.to_dict": { + "name": "to_dict", + "signature": "st.user.to_dict()", + "description": "

Get user info as a dictionary.

\n

This method primarily exists for internal use and is not needed for\nmost cases. st.user returns an object that inherits from\ndict by default.

\n", + "args": [], + "returns": [ + { + "type_name": "Dict[str,str]", + "is_generator": false, + "description": "

A dictionary of the current user's information.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/user_info.py#L679" + }, + "streamlit.user.tokens": { + "name": "tokens", + "signature": "st.user.tokens", + "description": "

Access exposed tokens via a dict-like object.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/metrics_util.py#L695" + }, + "context.cookies": { + "name": "cookies", + "signature": "context.cookies", + "examples": "

Example 1: Access all available cookies

\n

Show a dictionary of cookies:

\n
\nimport streamlit as st\n\nst.context.cookies\n
\n

Example 2: Access a specific cookie

\n

Show the value of a specific cookie:

\n
\nimport streamlit as st\n\nst.context.cookies["_ga"]\n
\n", + "description": "

A read-only, dict-like object containing cookies sent in the initial request.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L194" + }, + "context.headers": { + "name": "headers", + "signature": "context.headers", + "examples": "

Example 1: Access all available headers

\n

Show a dictionary of headers (with only the last instance of any\nrepeated key):

\n
\nimport streamlit as st\n\nst.context.headers\n
\n

Example 2: Access a specific header

\n

Show the value of a specific header (or the last instance if it's\nrepeated):

\n
\nimport streamlit as st\n\nst.context.headers["host"]\n
\n

Show of list of all headers for a given key:

\n
\nimport streamlit as st\n\nst.context.headers.get_all("pragma")\n
\n", + "description": "

A read-only, dict-like object containing headers sent in the initial request.

\n

Keys are case-insensitive and may be repeated. When keys are repeated,\ndict-like methods will only return the last instance of each key. Use\n.get_all(key="your_repeated_key") to see all values if the same\nheader is set multiple times.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L148" + }, + "context.ip_address": { + "name": "ip_address", + "signature": "context.ip_address", + "examples": "

Check if the user has an IPv4 or IPv6 address:

\n
\nimport streamlit as st\n\nip = st.context.ip_address\nif ip is None:\n    st.write("No IP address. This is expected in local development.")\nelif ip.contains(":"):\n    st.write("You have an IPv6 address.")\nelif ip.contains("."):\n    st.write("You have an IPv4 address.")\nelse:\n    st.error("This should not happen.")\n
\n", + "description": "

The read-only IP address of the user's connection.

\n

This should not be used for security measures because it can easily be\nspoofed. When a user accesses the app through localhost, the IP\naddress is None. Otherwise, the IP address is determined from the\nWebSocket connection and may be an IPv4 or IPv6 address.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L382" + }, + "context.is_embedded": { + "name": "is_embedded", + "signature": "context.is_embedded", + "examples": "

Conditionally show content when the app is running in an embedded\ncontext:

\n
\nimport streamlit as st\n\nif st.context.is_embedded:\n    st.write("You are running the app in an embedded context.")\n
\n", + "description": "

Whether the app is embedded.

\n

This property returns a boolean value indicating whether the app is\nrunning in an embedded context. This is determined by the presence of\nembed=true as a query parameter in the URL. This is the only way to\ndetermine if the app is currently configured for embedding because\nembedding settings are not accessible through st.query_params or\nst.context.url.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L416" + }, + "context.locale": { + "name": "locale", + "signature": "context.locale", + "examples": "

Access the user's locale to display locally:

\n
\nimport streamlit as st\n\nif st.context.locale == "fr-FR":\n    st.write("Bonjour!")\nelse:\n    st.write("Hello!")\n
\n", + "description": "

The read-only locale of the user's browser.

\n

st.context.locale returns the value of navigator.language from\nthe user's DOM. This is a string representing the user's preferred\nlanguage (e.g. "en-US").

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L323" + }, + "context.theme": { + "name": "theme", + "signature": "context.theme", + "examples": "

Access the theme type of the app:

\n
\nimport streamlit as st\n\nst.write(f"The current theme type is {st.context.theme.type}.")\n
\n", + "description": "

A read-only, dictionary-like object containing theme information.

\n

Theme information is restricted to the type of the theme (dark or\nlight) and is inferred from the background color of the app.

\n
\n

Note

\n

Changes made to the background color through CSS are not included.\nAdditionally, the theme type may be incorrect during a change in\ntheme, like in the following situations:

\n
    \n
  • When the app is first loaded within a session
  • \n
  • When the user changes the theme in the settings menu
  • \n
\n

For more information and to upvote an improvement, see GitHub issue\n#11920.

\n
\n", + "args": [ + { + "name": "type", + "type_name": "\"light\", \"dark\"", + "is_optional": false, + "description": "

The theme type inferred from the background color of the app.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L227" + }, + "context.timezone": { + "name": "timezone", + "signature": "context.timezone", + "examples": "

Access the user's timezone, and format a datetime to display locally:

\n
\nimport streamlit as st\nfrom datetime import datetime, timezone\nimport pytz\n\ntz = st.context.timezone\ntz_obj = pytz.timezone(tz)\n\nnow = datetime.now(timezone.utc)\n\nf"The user's timezone is {tz}."\nf"The UTC time is {now}."\nf"The user's local time is {now.astimezone(tz_obj)}"\n
\n", + "description": "

The read-only timezone of the user's browser.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L267" + }, + "context.timezone_offset": { + "name": "timezone_offset", + "signature": "context.timezone_offset", + "examples": "

Access the user's timezone offset, and format a datetime to display locally:

\n
\nimport streamlit as st\nfrom datetime import datetime, timezone, timedelta\n\ntzoff = st.context.timezone_offset\ntz_obj = timezone(-timedelta(minutes=tzoff))\n\nnow = datetime.now(timezone.utc)\n\nf"The user's timezone is {tz}."\nf"The UTC time is {now}."\nf"The user's local time is {now.astimezone(tz_obj)}"\n
\n", + "description": "

The read-only timezone offset of the user's browser.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L296" + }, + "context.url": { + "name": "url", + "signature": "context.url", + "examples": "

Conditionally show content when you access your app through\nlocalhost:

\n
\nimport streamlit as st\n\nif st.context.url.startswith("http://localhost"):\n    st.write("You are running the app locally.")\n
\n", + "description": "

The read-only URL of the app in the user's browser.

\n

st.context.url returns the URL through which the user is accessing\nthe app. This includes the scheme, domain name, port, and path. If\nquery parameters or anchors are present in the URL, they are removed\nand not included in this value.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L352" + }, + "CachedFunc.clear": { + "name": "clear", + "signature": "CachedFunc.clear(*args, **kwargs)", + "examples": "
\nimport streamlit as st\nimport time\n\n@st.cache_data\ndef foo(bar):\n    time.sleep(2)\n    st.write(f"Executed foo({bar}).")\n    return bar\n\nif st.button("Clear all cached values for `foo`", on_click=foo.clear):\n    foo.clear()\n\nif st.button("Clear the cached value of `foo(1)`"):\n    foo.clear(1)\n\nfoo(1)\nfoo(2)\n
\n", + "description": "

Clear the cached function's associated cache.

\n

If no arguments are passed, Streamlit will clear all values cached for\nthe function. If arguments are passed, Streamlit will clear the cached\nvalue for these arguments only.

\n", + "args": [ + { + "name": "*args", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": false, + "description": "

Arguments of the cached functions.

\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": true, + "description": "

Keyword arguments of the cached function.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/caching/cache_utils.py#L752" + }, + "StreamlitPage": { + "name": "StreamlitPage", + "signature": "StreamlitPage(page, *, title=None, icon=None, url_path=None, default=False, visibility=\"visible\")", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": ".run.run()", + "description": "

Execute the page.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L446" + } + ], + "properties": [ + { + "name": "external_url", + "signature": ".external_url.external_url", + "description": "

The external URL of the page, if this is an external link.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L438" + }, + { + "name": "icon", + "signature": ".icon.icon", + "description": "

The icon of the page.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L393" + }, + { + "name": "is_external", + "signature": ".is_external.is_external", + "description": "

Whether this page is an external URL.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L428" + }, + { + "name": "title", + "signature": ".title.title", + "description": "

The title of the page.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L380" + }, + { + "name": "url_path", + "signature": ".url_path.url_path", + "description": "

The page's URL pathname, which is the path relative to the app's root URL.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L401" + }, + { + "name": "visibility", + "signature": ".visibility.visibility", + "description": "

The visibility of the page in the navigation menu.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L416" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L54", + "example": "
\nimport streamlit as st\n\ndef page2():\n    st.title("Second page")\n\npg = st.navigation([\n    st.Page("page1.py", title="First page", icon="\ud83d\udd25"),\n    st.Page(page2, title="Second page", icon=":material/favorite:"),\n    st.Page(\n        "https://docs.streamlit.io",\n        title="Streamlit Docs",\n        icon=":material/open_in_new:"\n    ),\n])\npg.run()\n
\n", + "description": "

Configure a page for st.navigation in a multipage app.

\n

Call st.Page to initialize a Page object, and pass it to\nst.navigation to declare a page in your app.

\n

When a user navigates to a page, st.navigation returns the selected\nPage object. Call .run() on the returned Page\nobject to execute the page. You can only run the page returned by\nst.navigation, and you can only run it once per app rerun.

\n

A page can be defined by a Python file, Callable, or external URL.

\n", + "args": [ + { + "name": "page", + "type_name": "str, Path, or callable", + "is_optional": false, + "description": "

The source for the internal or external page. This can be one of the\nfollowing values:

\n
    \n
  • callable: Streamlit executes the callable when it runs the page.\nThe callable can't accept arguments.
  • \n
  • Path to a Python file: Streamlit executes the Python script when it\nruns the page. The path can be a string or pathlib.Path\nobject. It can be absolute or relative to the entrypoint file.
  • \n
  • URL: Streamlit opens the URL in a new tab when a user selects it\nin the navigation menu or a page link. In this case, the app doesn't\nrerun. The URL must contain an HTTP or HTTPS scheme, like\n"https://docs.streamlit.io". If the page is defined by a URL,\nthen the title parameter is required.
  • \n
\n", + "default": null + }, + { + "name": "title", + "type_name": "str or None", + "is_optional": false, + "description": "

The title of the page. If this is None (default), the page title\n(in the browser tab) and label (in the navigation menu) will be\ninferred from the filename or callable name in page. For more\ninformation, see Overview of multipage apps.

\n

The title supports GitHub-flavored Markdown of the following types:\nBold, Italics, Strikethrough, Inline Code, and Images. Images display\nlike icons, with a max height equal to the font height.

\n

Unsupported Markdown elements are unwrapped so only their children\n(text contents) render. Common block-level Markdown (headings,\nlists, blockquotes) is automatically escaped and displays as\nliteral text in labels.

\n

See the body parameter of st.markdown for additional, supported\nMarkdown directives.

\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "description": "

An optional emoji or icon to display next to the page title and label.\nIf icon is None (default), no icon is displayed next to the\npage label in the navigation menu, and a Streamlit icon is displayed\nnext to the title (in the browser tab). If icon is a string, the\nfollowing options are valid:

\n
    \n
  • \n
    A single-character emoji. For example, you can set icon="\ud83d\udea8"
    \n

    or icon="\ud83d\udd25". Emoji short codes are not supported.

    \n
    \n
    \n
  • \n
  • \n
    An icon from the Material Symbols library (rounded style) in the
    \n

    format ":material/icon_name:" where "icon_name" is the name\nof the icon in snake case.

    \n

    For example, icon=":material/thumb_up:" will display the\nThumb Up icon. Find additional icons in the Material Symbols\nfont library.

    \n
    \n
    \n
  • \n
  • "spinner": Displays a spinner as an icon. In this case, the\nspinner only displays next to the page label in the navigation menu.\nThe spinner isn't used as the page favicon next to the title in the\nbrowser tab. The favicon is the default Streamlit icon unless\notherwise specified with the page_icon parameter of\nst.set_page_config.

    \n
  • \n
\n", + "default": "Streamlit" + }, + { + "name": "url_path", + "type_name": "str or None", + "is_optional": false, + "description": "

The page's URL pathname, which is the path relative to the app's root\nURL. If this is None (default), the URL pathname will be inferred\nfrom the filename or callable name in page. For more information,\nsee Overview of multipage apps.

\n

The default page will have a pathname of "", indicating the root\nURL of the app. If you set default=True, url_path is ignored.\nurl_path can't include forward slashes; paths can't include\nsubdirectories.

\n", + "default": "page" + }, + { + "name": "default", + "type_name": "bool", + "is_optional": false, + "description": "

Whether this page is the default page to be shown when the app is\nloaded. If default is False (default), the page will have a\nnonempty URL pathname. However, if no default page is passed to\nst.navigation and this is the first page, this page will become the\ndefault page. If default is True, then the page will have\nan empty pathname and url_path will be ignored.

\n", + "default": "page" + }, + { + "name": "visibility", + "type_name": "\"visible\" or \"hidden\"", + "is_optional": false, + "description": "

Whether the page is shown in the navigation menu. If this is\n"visible" (default), the page appears in the navigation menu. If\nthis is "hidden", the page is excluded from the navigation menu.\nHidden pages defined by Python files or callables remain accessible\nby st.page_link and st.switch_page. External URLs can always\nbe accessed using st.page_link regardless of their inclusion or\nvisibility in the navigation menu.

\n
\n

Note

\n

Navigating to an internal page by URL starts a new session. For\nany internal page to be accessible by URL, it must be passed to\nst.navigation during the new session's initial script\nrun. The page can be visible or hidden.

\n
\n", + "default": null + }, + { + "name": "icon", + "type_name": "str", + "is_optional": false, + "description": "

The icon of the page.

\n

If no icon was declared in st.Page, this property returns "".

\n", + "default": null + }, + { + "name": "title", + "type_name": "str", + "is_optional": false, + "description": "

The title of the page.

\n

Unless declared otherwise in st.Page, the page title is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.

\n

The title supports GitHub-flavored Markdown as described in st.Page.

\n", + "default": null + }, + { + "name": "url_path", + "type_name": "str", + "is_optional": false, + "description": "

The page's URL pathname, which is the path relative to the app's root\nURL.

\n

Unless declared otherwise in st.Page, the URL pathname is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.

\n

The default page will always have a url_path of "" to indicate\nthe root URL (e.g. homepage).

\n", + "default": "page" + }, + { + "name": "visibility", + "type_name": "Literal[\"visible\", \"hidden\"]", + "is_optional": false, + "description": "

Whether the page is shown in the navigation menu. If this is\n"visible" (default), the page appears in the navigation menu. If\nthis is "hidden", the page is excluded from the navigation menu.

\n

For internal pages, hidden pages remain accessible via direct URL,\nst.page_link, or st.switch_page. For external URL pages,\nhidden pages are not URL-accessible or switchable via\nst.switch_page; they can still be linked with st.page_link.

\n
\n

Note

\n

Navigating to an internal page by URL starts a new session.\nFor a hidden page to be accessible by URL, it must be passed\nto st.navigation during the new session's initial script\nrun.

\n
\n", + "default": null + } + ], + "returns": [] + }, + "StreamlitPage.external_url": { + "name": "external_url", + "signature": "StreamlitPage.external_url", + "description": "

The external URL of the page, if this is an external link.

\n

Returns None if this is not an external URL page.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L438" + }, + "StreamlitPage.icon": { + "name": "icon", + "signature": "StreamlitPage.icon", + "description": "

The icon of the page.

\n

If no icon was declared in st.Page, this property returns "".

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L393" + }, + "StreamlitPage.is_external": { + "name": "is_external", + "signature": "StreamlitPage.is_external", + "description": "

Whether this page is an external URL.

\n

If True, clicking this page in the navigation menu will open\nthe external URL in a new browser tab instead of navigating within\nthe app.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L428" + }, + "StreamlitPage.run": { + "name": "run", + "signature": "StreamlitPage.run()", + "description": "

Execute the page.

\n

When a page is returned by st.navigation, use the .run() method\nwithin your entrypoint file to render the page. You can only call this\nmethod on the page returned by st.navigation. You can only call\nthis method once per run of your entrypoint file.

\n

For external URL pages, this method does nothing as the navigation\nto the external URL is handled by the frontend.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L446" + }, + "StreamlitPage.title": { + "name": "title", + "signature": "StreamlitPage.title", + "description": "

The title of the page.

\n

Unless declared otherwise in st.Page, the page title is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.

\n

The title supports GitHub-flavored Markdown as described in st.Page.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L380" + }, + "StreamlitPage.url_path": { + "name": "url_path", + "signature": "StreamlitPage.url_path", + "description": "

The page's URL pathname, which is the path relative to the app's root URL.

\n

Unless declared otherwise in st.Page, the URL pathname is inferred\nfrom the filename or callable name. For more information, see\nOverview of multipage apps.

\n

The default page will always have a url_path of "" to indicate\nthe root URL (e.g. homepage).

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L401" + }, + "StreamlitPage.visibility": { + "name": "visibility", + "signature": "StreamlitPage.visibility", + "description": "

The visibility of the page in the navigation menu.

\n

This property returns "visible" (default) or "hidden".\nHidden internal pages are not shown in the navigation menu but can\nstill be accessed via URL or programmatically using st.switch_page\nor st.page_link. Hidden external pages can only be opened via\nst.page_link.

\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/navigation/page.py#L416" + }, + "streamlit.user": { + "name": "user", + "signature": "st.user()", + "is_class": true, + "methods": [ + { + "name": "to_dict", + "signature": "st.to_dict.to_dict()", + "description": "

Get user info as a dictionary.

", + "args": [], + "returns": [ + { + "type_name": "Dict[str,str]", + "is_generator": false, + "description": "

A dictionary of the current user's information.

\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/user_info.py#L679" + } + ], + "properties": [ + { + "name": "tokens", + "signature": "st.tokens.tokens", + "description": "

Access exposed tokens via a dict-like object.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/metrics_util.py#L695" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/user_info.py#L529", + "examples": "

Example 1: Google's identity token

\n

If you configure a basic Google OIDC connection as shown in Example 1 of\nst.login(), the following data is available in\nst.user. Streamlit adds the is_logged_in attribute.\nAdditional attributes may be available depending on the configuration of\nthe user's Google account. For more information about Google's identity\ntokens, see Obtain user information from the ID token\nin Google's docs.

\n
\nimport streamlit as st\n\nif st.user.is_logged_in:\n    st.write(st.user)\n
\n

Displayed data when a user is logged in:

\n
\n{\n    "is_logged_in":true\n    "iss":"https://accounts.google.com"\n    "azp":"{client_id}.apps.googleusercontent.com"\n    "aud":"{client_id}.apps.googleusercontent.com"\n    "sub":"{unique_user_id}"\n    "email":"{user}@gmail.com"\n    "email_verified":true\n    "at_hash":"{access_token_hash}"\n    "nonce":"{nonce_string}"\n    "name":"{full_name}"\n    "picture":"https://lh3.googleusercontent.com/a/{content_path}"\n    "given_name":"{given_name}"\n    "family_name":"{family_name}"\n    "iat":{issued_time}\n    "exp":{expiration_time}\n    "tokens":{}\n}\n
\n

Example 2: Microsoft's identity token

\n

If you configure a basic Microsoft OIDC connection as shown in Example 2 of\nst.login(), the following data is available in\nst.user. For more information about Microsoft's identity\ntokens, see ID token claims reference\nin Microsoft's docs.

\n
\nimport streamlit as st\n\nif st.user.is_logged_in:\n    st.write(st.user)\n
\n

Displayed data when a user is logged in:

\n
\n{\n    "is_logged_in":true\n    "ver":"2.0"\n    "iss":"https://login.microsoftonline.com/{tenant_id}/v2.0"\n    "sub":"{application_user_id}"\n    "aud":"{application_id}"\n    "exp":{expiration_time}\n    "iat":{issued_time}\n    "nbf":{start_time}\n    "name":"{full_name}"\n    "preferred_username":"{username}"\n    "oid":"{user_GUID}"\n    "email":"{email}"\n    "tid":"{tenant_id}"\n    "nonce":"{nonce_string}"\n    "aio":"{opaque_string}"\n    "tokens":{}\n}\n
\n", + "description": "

A read-only, dict-like object for accessing information about the current user.

\n

st.user is dependent on the host platform running your\nStreamlit app. If your host platform has not configured the object,\nst.user will behave as it does in a locally running app.

\n

When authentication is configured in secrets.toml, Streamlit will parse\nthe OpenID Connect (OIDC) identity token and copy the attributes to\nst.user. Check your provider's documentation for their\navailable attributes (known as claims).

\n

When authentication is not configured, st.user has no\nattributes.

\n

You can access values via key or attribute notation. For example, use\nst.user["email"] or st.user.email to\naccess the email attribute.

\n
\n

Important

\n

Identity tokens include an issuance and expiration time. Streamlit does\nnot implicitly check these. If you want to automatically expire a\nuser's authentication, check these values manually and programmatically\nlog out your user (st.logout()) when needed.

\n
\n", + "args": [ + { + "name": "is_logged_in", + "type_name": "bool", + "is_optional": false, + "description": "

Whether a user is logged in. For a locally running app, this attribute\nis only available when authentication (st.login()) is configured in\nsecrets.toml. Otherwise, it does not exist.

\n", + "default": null + }, + { + "name": "tokens", + "type_name": "TokensProxy", + "is_optional": false, + "description": "

A read-only, dict-like object for accessing exposed tokens from the\nidentity provider.

\n", + "default": null + } + ], + "returns": [] + }, + "streamlit.context": { + "name": "context", + "signature": "st.context()", + "is_class": true, + "methods": [], + "properties": [ + { + "name": "cookies", + "signature": "st.cookies.cookies", + "examples": "

Example 1: Access all available cookies

\n

Show a dictionary of cookies:

\n
\nimport streamlit as st\n\nst.context.cookies\n
\n

Example 2: Access a specific cookie

\n

Show the value of a specific cookie:

\n
\nimport streamlit as st\n\nst.context.cookies["_ga"]\n
\n", + "description": "

A read-only, dict-like object containing cookies sent in the initial request.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L194" + }, + { + "name": "headers", + "signature": "st.headers.headers", + "examples": "

Example 1: Access all available headers

\n

Show a dictionary of headers (with only the last instance of any\nrepeated key):

\n
\nimport streamlit as st\n\nst.context.headers\n
\n

Example 2: Access a specific header

\n

Show the value of a specific header (or the last instance if it's\nrepeated):

\n
\nimport streamlit as st\n\nst.context.headers["host"]\n
\n

Show of list of all headers for a given key:

\n
\nimport streamlit as st\n\nst.context.headers.get_all("pragma")\n
\n", + "description": "

A read-only, dict-like object containing headers sent in the initial request.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L148" + }, + { + "name": "ip_address", + "signature": "st.ip_address.ip_address", + "examples": "

Check if the user has an IPv4 or IPv6 address:

\n
\nimport streamlit as st\n\nip = st.context.ip_address\nif ip is None:\n    st.write("No IP address. This is expected in local development.")\nelif ip.contains(":"):\n    st.write("You have an IPv6 address.")\nelif ip.contains("."):\n    st.write("You have an IPv4 address.")\nelse:\n    st.error("This should not happen.")\n
\n", + "description": "

The read-only IP address of the user's connection.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L382" + }, + { + "name": "is_embedded", + "signature": "st.is_embedded.is_embedded", + "examples": "

Conditionally show content when the app is running in an embedded\ncontext:

\n
\nimport streamlit as st\n\nif st.context.is_embedded:\n    st.write("You are running the app in an embedded context.")\n
\n", + "description": "

Whether the app is embedded.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L416" + }, + { + "name": "locale", + "signature": "st.locale.locale", + "examples": "

Access the user's locale to display locally:

\n
\nimport streamlit as st\n\nif st.context.locale == "fr-FR":\n    st.write("Bonjour!")\nelse:\n    st.write("Hello!")\n
\n", + "description": "

The read-only locale of the user's browser.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L323" + }, + { + "name": "theme", + "signature": "st.theme.theme", + "examples": "

Access the theme type of the app:

\n
\nimport streamlit as st\n\nst.write(f"The current theme type is {st.context.theme.type}.")\n
\n", + "description": "

A read-only, dictionary-like object containing theme information.

", + "args": [ + { + "name": "type", + "type_name": "\"light\", \"dark\"", + "is_optional": false, + "description": "

The theme type inferred from the background color of the app.

\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L227" + }, + { + "name": "timezone", + "signature": "st.timezone.timezone", + "examples": "

Access the user's timezone, and format a datetime to display locally:

\n
\nimport streamlit as st\nfrom datetime import datetime, timezone\nimport pytz\n\ntz = st.context.timezone\ntz_obj = pytz.timezone(tz)\n\nnow = datetime.now(timezone.utc)\n\nf"The user's timezone is {tz}."\nf"The UTC time is {now}."\nf"The user's local time is {now.astimezone(tz_obj)}"\n
\n", + "description": "

The read-only timezone of the user's browser.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L267" + }, + { + "name": "timezone_offset", + "signature": "st.timezone_offset.timezone_offset", + "examples": "

Access the user's timezone offset, and format a datetime to display locally:

\n
\nimport streamlit as st\nfrom datetime import datetime, timezone, timedelta\n\ntzoff = st.context.timezone_offset\ntz_obj = timezone(-timedelta(minutes=tzoff))\n\nnow = datetime.now(timezone.utc)\n\nf"The user's timezone is {tz}."\nf"The UTC time is {now}."\nf"The user's local time is {now.astimezone(tz_obj)}"\n
\n", + "description": "

The read-only timezone offset of the user's browser.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L296" + }, + { + "name": "url", + "signature": "st.url.url", + "examples": "

Conditionally show content when you access your app through\nlocalhost:

\n
\nimport streamlit as st\n\nif st.context.url.startswith("http://localhost"):\n    st.write("You are running the app locally.")\n
\n", + "description": "

The read-only URL of the app in the user's browser.

", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L352" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/context.py#L137", + "description": "

An interface to access user session context.

\n

st.context provides a read-only interface to access headers and cookies\nfor the current user session.

\n

Each property (st.context.headers and st.context.cookies) returns\na dictionary of named values.

\n", + "args": [], + "returns": [] + }, + "ComponentRenderer": { + "name": "ComponentRenderer", + "signature": "ComponentRenderer(*args, **kwargs)", + "is_class": true, + "methods": [], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/components/v2/types.py#L48", + "examples": "

Example 1: Create a bidirectional text input component

\n

If you assign a key to a mounted instance of a component, you can feed its\nstate back into the component through the data parameter. This allows\nyou to both read and write state values from Session State. The following\nexample has a user-friendly wrapper around the mounting command to provide\ntyped parameters and a clean end-user API. A couple buttons demonstrate\nprogrammatic updates to the component's state.

\n
\nimport streamlit as st\n\nHTML = """\n    <label style='padding-right: 1em;' for='txt'>Enter text</label>\n    <input id='txt' type='text' />\n"""\n\nJS = """\n    export default function(component) {\n        const { setStateValue, parentElement, data } = component;\n\n        const label = parentElement.querySelector('label');\n        label.innerText = data.label;\n\n        const input = parentElement.querySelector('input');\n        if (input.value !== data.value) {\n            input.value = data.value ?? '';\n        };\n\n        input.onkeydown = (e) => {\n            if (e.key === 'Enter') {\n                setStateValue('value', e.target.value);\n            }\n        };\n\n        input.onblur = (e) => {\n            setStateValue('value', e.target.value);\n        };\n    }\n"""\n\nmy_component = st.components.v2.component(\n    "my_text_input",\n    html=HTML,\n    js=JS,\n)\n\ndef my_component_wrapper(\n    label, *, default="", key=None, on_change=lambda: None\n):\n    component_state = st.session_state.get(key, {})\n    value = component_state.get("value", default)\n    data = {"label": label, "value": value}\n    result = my_component(\n        data=data,\n        default={"value": value},\n        key=key,\n        on_value_change=on_change,\n    )\n    return result\n\nst.title("My custom component")\n\nif st.button("Hello World"):\n    st.session_state["my_text_input_instance"]["value"] = "Hello World"\nif st.button("Clear text"):\n    st.session_state["my_text_input_instance"]["value"] = ""\nresult = my_component_wrapper(\n    "Enter something",\n    default="I love Streamlit!",\n    key="my_text_input_instance",\n)\n\nst.write("Result:", result)\nst.write("Session state:", st.session_state)\n
\n

Example 2: Add Tailwind CSS to a component

\n

You can use the isolate_styles parameter in\nst.components.v2.component to disable shadow DOM isolation and apply\nglobal styles like Tailwind CSS to your component. The following example\ncreates a simple button styled with Tailwind CSS. This example also\ndemonstrates using different keys to mount multiple instances of the same\ncomponent in one app.

\n
\nimport streamlit as st\n\nwith open("tailwind.js", "r") as f:\n    TAILWIND_SCRIPT = f.read()\n\nHTML = """\n    <button class="bg-blue-500 hover:bg-blue-700 text-white py-1 px-3 rounded">\n        Click me!\n    </button>\n"""\nJS = (\n    TAILWIND_SCRIPT\n    + """\n        export default function(component) {\n            const { setTriggerValue, parentElement } = component;\n            const button = parentElement.querySelector('button');\n            button.onclick = () => {\n                setTriggerValue('clicked', true);\n            };\n        }\n    """\n)\nmy_component = st.components.v2.component(\n    "my_tailwind_button",\n    html=HTML,\n    js=JS,\n    isolate_styles=False,\n)\nresult_1 = my_component(on_clicked_change=lambda: None, key="one")\nresult_1\n\nresult_2 = my_component(on_clicked_change=lambda: None, key="two")\nresult_2\n
\n", + "description": "

Signature of the mounting command returned by st.components.v2.component.

\n

This callable mounts a bidirectional component in a Streamlit app and\nreturns a ComponentResult object that exposes the component's\nstate and trigger values.

\n

For published components, this callable is often wrapped in a user-friendly\ncommand with typed parameters and declared defaults.

\n", + "args": [ + { + "name": "key", + "type_name": "str or None", + "is_optional": false, + "description": "

An optional string to use as the unique key for the\ncomponent instance. If this is omitted, an internal key is generated\nfor the component instance based on its mounting parameters. No two\nStreamlit elements may have the same key.

\n

When a key is defined, the component's state is available in Session\nState via the key.

\n
\n

Note

\n

If you want to access this key in your component's frontend, you\nmust pass it explicitly within the data parameter. The key\nparameter in ComponentRenderer is not the same as the\nkey property in FrontendRendererArgs in the component's frontend\ncode.

\n

The frontend key is automatically generated to be unique among all\ninstances of all components and to avoid collisions with classes\nand IDs in the app's DOM.

\n
\n", + "default": null + }, + { + "name": "data", + "type_name": "Any or None", + "is_optional": false, + "description": "

Data to pass to the component. This can be one of the following:

\n
    \n
  • A JSON-serializable object, like Dict[str, str | int] or\nList[str].
  • \n
  • An Arrow-serializable object, like pandas.DataFrame.
  • \n
  • Raw bytes.
  • \n
  • A dictionary of JSON-serializable and Arrow-serializable objects.\nThe dictionary's keys must be Python primitives.
  • \n
\n

Because this data is sent to the frontend, it must be serializable by\none of the supported serialization methods (JSON, Arrow, or raw bytes).\nYou can't pass arbitrary Python objects. Arrow-serialization is only\nsupported at the top level of the data parameter or one level deep\nin a dictionary. Raw bytes are only supported at the top level.

\n", + "default": null + }, + { + "name": "default", + "type_name": "dict[str, Any] or None", + "is_optional": false, + "description": "

Default state values for the component. Each key in the dictionary must\ncorrespond to a valid state attribute with an on_<key>_change\ncallback. This callback can be empty, but must be included as a\nparameter when the component is mounted.

\n

Trigger values do not support manual defaults. All trigger and state\nvalues defined by an associated callback are initialized to None by\ndefault.

\n", + "default": "state" + }, + { + "name": "width", + "type_name": "\"stretch\", \"content\", or int", + "is_optional": false, + "description": "

Width of the component. This can be one of the following:

\n
    \n
  • "stretch" (default): The component is wrapped in a <div> with\nCSS style width: 100%;.
  • \n
  • "content": The component is wrapped in a <div> with CSS\nstyle width: fit-content;.
  • \n
  • An integer specifying the width in pixels: The component is wrapped\nin a <div> with the specified pixel width.
  • \n
\n

You are responsible for ensuring the component's inner HTML content is\nresponsive to the <div> wrapper.

\n", + "default": null + }, + { + "name": "height", + "type_name": "\"content\", \"stretch\", or int", + "is_optional": false, + "description": "

Height of the component. This can be one of the following:

\n
    \n
  • "content" (default): The component is wrapped in a <div> with\nCSS style height: auto;.
  • \n
  • "stretch": The component is wrapped in a <div> with CSS\nstyle height: 100%;.
  • \n
  • An integer specifying the height in pixels: The component is wrapped\nin a <div> with the specified pixel height. If the component\ncontent is larger than the specified height, scrolling is enabled.
  • \n
\n
\n

Note

\n

Use scrolling containers sparingly. If you use scrolling\ncontainers, avoid heights that exceed 500 pixels. Otherwise,\nthe scroll surface of the container might cover the majority of\nthe screen on mobile devices, which makes it hard to scroll the\nrest of the app.

\n

If you want to disable scrolling for a fixed-height component,\ninclude an inner <div> wrapper in your component's HTML to\ncontrol the overflow behavior.

\n
\n

You are responsible for ensuring the component's inner HTML content is\nresponsive to the <div> wrapper.

\n", + "default": null + }, + { + "name": "**callbacks", + "type_name": "Callable or None", + "is_optional": false, + "description": "

Callbacks with the naming pattern on_<key>_change for each state and\ntrigger key. For example, if your component has a state key of\n"value" and a trigger key of "click", its callbacks can include\non_value_change and on_click_change.

\n

Only names that follow this pattern are recognized. Custom components\ndon't currently support callbacks with arguments.

\n

Callbacks are required for any state values defined in the default\nparameter. Otherwise, a callback is optional. To ensure your\ncomponent's result always returns the expected attributes, you can pass\nempty callbacks like lambda: None.

\n", + "default": null + } + ], + "returns": [ + { + "type_name": "ComponentResult", + "is_generator": false, + "description": "

Component state object that exposes state and trigger values.

\n", + "return_name": null + } + ], + "is_interface": true + }, + "PlotlyState": { + "name": "PlotlyState", + "signature": "PlotlyState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/plotly_chart.py#L195", + "example": "

Try selecting points by any of the three available methods (direct click,\nbox, or lasso). The current selection state is available through Session\nState or as the output of the chart function.

\n
\nimport plotly.express as px\nimport streamlit as st\n\ndf = px.data.iris()\nfig = px.scatter(df, x="sepal_width", y="sepal_length")\n\nevent = st.plotly_chart(fig, key="iris", on_select="rerun")\n\nevent\n
\n", + "description": "

The schema for the Plotly chart event state.

\n

To use this type in an annotation, import it from streamlit.typing.

\n

The event state is stored in a read-only dictionary-like object that\nsupports both key and attribute notation. Event states cannot be\nprogrammatically changed or set through Session State.

\n

Only selection events are supported at this time.

\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "

The state of the on_select event. This attribute returns a\ndictionary-like object that supports both key and attribute notation.\nThe attributes are described by PlotlySelectionState.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "PlotlySelectionState": { + "name": "PlotlySelectionState", + "signature": "PlotlySelectionState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/plotly_chart.py#L89", + "example": "

When working with more complicated graphs, the points attribute\ndisplays additional information. Try selecting points in the following\nexample:

\n
\nimport plotly.express as px\nimport streamlit as st\n\ndf = px.data.iris()\nfig = px.scatter(\n    df,\n    x="sepal_width",\n    y="sepal_length",\n    color="species",\n    size="petal_length",\n    hover_data=["petal_width"],\n)\n\nevent = st.plotly_chart(fig, key="iris", on_select="rerun")\n\nevent.selection\n
\n

This is an example of the selection state when selecting a single point:

\n
\n{\n  "points": [\n    {\n      "curve_number": 2,\n      "point_number": 9,\n      "point_index": 9,\n      "x": 3.6,\n      "y": 7.2,\n      "customdata": [\n        2.5\n      ],\n      "marker_size": 6.1,\n      "legendgroup": "virginica"\n    }\n  ],\n  "point_indices": [\n    9\n  ],\n  "box": [],\n  "lasso": []\n}\n
\n", + "description": "

The schema for the Plotly chart selection state.

\n

The selection state is stored in a read-only dictionary-like object that\nsupports both key and attribute notation. Selection states cannot be\nprogrammatically changed or set through Session State.

\n", + "args": [ + { + "name": "points", + "type_name": "list[dict[str, Any]]", + "is_optional": false, + "description": "

The selected data points in the chart, including the data points\nselected by the box and lasso mode. The data includes the values\nassociated to each point and a point index used to populate\npoint_indices. If additional information has been assigned to your\npoints, such as size or legend group, this is also included.

\n", + "default": null + }, + { + "name": "point_indices", + "type_name": "list[int]", + "is_optional": false, + "description": "

The numerical indices of all selected data points in the chart. The\ndetails of each identified point are included in points.

\n", + "default": null + }, + { + "name": "box", + "type_name": "list[dict[str, Any]]", + "is_optional": false, + "description": "

The metadata related to the box selection. This includes the\ncoordinates of the selected area.

\n", + "default": null + }, + { + "name": "lasso", + "type_name": "list[dict[str, Any]]", + "is_optional": false, + "description": "

The metadata related to the lasso selection. This includes the\ncoordinates of the selected area.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "VegaLiteState": { + "name": "VegaLiteState", + "signature": "VegaLiteState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/vega_charts.py#L87", + "examples": "

The following two examples have equivalent definitions. Each one has a\npoint and interval selection parameter include in the chart definition.\nThe point selection parameter is named "point_selection". The interval\nor box selection parameter is named "interval_selection".

\n

Example 1: Chart selections with ``st.altair_chart``

\n
\nimport altair as alt\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((20, 3)), columns=["a", "b", "c"])\n\npoint_selector = alt.selection_point("point_selection")\ninterval_selector = alt.selection_interval("interval_selection")\nchart = (\n    alt.Chart(df)\n    .mark_circle()\n    .encode(\n        x="a",\n        y="b",\n        size="c",\n        color="c",\n        tooltip=["a", "b", "c"],\n        fillOpacity=alt.condition(point_selector, alt.value(1), alt.value(0.3)),\n    )\n    .add_params(point_selector, interval_selector)\n)\n\nevent = st.altair_chart(chart, key="alt_chart", on_select="rerun")\n\nevent\n
\n

Example 2: Chart selections with ``st.vega_lite_chart``

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(rng(0).standard_normal((20, 3)), columns=["a", "b", "c"])\n\nspec = {\n    "mark": {"type": "circle", "tooltip": True},\n    "params": [\n        {"name": "interval_selection", "select": "interval"},\n        {"name": "point_selection", "select": "point"},\n    ],\n    "encoding": {\n        "x": {"field": "a", "type": "quantitative"},\n        "y": {"field": "b", "type": "quantitative"},\n        "size": {"field": "c", "type": "quantitative"},\n        "color": {"field": "c", "type": "quantitative"},\n        "fillOpacity": {\n            "condition": {"param": "point_selection", "value": 1},\n            "value": 0.3,\n        },\n    },\n}\n\nevent = st.vega_lite_chart(df, spec, key="vega_chart", on_select="rerun")\n\nevent\n
\n

Try selecting points in this interactive example. When you click a point,\nthe selection will appear under the attribute, "point_selection", which\nis the name given to the point selection parameter. Similarly, when you\nmake an interval selection, it will appear under the attribute\n"interval_selection". You can give your selection parameters other\nnames if desired.

\n

If you hold Shift while selecting points, existing point selections\nwill be preserved. Interval selections are not preserved when making\nadditional selections.

\n", + "description": "

The schema for the Vega-Lite event state.

\n

To use this type in an annotation, import it from streamlit.typing.

\n

The event state is stored in a read-only dictionary-like object that\nsupports both key and attribute notation. Event states cannot be\nprogrammatically changed or set through Session State.

\n

Only selection events are supported at this time.

\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "

The state of the on_select event. This attribute returns a\ndictionary-like object that supports both key and attribute notation.\nThe name of each Vega-Lite selection parameter becomes an attribute in\nthe selection dictionary. The format of the data within each\nattribute is determined by the selection parameter definition within\nVega-Lite.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "DataframeState": { + "name": "DataframeState", + "signature": "DataframeState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/arrow.py#L245", + "description": "

The schema for the dataframe event state.

\n

To use this type in an annotation, import it from streamlit.typing.

\n

The event state is stored in a dictionary-like object that supports both\nkey and attribute notation. Event states can be programmatically set\nthrough session state by assigning a dictionary with the same schema to the\nwidget's key, e.g.,\nst.session_state["my_key"] = {"selection": {"rows": [0, 2]}}.

\n

Only selection events are supported at this time.

\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "

The state of the on_select event. This attribute returns a\ndictionary-like object that supports both key and attribute notation.\nThe attributes are described by DataframeSelectionState.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "DataframeSelectionState": { + "name": "DataframeSelectionState", + "signature": "DataframeSelectionState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/arrow.py#L119", + "examples": "

Example 1: Enable dataframe selections

\n

The following example has multi-row and multi-column selections enabled.\nTry selecting some rows. To select multiple columns, hold CMD (macOS)\nor Ctrl (Windows) while selecting columns. Hold Shift to select a\nrange of columns.

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    rng(0).standard_normal((12, 5)), columns=["a", "b", "c", "d", "e"]\n)\n\nevent = st.dataframe(\n    df,\n    key="data",\n    on_select="rerun",\n    selection_mode=["multi-row", "multi-column", "multi-cell"],\n)\n\nevent.selection\n
\n

Example 2: Programmatically set selections

\n

To programmatically set dataframe selections, assign a key to your\ndataframe and set the selection through Session State.

\n
\nimport pandas as pd\nimport streamlit as st\nfrom numpy.random import default_rng as rng\n\ndf = pd.DataFrame(\n    rng(0).standard_normal((12, 5)), columns=["a", "b", "c", "d", "e"]\n)\n\nif st.button("Select the first row"):\n    st.session_state.data = {"selection": {"rows": [0]}}\nif st.button("Select column a"):\n    st.session_state.data = {"selection": {"columns": ["a"]}}\nif st.button("Select the first cell of column a"):\n    st.session_state.data = {"selection": {"cells": [[0, "a"]]}}\n\nevent = st.dataframe(\n    df,\n    key="data",\n    on_select="rerun",\n    selection_mode=["single-cell", "single-row", "single-column"],\n)\n\nevent.selection\n
\n", + "description": "

The schema for the dataframe selection state.

\n

The selection state is stored in a dictionary-like object that supports both\nkey and attribute notation. Selection states can be programmatically set\nthrough Session State by assigning a dictionary matching\nDataframeSelectionStateInput to the "selection" key of a\nDataframeStateInput dictionary.

\n

Programmatic selection is supported for all selection modes\nexcept "multi-cell". If "single-cell" isn't included in the\nselection modes of the dataframe, programmatic cell selections are ignored.

\n
\n

Note

\n

Row selections are preserved when a user sorts the dataframe in their\nbrowser. The selected rows continue to reference the same underlying\ndata rows by their original integer position.

\n
\n", + "args": [ + { + "name": "rows", + "type_name": "list[int]", + "is_optional": false, + "description": "

The selected rows, identified by their integer position. The integer\npositions match the original dataframe, even if the user sorts the\ndataframe in their browser. For a pandas.DataFrame, you can\nretrieve data from its integer position using methods like .iloc[]\nor .iat[].

\n", + "default": null + }, + { + "name": "columns", + "type_name": "list[str]", + "is_optional": false, + "description": "

The selected columns, identified by their names.

\n", + "default": null + }, + { + "name": "cells", + "type_name": "list[tuple[int, str]]", + "is_optional": false, + "description": "

The selected cells, provided as a tuple of row integer position\nand column name. For example, the first cell in a column named "col 1"\nis represented as (0, "col 1"). Cells within index columns are not\nreturned.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "DataEditorState": { + "name": "DataEditorState", + "signature": "DataEditorState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/data_editor.py#L116", + "description": "

The schema for the data editor state.

\n

To use this type in an annotation, import it from streamlit.typing.

\n

The state is stored in a read-only dictionary-like object that\nsupports both key and attribute notation. Top-level assignment and\nnested dict mutation raise TypeError. List fields (added_rows,\ndeleted_rows) are ordinary lists and are not frozen. Data editor\nstates cannot be programmatically changed or set through Session State.

\n", + "args": [ + { + "name": "edited_rows", + "type_name": "dict[int, dict[str, str | int | float | bool | list[str] | None]]", + "is_optional": false, + "description": "

A hierarchical mapping of edited cells based on row position ->\ncolumn name -> value. Row positions refer to the original source\ndataframe before pending edits are applied.

\n", + "default": null + }, + { + "name": "added_rows", + "type_name": "list[dict[str, str | int | float | bool | list[str] | None]]", + "is_optional": false, + "description": "

A list of added rows, where each row is a mapping from column name to\nthe cell value.

\n", + "default": null + }, + { + "name": "deleted_rows", + "type_name": "list[int]", + "is_optional": false, + "description": "

A list of deleted rows, where each entry is the numerical position of\nthe deleted row in the original source dataframe.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "PydeckState": { + "name": "PydeckState", + "signature": "PydeckState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/deck_gl_json_chart.py#L235", + "description": "

The schema for the PyDeck event state.

\n

To use this type in an annotation, import it from streamlit.typing.

\n

The event state is stored in a read-only dictionary-like object that\nsupports both key and attribute notation. Event states cannot be\nprogrammatically changed or set through Session State.

\n

Only selection events are supported at this time.

\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "

The state of the on_select event. This attribute returns a\ndictionary-like object that supports both key and attribute notation.\nThe attributes are described by PydeckSelectionState.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "PydeckSelectionState": { + "name": "PydeckSelectionState", + "signature": "PydeckSelectionState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/deck_gl_json_chart.py#L114", + "examples": "

The following example has multi-object selection enabled. The chart\ndisplays US state capitals by population (2023 US Census estimate). You\ncan access this data\nfrom GitHub.

\n
\nimport streamlit as st\nimport pydeck\nimport pandas as pd\n\ncapitals = pd.read_csv(\n    "capitals.csv",\n    header=0,\n    names=[\n        "Capital",\n        "State",\n        "Abbreviation",\n        "Latitude",\n        "Longitude",\n        "Population",\n    ],\n)\ncapitals["size"] = capitals.Population / 10\n\npoint_layer = pydeck.Layer(\n    "ScatterplotLayer",\n    data=capitals,\n    id="capital-cities",\n    get_position=["Longitude", "Latitude"],\n    get_color="[255, 75, 75]",\n    pickable=True,\n    auto_highlight=True,\n    get_radius="size",\n)\n\nview_state = pydeck.ViewState(\n    latitude=40, longitude=-117, controller=True, zoom=2.4, pitch=30\n)\n\nchart = pydeck.Deck(\n    point_layer,\n    initial_view_state=view_state,\n    tooltip={"text": "{Capital}, {Abbreviation}\\nPopulation: {Population}"},\n)\n\nevent = st.pydeck_chart(chart, on_select="rerun", selection_mode="multi-object")\n\nevent.selection\n
\n

This is an example of the selection state when selecting a single object\nfrom a layer with id, "captial-cities":

\n
\n{\n  "indices":{\n    "capital-cities":[\n      2\n    ]\n  },\n  "objects":{\n    "capital-cities":[\n      {\n        "Abbreviation":" AZ"\n        "Capital":"Phoenix"\n        "Latitude":33.448457\n        "Longitude":-112.073844\n        "Population":1650070\n        "State":" Arizona"\n        "size":165007.0\n      }\n    ]\n  }\n}\n
\n", + "description": "

The schema for the PyDeck chart selection state.

\n

The selection state is stored in a read-only dictionary-like object that\nsupports both key and attribute notation. Selection states cannot be\nprogrammatically changed or set through Session State.

\n

You must define id in pydeck.Layer to ensure statefulness when\nusing selections with st.pydeck_chart.

\n", + "args": [ + { + "name": "indices", + "type_name": "dict[str, list[int]]", + "is_optional": false, + "description": "

A dictionary of selected objects by layer. Each key in the dictionary\nis a layer id, and each value is a list of object indices within that\nlayer.

\n", + "default": null + }, + { + "name": "objects", + "type_name": "dict[str, list[dict[str, Any]]]", + "is_optional": false, + "description": "

A dictionary of object attributes by layer. Each key in the dictionary\nis a layer id, and each value is a list of metadata dictionaries for\nthe selected objects in that layer.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "BidiComponentResult": { + "name": "BidiComponentResult", + "signature": "BidiComponentResult", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/components/v2/bidi_component/state.py#L34", + "description": "

The schema for the custom component result object.

\n

The custom component result object is a dictionary-like object that\nsupports both key and attribute notation. It contains all of the\ncomponent's state and trigger values.

\n", + "args": [ + { + "name": "<state_keys>", + "type_name": "Any", + "is_optional": false, + "description": "

All state values from the component. State values are persistent across\napp reruns until explicitly changed. You can have multiple state keys\nas attributes.

\n", + "default": null + }, + { + "name": "<trigger_keys>", + "type_name": "Any", + "is_optional": false, + "description": "

All trigger values from the component. Trigger values are transient and\nreset to None after one script run. You can have multiple trigger\nkeys as attributes.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "TokensProxy": { + "name": "TokensProxy", + "signature": "TokensProxy", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/user_info.py#L395", + "examples": "

Example 1: Expose the ID token

\n

To expose only the identity token, add expose_tokens to your\nauthentication configuration. This example uses an unnamed default provider.

\n
\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://accounts.google.com/.well-known/openid-configuration"\nexpose_tokens = "id"\n
\n
\nimport streamlit as st\n\nif st.user.is_logged_in:\n    id_token = st.user.tokens["id"]\n    # Use the token for API verification\n
\n

Example 2: Expose both ID and access tokens

\n

You can use a list to expose multiple tokens. If you use one or more named\nidentity providers, the same tokens must be exposed for all providers in\nthe shared [auth] section.

\n
\n[auth]\nredirect_uri = "http://localhost:8501/oauth2callback"\ncookie_secret = "xxx"\nexpose_tokens = ["id", "access"]\n\n[auth.google]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://accounts.google.com/.well-known/openid-configuration"\n\n[auth.microsoft]\nclient_id = "xxx"\nclient_secret = "xxx"\nserver_metadata_url = "https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration"\n
\n
\nimport streamlit as st\n\nif st.user.is_logged_in:\n    id_token = st.user.tokens["id"]\n    access_token = st.user.tokens["access"]\n    # Use the tokens for API verification\n
\n", + "description": "

A read-only, dict-like object for accessing exposed tokens from the identity provider.

\n

This class provides access to tokens that have been explicitly exposed via\nthe expose_tokens setting in your authentication configuration. Tokens\ncontain sensitive credentials that your app can use to authenticate with\nexternal services on behalf of the logged-in user.

\n

To expose tokens in st.user.tokens, add the expose_tokens parameter to your authentication\nconfiguration in .streamlit/secrets.toml. expose_tokens must be in\nthe [auth] section and can't be a nested dictionary. You can specify a\nsingle token type as a string or multiple token types as a list. Streamlit\nsupports exposing "id" tokens and "access" tokens. If\nexpose_tokens isn't configured, st.user.tokens is an empty dict.

\n
\n

Warning

\n

Tokens are sensitive credentials that should be handled securely. Never\nexpose tokens in your app's UI, logs, or error messages. Only use tokens\nfor server-side API calls, and be mindful of token expiration times.\nOnly expose tokens if your app needs them for specific API integrations.

\n
\n

You can access token values using either key or attribute notation. For\nexample, use st.user.tokens["id"] or st.user.tokens.id to access\nthe id token. The object is read-only to prevent accidental modification of sensitive\ncredentials.

\n", + "args": [ + { + "name": "id", + "type_name": "str", + "is_optional": false, + "description": "

The identity token. This is only available if "id" is in expose_tokens.

\n", + "default": null + }, + { + "name": "access", + "type_name": "str", + "is_optional": false, + "description": "

The access token. This is only available if "access" is in expose_tokens.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "TabContainer": { + "name": "TabContainer", + "signature": "TabContainer", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/mutable_tab_container.py#L29", + "examples": "

Example 1: Lazy loading content

\n
\nimport streamlit as st\nimport time\n\ncat, dog, owl = st.tabs(["Cat", "Dog", "Owl"], on_change="rerun")\n\nif cat.open:\n    with cat:\n        with st.spinner("Loading cat..."):\n            time.sleep(2)\n        st.write("This is the cat")\n\nif dog.open:\n    with dog:\n        with st.spinner("Loading dog..."):\n            time.sleep(2)\n        st.write("This is the dog")\n\nif owl.open:\n    with owl:\n        with st.spinner("Loading owl..."):\n            time.sleep(2)\n        st.write("This is the owl")\n
\n

Example 2: Conditionally render content outside of the tab

\n
\nimport streamlit as st\n\ncat, dog, owl = st.tabs(["Cat", "Dog", "Owl"], on_change="rerun")\n\nwith cat:\n    st.write("This is the cat")\n\nwith dog:\n    st.write("This is the dog")\n\nwith owl:\n    st.write("This is the owl")\n\nif cat.open:\n    options = ["orange", "tuxie", "tortie"]\n    cat_color = st.sidebar.selectbox("What color is your cat?", options)\n\nif dog.open:\n    options = ["golden", "black", "white"]\n    dog_color = st.sidebar.selectbox("What color is your dog?", options)\n\nif owl.open:\n    options = ["brown", "white", "black"]\n    owl_color = st.sidebar.selectbox("What color is your owl?", options)\n
\n", + "description": "

A container returned for each tab in st.tabs.

\n

TabContainer is a DeltaGenerator subclass with an additional\n.open property for lazy execution. Use with notation or call\nmethods directly on the container to add elements to the tab.

\n", + "args": [ + { + "name": "open", + "type_name": "bool or None", + "is_optional": false, + "description": "

Whether this tab is the currently active tab. This is True if this\ntab is active and False if it is inactive, or None if state\ntracking isn't enabled.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "ExpanderContainer": { + "name": "ExpanderContainer", + "signature": "ExpanderContainer", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/mutable_expander_container.py#L31", + "examples": "

Example 1: Lazy loading content

\n
\nimport streamlit as st\nimport time\n\nsummary = st.expander("Summary", on_change="rerun")\n\nif summary.open:\n    with summary:\n        with st.spinner("Loading summary..."):\n            time.sleep(2)\n        st.write("This is the summary")\n
\n

Example 2: Conditionally render content outside of the expander

\n
\nimport streamlit as st\n\nsummary = st.expander("Summary", on_change="rerun")\nwith summary:\n    st.write("This is the summary")\n\nst.write(\n    f"The expander is {':green[open]' if summary.open else ':red[closed]'}."\n)\n
\n", + "description": "

A container returned by st.expander.

\n

ExpanderContainer is a Streamlit container with an .open property\nfor lazy execution. Use with notation or call methods directly on the\ncontainer to add elements to the expander.

\n", + "args": [ + { + "name": "open", + "type_name": "bool or None", + "is_optional": false, + "description": "

Whether the expander is open. This is True if the expander is open\nand False if it's collapsed, or None if state tracking isn't\nenabled.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "PopoverContainer": { + "name": "PopoverContainer", + "signature": "PopoverContainer", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/mutable_popover_container.py#L29", + "examples": "

Example 1: Lazy loading content

\n
\nimport streamlit as st\nimport time\n\ndrawer = st.popover("Open popover", on_change="rerun")\nwith drawer:\n    if drawer.open:\n        with st.spinner("Loading popover..."):\n            time.sleep(2)\n        st.write("This is the popover")\n
\n

Example 2: Conditionally render content outside of the popover

\n
\nimport streamlit as st\n\ndrawer = st.popover("Open popover", on_change="rerun")\nwith drawer:\n    st.write("This is the popover")\n\nst.space("large")\nst.write(f"The popover is {':green[open]' if drawer.open else ':red[closed]'}.")\n
\n", + "description": "

A container returned by st.popover.

\n

PopoverContainer is a Streamlit container with an .open property\nfor lazy execution. Use with notation or call methods directly on the\ncontainer to add elements to the popover.

\n", + "args": [ + { + "name": "open", + "type_name": "bool or None", + "is_optional": false, + "description": "

Whether the popover is open. This is True if the popover is open\nand False if it's closed, or None if state tracking isn't\nenabled.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "@streamlit/component-v2-lib/FrontendRenderer": { + "type": "type_alias", + "name": "FrontendRenderer", + "signature": "FrontendRenderer<TState extends FrontendState = FrontendState, TData = unknown> = (componentArgs: FrontendRendererArgs<TState, TData>) => CleanupFunction | void", + "description": "

The Streamlit v2 component signature.

\nimport { FrontendRenderer } from '@streamlit/component-v2-lib';

This type represents the function signature for the default export from your component's JavaScript or TypeScript code. This function gets called by Streamlit when your component is mounted in the frontend, and it receives all the necessary arguments to build and manage your component's UI and state.

", + "source": "https://github.com/streamlit/streamlit/blob/1.53.0/frontend/component-v2-lib/src/types.ts#L227", + "is_class": true, + "is_interface": true, + "args": [ + { + "name": "FrontendRendererArgs", + "type_name": "FrontendRendererArgs<TState, TData>", + "description": "

The inputs and utilities provided by Streamlit to your component.

" + } + ], + "returns": [ + { + "type_name": "CleanupFunction | void", + "is_generator": false, + "description": "

An optional cleanup function that Streamlit will call when the component is unmounted.

", + "return_name": null + } + ] + }, + "@streamlit/component-v2-lib/FrontendState": { + "type": "type_alias", + "name": "FrontendState", + "signature": "FrontendState = Record<string, unknown>", + "is_class": true, + "description": "

The base interface for defining a Streamlit custom component's state shape.

\nimport { FrontendState } from '@streamlit/component-v2-lib';

Frontend state is a persistent key-value store of state and trigger values. You can extend this type or define your own interface to add type-safe state and trigger key-value pairs. Each key corresponds to an on_<key>_change callback parameter in Python.

", + "source": "https://github.com/streamlit/streamlit/blob/1.53.0/frontend/component-v2-lib/src/types.ts#L40" + }, + "@streamlit/component-v2-lib/FrontendRendererArgs": { + "type": "type_alias", + "name": "FrontendRendererArgs", + "signature": "FrontendRendererArgs<TState extends FrontendState = FrontendState, TData = unknown,>", + "is_class": true, + "args": [ + { + "name": "data", + "type_name": "TData", + "description": "

The data payload sent from Python through the component's mounting command. This is the primary input for your component, typed by the component author via the TData generic.

" + }, + { + "name": "key", + "type_name": "string", + "description": "

A stable identifier for this component instance generated by Streamlit. This key is independent from the key parameter passed to the component's mounting command in Python. This frontend key is automatically generated to be unique among all instances of all components and to avoid collisions with classes and IDs in the app's DOM.

\n

Important

\n

If a component is mounted without a key parameter in Python, and one of the parameters in the mounting command changes, then this frontend key may change between app runs.

" + }, + { + "name": "name", + "type_name": "string", + "description": "

The component's name, as registered by Streamlit on the Python side. This is the same as the name parameter passed to st.components.v2.component.

" + }, + { + "name": "parentElement", + "type_name": "HTMLElement or ShadowRoot", + "description": "

The host element for your component. Your HTML, JavaScript, and CSS are mounted inside this container. This is a ShadowRoot if isolate_styles is set to true in the component definition, otherwise it's an HTMLElement.

Avoid directly setting the inner HTML of this element, as it may overwrite the HTML, CSS, and JavaScript from the component definition. Instead, update its children or append new elements to it." + } + ], + "methods": [ + { + "name": "setStateValue", + "signature": "setStateValue(name, value)", + "description": "

Set a state value by key. This state persists across app reruns. State values are accessible in Python through the component's result. Use this for values that should maintain their state when the user interacts with other parts of the Streamlit app.

", + "args": [ + { + "name": "name", + "type_name": "string", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The state key to set. If you are using TypeScript, this should be a key from TState.

To assign a value to a state key, in the component's mounting command in Python, an on_<key>_change callback isn't required. However, the presence of a callback will ensure that the state key is always present in the result.

", + "default": null + }, + { + "name": "value", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value to associate with the key. Type must match the corresponding property type in your TState interface.

", + "default": null + } + ], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ] + }, + { + "name": "setTriggerValue", + "signature": "setTriggerValue(name, value)", + "description": "

Set a trigger value by key. This trigger persists for a only single app rerun.

Trigger values are one-time events that are consumed during the resulting rerun and reset to null afterward. They're accessible in Python through the component's result. Use this for actions like button clicks, form submissions, or other event-based interactions.

", + "args": [ + { + "name": "name", + "type_name": "string", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The trigger key to set. If you are using TypeScript, this should be a key from TState.

To assign a value to a trigger key, in the component's mounting command in Python, an on_<key>_change callback isn't required. However, the presence of a callback will ensure that the trigger key is always present in the result.

", + "default": null + }, + { + "name": "value", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value for this trigger. If you are using TypeScript, this should match the corresponding property type in your TState interface.

", + "default": null + } + ], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ] + } + ], + "description": "

The arguments passed to a Streamlit custom component's top-level export default function.

\nimport { FrontendRendererArgs } from '@streamlit/component-v2-lib';

This type provides the interface between your TypeScript component and Streamlit's runtime, including the data payload from Python, utilities for managing component state, and the DOM container for mounting your UI.

Component authors typically destructure these arguments for easier access.

", + "source": "https://github.com/streamlit/streamlit/blob/1.53.0/frontend/component-v2-lib/src/types.ts#L114", + "example": "

Defining strict typing is not required. However, to follow typing best\npractices, you can declare your component's data and state shapes, then\nprovide them as generic parameters to FrontendRendererArgs. The following\nTypeScript code must be compiled to JavaScript before being passed to the\ncomponent's js parameter in st.components.v2.component.

\n
\nimport { FrontendRenderer, FrontendState } from '@streamlit/component-v2-lib';\n\ninterface MyFrontendState extends FrontendState {\n    selected_item: string | null\n    button_clicked: boolean\n}\n\ninterface MyFrontendData {\n    label: string\n    options: string[]\n}\n\nconst MyFrontendRenderer: FrontendRenderer<MyFrontendState, MyFrontendData> = (component) => {\n    // Destructure the component args for easier access\n    const { data, setStateValue, setTriggerValue, parentElement } = component\n\n    // Set up event handlers with type-safe state management\n    const dropdown = parentElement.querySelector('#dropdown') as HTMLSelectElement\n    const button = parentElement.querySelector('#submit') as HTMLButtonElement\n\n    dropdown.onchange = () => {\n        setStateValue('selected_item', dropdown.value)\n    }\n\n    button.onclick = () => {\n        setTriggerValue('button_clicked', true)\n    }\n}\n\nexport default MyFrontendRenderer;\n
\n" + }, + "@streamlit/component-v2-lib/FrontendRendererArgs.setStateValue": { + "name": "setStateValue", + "signature": "setStateValue(name, value)", + "description": "

Set a state value by key. This state persists across app reruns. State values are accessible in Python through the component's result. Use this for values that should maintain their state when the user interacts with other parts of the Streamlit app.

", + "source": "https://github.com/streamlit/streamlit/blob/1.53.0/frontend/component-v2-lib/src/types.ts#L171", + "args": [ + { + "name": "name", + "type_name": "string", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The state key to set. If you are using TypeScript, this should be a key from TState.

To assign a value to a state key, in the component's mounting command in Python, an on_<key>_change callback isn't required. However, the presence of a callback will ensure that the state key is always present in the result.

", + "default": null + }, + { + "name": "value", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value to associate with the key. Type must match the corresponding property type in your TState interface.

", + "default": null + } + ], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ] + }, + "@streamlit/component-v2-lib/FrontendRendererArgs.setTriggerValue": { + "name": "setTriggerValue", + "signature": "setTriggerValue(name, value)", + "description": "

Set a trigger value by key. This trigger persists for a only single app rerun.

Trigger values are one-time events that are consumed during the resulting rerun and reset to null afterward. They're accessible in Python through the component's result. Use this for actions like button clicks, form submissions, or other event-based interactions.

", + "source": "https://github.com/streamlit/streamlit/blob/1.53.0/frontend/component-v2-lib/src/types.ts#L193", + "args": [ + { + "name": "name", + "type_name": "string", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The trigger key to set. If you are using TypeScript, this should be a key from TState.

To assign a value to a trigger key, in the component's mounting command in Python, an on_<key>_change callback isn't required. However, the presence of a callback will ensure that the trigger key is always present in the result.

", + "default": null + }, + { + "name": "value", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": false, + "description": "

The value for this trigger. If you are using TypeScript, this should match the corresponding property type in your TState interface.

", + "default": null + } + ], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ] + }, + "@streamlit/component-v2-lib/ArrowData": { + "type": "type_alias", + "name": "ArrowData", + "signature": "ArrowData = Uint8Array<ArrayBufferLike> | null", + "description": "

Type for Arrow-serialized data from Python.

\nimport { ArrowData } from '@streamlit/component-v2-lib';

Use this when defining interfaces for data that will be serialized using Apache Arrow.

", + "source": "https://github.com/streamlit/streamlit/blob/1.53.0/frontend/component-v2-lib/src/types.ts#L50", + "is_class": true + }, + "@streamlit/component-v2-lib/CleanupFunction": { + "type": "type_alias", + "name": "CleanupFunction", + "signature": "CleanupFunction = () => void", + "description": "

The cleanup function returned by a Streamlit v2 component.

This type represents the cleanup function that your component can return from its top-level export default function. If provided, Streamlit will call this function when your component is unmounted from the app, allowing you to perform any necessary cleanup tasks, such as removing event listeners or canceling network requests.

", + "source": "https://github.com/streamlit/streamlit/blob/1.53.0/frontend/component-v2-lib/src/types.ts#L205", + "is_class": true, + "is_interface": true + } } } From 7044643d4fe117cfe0d87805f351ec30816cde96 Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 14:38:01 +0200 Subject: [PATCH 03/15] Update caching and data editor docs for 1.62.0 Co-authored-by: Cursor --- content/develop/api-reference/data/data_editor.md | 4 ++++ content/develop/concepts/architecture/caching.md | 14 ++++++-------- .../concepts/connections/security-reminders.md | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/content/develop/api-reference/data/data_editor.md b/content/develop/api-reference/data/data_editor.md index 2ec901c3c..1b4d13205 100644 --- a/content/develop/api-reference/data/data_editor.md +++ b/content/develop/api-reference/data/data_editor.md @@ -13,6 +13,10 @@ This page only contains information on the `st.data_editor` API. For an overview +## Data editor state + + + ### Configuring columns You can configure the display and editing behavior of columns in `st.dataframe` and `st.data_editor` via the [Column configuration API](/develop/api-reference/data/st.column_config). We have developed the API to let you add images, charts, and clickable URLs in dataframe and data editor columns. Additionally, you can make individual columns editable, set columns as categorical and specify which options they can take, hide the index of the dataframe, and much more. diff --git a/content/develop/concepts/architecture/caching.md b/content/develop/concepts/architecture/caching.md index 5992d1719..8784cd1a4 100644 --- a/content/develop/concepts/architecture/caching.md +++ b/content/develop/concepts/architecture/caching.md @@ -884,15 +884,13 @@ This toy example might seem benign. But data corruption can be extremely dangero ## Migrating from st.cache -We introduced the caching commands described above in Streamlit 1.18.0. Before that, we had one catch-all command `st.cache`. Using it was often confusing, resulted in weird exceptions, and was slow. That's why we replaced `st.cache` with the new commands in 1.18.0 (read more in this [blog post](https://blog.streamlit.io/introducing-two-new-caching-commands-to-replace-st-cache/)). The new commands provide a more intuitive and efficient way to cache your data and resources and are intended to replace `st.cache` in all new development. +We introduced `st.cache_data` and `st.cache_resource` in Streamlit 1.18.0 to replace the catch-all `st.cache` command (read more in this [blog post](https://blog.streamlit.io/introducing-two-new-caching-commands-to-replace-st-cache/)). In Streamlit 1.62.0, `st.cache` was removed. -If your app is still using `st.cache`, don't despair! Here are a few notes on migrating: +If your app still uses `@st.cache`, switch to `@st.cache_data` or `@st.cache_resource`. To decide which decorator to use, read [Deciding which caching decorator to use](#deciding-which-caching-decorator-to-use). -- Streamlit will show a deprecation warning if your app uses `st.cache`. -- We will not remove `st.cache` soon, so you don't need to worry about your 2-year-old app breaking. But we encourage you to try the new commands going forward – they will be way less annoying! -- Switching code to the new commands should be easy in most cases. To decide whether to use `st.cache_data` or `st.cache_resource`, read [Deciding which caching decorator to use](#deciding-which-caching-decorator-to-use). Streamlit will also recognize common use cases and show hints right in the deprecation warnings. -- Most parameters from `st.cache` are also present in the new commands, with a few exceptions: - - `allow_output_mutation` does not exist anymore. You can safely delete it. Just make sure you use the right caching command for your use case. - - `suppress_st_warning` does not exist anymore. You can safely delete it. Cached functions can now contain Streamlit commands and will replay them. If you want to use widgets inside cached functions, set `experimental_allow_widgets=True`. See [Input widgets](#input-widgets) for an example. +Most parameters from `st.cache` are also present in the new commands, with a few exceptions: + +- `allow_output_mutation` does not exist anymore. You can safely delete it. Just make sure you use the right caching command for your use case. +- `suppress_st_warning` does not exist anymore. You can safely delete it. Cached functions can now contain Streamlit commands and will replay them. If you want to use widgets inside cached functions, set `experimental_allow_widgets=True`. See [Input widgets](#input-widgets) for an example. If you have any questions or issues during the migration process, please contact us on the [forum](https://discuss.streamlit.io/), and we will be happy to assist you. 🎈 diff --git a/content/develop/concepts/connections/security-reminders.md b/content/develop/concepts/connections/security-reminders.md index 459957839..39a6d2aaf 100644 --- a/content/develop/concepts/connections/security-reminders.md +++ b/content/develop/concepts/connections/security-reminders.md @@ -23,5 +23,5 @@ If you use any sensitive or private information during development, make sure th Streamlit's [`st.cache_data`](/develop/concepts/architecture/caching#stcache_data) and [`st.session_state`](/develop/concepts/architecture/session-state#serializable-session-state) implicitly use the `pickle` module, which is known to be insecure. It is possible to construct malicious pickle data that will execute arbitrary code during unpickling. Never load data that could have come from an untrusted source in an unsafe mode or that could have been tampered with. **Only load data you trust**. -- When using `st.cache_data`, anything your function returns is pickled and stored, then unpickled on retrieval. Ensure your cached functions return trusted values. This warning also applies to [`st.cache`](/develop/api-reference/caching-and-state/st.cache) (deprecated). +- When using `st.cache_data`, anything your function returns is pickled and stored, then unpickled on retrieval. Ensure your cached functions return trusted values. - When the `runner.enforceSerializableSessionState` [configuration option](<(/develop/concepts/configuration#runner)>) is set to `true`, ensure all data saved and retrieved from Session State is trusted. From c65843e17018ca8437e81ce851094b40ecf26a0e Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 14:38:22 +0200 Subject: [PATCH 04/15] Add wrap example apps for 1.62.0 Co-authored-by: Cursor --- .../layout.columns_wrap_false.py | 13 +++++++++++++ python/api-examples-source/layout.container6.py | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 python/api-examples-source/layout.columns_wrap_false.py create mode 100644 python/api-examples-source/layout.container6.py diff --git a/python/api-examples-source/layout.columns_wrap_false.py b/python/api-examples-source/layout.columns_wrap_false.py new file mode 100644 index 000000000..20f943cb2 --- /dev/null +++ b/python/api-examples-source/layout.columns_wrap_false.py @@ -0,0 +1,13 @@ +import streamlit as st + +images = [ + "https://static.streamlit.io/examples/cat.jpg", + "https://static.streamlit.io/examples/dog.jpg", + "https://static.streamlit.io/examples/owl.jpg", + "https://static.streamlit.io/examples/cat.jpg", + "https://static.streamlit.io/examples/dog.jpg", + "https://static.streamlit.io/examples/owl.jpg", +] +thumbnail_columns = st.columns(6, gap="xsmall", wrap=False) +for column, image in zip(thumbnail_columns, images): + column.image(image) diff --git a/python/api-examples-source/layout.container6.py b/python/api-examples-source/layout.container6.py new file mode 100644 index 000000000..4564e7ef9 --- /dev/null +++ b/python/api-examples-source/layout.container6.py @@ -0,0 +1,5 @@ +import streamlit as st + +with st.container(horizontal=True, wrap=False): + for label in ("Edit", "Duplicate", "Archive", "Delete"): + st.button(label) From 7b3ea07b57aeafe7458d6c41fbf76db7bd119eb2 Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 14:40:46 +0200 Subject: [PATCH 05/15] Remove experimental_allow_widgets from caching docs Co-authored-by: Cursor --- .../caching-and-state/cache-data.md | 26 ---------------- .../caching-and-state/cache-resource.md | 26 ---------------- .../develop/concepts/architecture/caching.md | 30 ++----------------- 3 files changed, 2 insertions(+), 80 deletions(-) diff --git a/content/develop/api-reference/caching-and-state/cache-data.md b/content/develop/api-reference/caching-and-state/cache-data.md index 6ae24b5db..6c9bc5e51 100644 --- a/content/develop/api-reference/caching-and-state/cache-data.md +++ b/content/develop/api-reference/caching-and-state/cache-data.md @@ -73,29 +73,3 @@ def show_data(): st.write("And here is the raw data:") st.dataframe(data) ``` - -### Input widgets - -You can also use [interactive input widgets](/develop/api-reference/widgets) like `st.slider` or `st.text_input` in cached functions. Widget replay is an experimental feature at the moment. To enable it, you need to set the `experimental_allow_widgets` parameter: - -```python -@st.cache_data(experimental_allow_widgets=True) # πŸ‘ˆ Set the parameter -def get_data(): - num_rows = st.slider("Number of rows to get") # πŸ‘ˆ Add a slider - data = api.get(..., num_rows) - return data -``` - -Streamlit treats the slider like an additional input parameter to the cached function. If you change the slider position, Streamlit will see if it has already cached the function for this slider value. If yes, it will return the cached value. If not, it will rerun the function using the new slider value. - -Using widgets in cached functions is extremely powerful because it lets you cache entire parts of your app. But it can be dangerous! Since Streamlit treats the widget value as an additional input parameter, it can easily lead to excessive memory usage. Imagine your cached function has five sliders and returns a 100 MB DataFrame. Then we’ll add 100 MB to the cache for _every permutation_ of these five slider values – even if the sliders do not influence the returned data! These additions can make your cache explode very quickly. Please be aware of this limitation if you use widgets in cached functions. We recommend using this feature only for isolated parts of your UI where the widgets directly influence the cached return value. - - - -Support for widgets in cached functions is currently experimental. We may change or remove it anytime without warning. Please use it with care! - - - - -Two widgets are currently not supported in cached functions: `st.file_uploader` and `st.camera_input`. We may support them in the future. Feel free to [open a GitHub issue](https://github.com/streamlit/streamlit/issues) if you need them! - diff --git a/content/develop/api-reference/caching-and-state/cache-resource.md b/content/develop/api-reference/caching-and-state/cache-resource.md index 4cc88b727..e02c0303b 100644 --- a/content/develop/api-reference/caching-and-state/cache-resource.md +++ b/content/develop/api-reference/caching-and-state/cache-resource.md @@ -71,29 +71,3 @@ def load_model(): st.write("Here's the model:") return model ``` - -### Input widgets - -You can also use [interactive input widgets](/develop/api-reference/widgets) like `st.slider` or `st.text_input` in cached functions. Widget replay is an experimental feature at the moment. To enable it, you need to set the `experimental_allow_widgets` parameter: - -```python -@st.cache_resource(experimental_allow_widgets=True) # πŸ‘ˆ Set the parameter -def load_model(): - pretrained = st.checkbox("Use pre-trained model:") # πŸ‘ˆ Add a checkbox - model = torchvision.models.resnet50(weights=ResNet50_Weights.DEFAULT, pretrained=pretrained) - return model -``` - -Streamlit treats the checkbox like an additional input parameter to the cached function. If you uncheck it, Streamlit will see if it has already cached the function for this checkbox state. If yes, it will return the cached value. If not, it will rerun the function using the new slider value. - -Using widgets in cached functions is extremely powerful because it lets you cache entire parts of your app. But it can be dangerous! Since Streamlit treats the widget value as an additional input parameter, it can easily lead to excessive memory usage. Imagine your cached function has five sliders and returns a 100 MB DataFrame. Then we’ll add 100 MB to the cache for _every permutation_ of these five slider values – even if the sliders do not influence the returned data! These additions can make your cache explode very quickly. Please be aware of this limitation if you use widgets in cached functions. We recommend using this feature only for isolated parts of your UI where the widgets directly influence the cached return value. - - - -Support for widgets in cached functions is currently experimental. We may change or remove it anytime without warning. Please use it with care! - - - - -Two widgets are currently not supported in cached functions: `st.file_uploader` and `st.camera_input`. We may support them in the future. Feel free to [open a GitHub issue](https://github.com/streamlit/streamlit/issues) if you need them! - diff --git a/content/develop/concepts/architecture/caching.md b/content/develop/concepts/architecture/caching.md index 8784cd1a4..b8d6f85f0 100644 --- a/content/develop/concepts/architecture/caching.md +++ b/content/develop/concepts/architecture/caching.md @@ -700,7 +700,7 @@ st.button("Re-run") Now if you run the app, and click the `Re-run` button, you'll notice that the `show_data` function is no longer re-run each time. It's important to note here that our choice of hash function was very naive and not necessarily the best choice. For example, if the NumPy array is large, converting it to a string representation may be expensive. In such cases, it is up to you as the developer to define what a good hash function is for your use case. -#### Static elements +### Static elements Since version 1.16.0, cached functions can contain Streamlit commands! For example, you can do this: @@ -728,32 +728,6 @@ def show_data(): st.dataframe(data) ``` -#### Input widgets - -You can also use [interactive input widgets](/develop/api-reference/widgets) like `st.slider` or `st.text_input` in cached functions. Widget replay is an experimental feature at the moment. To enable it, you need to set the `experimental_allow_widgets` parameter: - -```python -@st.cache_data(experimental_allow_widgets=True) # πŸ‘ˆ Set the parameter -def get_data(): - num_rows = st.slider("Number of rows to get") # πŸ‘ˆ Add a slider - data = api.get(..., num_rows) - return data -``` - -Streamlit treats the slider like an additional input parameter to the cached function. If you change the slider position, Streamlit will see if it has already cached the function for this slider value. If yes, it will return the cached value. If not, it will rerun the function using the new slider value. - -Using widgets in cached functions is extremely powerful because it lets you cache entire parts of your app. But it can be dangerous! Since Streamlit treats the widget value as an additional input parameter, it can easily lead to excessive memory usage. Imagine your cached function has five sliders and returns a 100 MB DataFrame. Then we'll add 100 MB to the cache for _every permutation_ of these five slider values – even if the sliders do not influence the returned data! These additions can make your cache explode very quickly. Please be aware of this limitation if you use widgets in cached functions. We recommend using this feature only for isolated parts of your UI where the widgets directly influence the cached return value. - - - -Support for widgets in cached functions is experimental. We may change or remove it anytime without warning. Please use it with care! - - - - -Two widgets are currently not supported in cached functions: `st.file_uploader` and `st.camera_input`. We may support them in the future. Feel free to [open a GitHub issue](https://github.com/streamlit/streamlit/issues) if you need them! - - ### Dealing with large data As we explained, you should cache data objects with `st.cache_data`. But this can be slow for extremely large data, e.g., DataFrames or arrays with >100 million rows. That's because of the [copying behavior](#copying-behavior) of `st.cache_data`: on the first run, it serializes the return value to bytes and deserializes it on subsequent runs. Both operations take time. @@ -891,6 +865,6 @@ If your app still uses `@st.cache`, switch to `@st.cache_data` or `@st.cache_res Most parameters from `st.cache` are also present in the new commands, with a few exceptions: - `allow_output_mutation` does not exist anymore. You can safely delete it. Just make sure you use the right caching command for your use case. -- `suppress_st_warning` does not exist anymore. You can safely delete it. Cached functions can now contain Streamlit commands and will replay them. If you want to use widgets inside cached functions, set `experimental_allow_widgets=True`. See [Input widgets](#input-widgets) for an example. +- `suppress_st_warning` does not exist anymore. You can safely delete it. Cached functions can now contain Streamlit commands and will replay them. If you have any questions or issues during the migration process, please contact us on the [forum](https://discuss.streamlit.io/), and we will be happy to assist you. 🎈 From 3f4a87b87cc6825f4a46932db32862841c31b60f Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 14:42:42 +0200 Subject: [PATCH 06/15] Document ButtonColumnClickState on ButtonColumn Co-authored-by: Cursor --- .../api-reference/data/column_config/buttoncolumn.md | 4 ++++ python/generate.py | 2 ++ python/streamlit.json | 11 +++++++++++ 3 files changed, 17 insertions(+) diff --git a/content/develop/api-reference/data/column_config/buttoncolumn.md b/content/develop/api-reference/data/column_config/buttoncolumn.md index 6f39f2b04..c4bbbe15d 100644 --- a/content/develop/api-reference/data/column_config/buttoncolumn.md +++ b/content/develop/api-reference/data/column_config/buttoncolumn.md @@ -6,3 +6,7 @@ keywords: st.column_config.ButtonColumn, button column, clickable buttons, dataf --- + +## Button click state + + diff --git a/python/generate.py b/python/generate.py index 65c0d1e24..7883c5b1f 100644 --- a/python/generate.py +++ b/python/generate.py @@ -31,6 +31,7 @@ from streamlit.elements.arrow import DataframeState, DataframeSelectionState from streamlit.elements.deck_gl_json_chart import PydeckState, PydeckSelectionState from streamlit.elements.widgets.data_editor import DataEditorState +from streamlit.elements.lib.column_config_utils import ButtonColumnClickState from streamlit.elements.lib.mutable_expander_container import ExpanderContainer from streamlit.elements.lib.mutable_popover_container import PopoverContainer from streamlit.elements.lib.mutable_tab_container import TabContainer @@ -652,6 +653,7 @@ def get_streamlit_docstring_dict(): DataframeState: ["DataframeState", "DataframeState"], DataframeSelectionState: ["DataframeSelectionState", "DataframeSelectionState"], DataEditorState: ["DataEditorState", "DataEditorState"], + ButtonColumnClickState: ["ButtonColumnClickState", "ButtonColumnClickState"], PydeckState: ["PydeckState", "PydeckState"], PydeckSelectionState: ["PydeckSelectionState", "PydeckSelectionState"], BidiComponentResult: ["BidiComponentResult", "BidiComponentResult"], diff --git a/python/streamlit.json b/python/streamlit.json index 4913fa52b..0b1b1faff 100644 --- a/python/streamlit.json +++ b/python/streamlit.json @@ -432383,6 +432383,17 @@ "returns": [], "is_attribute_dict": true }, + "ButtonColumnClickState": { + "name": "ButtonColumnClickState", + "signature": "ButtonColumnClickState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/lib/column_config_utils.py#L444", + "description": "

The schema for button click state in ButtonColumn.

\n

To use this type in an annotation, import it from streamlit.typing.

\n

Read-only dict-like click payload with attribute and key access\n(click.row / click["row"]). Both fields are always present when a\nbutton click occurs.

\n", + "args": [], + "returns": [], + "is_attribute_dict": true + }, "PydeckState": { "name": "PydeckState", "signature": "PydeckState", From a4bdac87dfeb35199e2198a91fd427f159bfd07d Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 14:47:01 +0200 Subject: [PATCH 07/15] Use official 1.62.0 release notes Co-authored-by: Cursor --- .../quick-references/release-notes/2026.md | 71 ++++++++++--------- .../quick-references/release-notes/_index.md | 71 ++++++++++--------- 2 files changed, 74 insertions(+), 68 deletions(-) diff --git a/content/develop/quick-references/release-notes/2026.md b/content/develop/quick-references/release-notes/2026.md index 5312fcda3..612af1f97 100644 --- a/content/develop/quick-references/release-notes/2026.md +++ b/content/develop/quick-references/release-notes/2026.md @@ -15,46 +15,49 @@ _Release date: August 19, 2026_ **Highlights** -- ✨ Introducing `streamlit.typing` (also available as `st.typing`), a public namespace for annotating Streamlit-owned types like `UploadedFile`, `DataframeState`, and `DataEditorState` ([#16295](https://github.com/streamlit/streamlit/pull/16295), [#16275](https://github.com/streamlit/streamlit/pull/16275), [#16351](https://github.com/streamlit/streamlit/pull/16351), [#7801](https://github.com/streamlit/streamlit/issues/7801)). -- πŸ“ Introducing wrap control for horizontal layouts and widgets. A new `wrap` parameter keeps columns, containers, and labels on one row instead of wrapping: - - [`st.columns`](/develop/api-reference/layout/st.columns) `wrap=False` disables stacking on narrow viewports ([#16367](https://github.com/streamlit/streamlit/pull/16367), [#5003](https://github.com/streamlit/streamlit/issues/5003), [#2313](https://github.com/streamlit/streamlit/issues/2313)). - - [`st.container`](/develop/api-reference/layout/st.container) `wrap=False` keeps a horizontal container in a single scrolling row ([#16484](https://github.com/streamlit/streamlit/pull/16484), [#9544](https://github.com/streamlit/streamlit/issues/9544), [#12582](https://github.com/streamlit/streamlit/issues/12582)). - - Button-like elements (`st.button`, `st.download_button`, `st.link_button`, `st.form_submit_button`, `st.popover`, and `st.menu_button`) can ellipsize overflowing labels ([#16325](https://github.com/streamlit/streamlit/pull/16325)). - - [`st.checkbox`](/develop/api-reference/widgets/st.checkbox) and [`st.toggle`](/develop/api-reference/widgets/st.toggle) can keep their labels on one row ([#16470](https://github.com/streamlit/streamlit/pull/16470)). - - [`st.multiselect`](/develop/api-reference/widgets/st.multiselect) keeps selected chips in a single scrolling row ([#16509](https://github.com/streamlit/streamlit/pull/16509), [#12644](https://github.com/streamlit/streamlit/issues/12644)). +- ✨ Introducing client-side validation and specialized email, URL, phone, and search types for [`st.text_input`](/develop/api-reference/widgets/st.text_input), with smart defaults for validation, autofill, mobile keyboards, icons, and placeholders ([#15752](https://github.com/streamlit/streamlit/pull/15752), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#8790](https://github.com/streamlit/streamlit/issues/8790), [#7348](https://github.com/streamlit/streamlit/issues/7348), [#16385](https://github.com/streamlit/streamlit/pull/16385), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#10744](https://github.com/streamlit/streamlit/issues/10744)). +- 🧩 Introducing the new `wrap` parameter, which lets you choose whether horizontal layouts, widgets, and labels wrap or remain on one scrollable or truncated row: + - [`st.columns`](/develop/api-reference/layout/st.columns) and horizontal [`st.container`](/develop/api-reference/layout/st.container) layouts can remain on one horizontally scrollable row with `wrap=False` ([#16131](https://github.com/streamlit/streamlit/pull/16131), [#16367](https://github.com/streamlit/streamlit/pull/16367), [#5003](https://github.com/streamlit/streamlit/issues/5003), [#2313](https://github.com/streamlit/streamlit/issues/2313), [#16484](https://github.com/streamlit/streamlit/pull/16484), [#9544](https://github.com/streamlit/streamlit/issues/9544), [#12582](https://github.com/streamlit/streamlit/issues/12582)). + - [`st.button`](/develop/api-reference/widgets/st.button) and other button-like controls, [`st.checkbox`](/develop/api-reference/widgets/st.checkbox), and [`st.toggle`](/develop/api-reference/widgets/st.toggle) can keep labels on one line when desired ([#16325](https://github.com/streamlit/streamlit/pull/16325), [#16470](https://github.com/streamlit/streamlit/pull/16470)). + - [`st.multiselect`](/develop/api-reference/widgets/st.multiselect) can keep selected chips on one horizontally scrollable row ([#16509](https://github.com/streamlit/streamlit/pull/16509), [#12644](https://github.com/streamlit/streamlit/issues/12644)). +- πŸ†• Announcing the public `streamlit.typing` namespace for stable imports of Streamlit-owned types, including fully typed selection and data editor state values ([#16094](https://github.com/streamlit/streamlit/pull/16094), [#16275](https://github.com/streamlit/streamlit/pull/16275), [#16295](https://github.com/streamlit/streamlit/pull/16295), [#7801](https://github.com/streamlit/streamlit/issues/7801), [#16351](https://github.com/streamlit/streamlit/pull/16351), [#16471](https://github.com/streamlit/streamlit/pull/16471)). **Notable Changes** -- 🎯 [`st.text_input`](/develop/api-reference/widgets/st.text_input) adds `email`, `url`, `phone`, and `search` types, plus a `validate` parameter for client-side regex checks ([#16385](https://github.com/streamlit/streamlit/pull/16385), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#8790](https://github.com/streamlit/streamlit/issues/8790)). -- πŸ“… [`st.date_input`](/develop/api-reference/widgets/st.date_input) has been rebuilt with accessible segmented fields and keyboard calendar navigation ([#16460](https://github.com/streamlit/streamlit/pull/16460), [#7865](https://github.com/streamlit/streamlit/issues/7865), [#8556](https://github.com/streamlit/streamlit/issues/8556)). -- ⏱ [`st.datetime_input`](/develop/api-reference/widgets/st.datetime_input) uses the same segmented editor, with a time row in the calendar popover ([#16501](https://github.com/streamlit/streamlit/pull/16501), [#16502](https://github.com/streamlit/streamlit/pull/16502)). -- 🎨 Chart color theme options (`chartCategoricalColors`, `chartSequentialColors`, and `chartDivergingColors`) can now be set in `theme.light`, `theme.dark`, and sidebar sections ([#16357](https://github.com/streamlit/streamlit/pull/16357), [#16355](https://github.com/streamlit/streamlit/issues/16355)). -- πŸ”€ Theme font weights now accept 50-step values like 150 or 550 ([#16396](https://github.com/streamlit/streamlit/pull/16396), [#16354](https://github.com/streamlit/streamlit/issues/16354)). -- 🧠 When Streamlit raises an error during local development, an "Install skills" callout appears below the exception if agent skills aren't installed ([#15693](https://github.com/streamlit/streamlit/pull/15693)). -- βš™ New `runner.cacheHashSeed` config option lets you change the sample used when hashing large cached objects ([#16284](https://github.com/streamlit/streamlit/pull/16284), [#14622](https://github.com/streamlit/streamlit/issues/14622)). -- πŸ‘» **Breaking change:** The deprecated `st.cache` command has been removed. Use [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) or [`st.cache_resource`](/develop/api-reference/caching-and-state/st.cache_resource) instead ([#15787](https://github.com/streamlit/streamlit/pull/15787)). -- ❌ **Breaking change:** [`st.pyplot`](/develop/api-reference/charts/st.pyplot) now requires a figure. Calling it without one no longer uses Matplotlib's global figure ([#16464](https://github.com/streamlit/streamlit/pull/16464)). -- ☠️ **Breaking change:** Passing Matplotlib `savefig` keyword arguments to `st.pyplot` is deprecated. Save the figure and pass it to `st.image` instead ([#16450](https://github.com/streamlit/streamlit/pull/16450)). +- 🎨 Date and datetime inputs have a more accessible, keyboard-friendly editing experience: + - [`st.date_input`](/develop/api-reference/widgets/st.date_input) now uses segmented fields and an accessible calendar for single dates and ranges ([#16460](https://github.com/streamlit/streamlit/pull/16460), [#7865](https://github.com/streamlit/streamlit/issues/7865), [#8556](https://github.com/streamlit/streamlit/issues/8556), [#12699](https://github.com/streamlit/streamlit/issues/12699), [#9667](https://github.com/streamlit/streamlit/issues/9667), [#7100](https://github.com/streamlit/streamlit/issues/7100), [#4941](https://github.com/streamlit/streamlit/issues/4941), [#9946](https://github.com/streamlit/streamlit/issues/9946)). + - [`st.datetime_input`](/develop/api-reference/widgets/st.datetime_input) now offers segmented date and time fields with an integrated calendar and time editor ([#16501](https://github.com/streamlit/streamlit/pull/16501), [#16502](https://github.com/streamlit/streamlit/pull/16502)). + - Bug fix: Date and datetime values stay within their input borders in narrow containers, and calendars indicate today's date ([#16565](https://github.com/streamlit/streamlit/pull/16565)). +- πŸ“Š You can configure chart categorical, sequential, and diverging colors separately for light, dark, and sidebar themes ([#16357](https://github.com/streamlit/streamlit/pull/16357), [#16355](https://github.com/streamlit/streamlit/issues/16355)). +- πŸ”€ Theme font-weight settings support increments of 50 for finer typography control ([#16396](https://github.com/streamlit/streamlit/pull/16396), [#16354](https://github.com/streamlit/streamlit/issues/16354)). +- πŸ‘» The long-deprecated `st.cache` command has been removed; use [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) or [`st.cache_resource`](/develop/api-reference/caching-and-state/st.cache_resource) instead ([#15787](https://github.com/streamlit/streamlit/pull/15787)). +- ☠️ Passing Matplotlib `savefig` keyword arguments to [`st.pyplot`](/develop/api-reference/charts/st.pyplot) is deprecated; save the figure directly and display it with `st.image` instead ([#16450](https://github.com/streamlit/streamlit/pull/16450)). +- πŸ‘» Calling [`st.pyplot`](/develop/api-reference/charts/st.pyplot) without an explicit figure is no longer supported ([#16464](https://github.com/streamlit/streamlit/pull/16464)). **Other Changes** -- πŸ› Bug fix: `st.popover` contents stay within narrow and embedded viewports ([#16173](https://github.com/streamlit/streamlit/pull/16173), [#9340](https://github.com/streamlit/streamlit/issues/9340)). -- πŸ¦‹ Bug fix: `st.pyplot` supports `format="svg"` without crashing ([#16283](https://github.com/streamlit/streamlit/pull/16283), [#11489](https://github.com/streamlit/streamlit/issues/11489)). -- πŸͺ² Bug fix: Heading anchors update when heading text changes on rerun ([#16286](https://github.com/streamlit/streamlit/pull/16286), [#8793](https://github.com/streamlit/streamlit/issues/8793)). -- 🐜 Bug fix: Altair charts rebuilt with `alt.Chart.from_json` keep their inline data ([#16288](https://github.com/streamlit/streamlit/pull/16288), [#6269](https://github.com/streamlit/streamlit/issues/6269)). -- 🐝 Bug fix: Nested fragments with `run_every` no longer duplicate widgets when an ancestor rerun already rendered them ([#16314](https://github.com/streamlit/streamlit/pull/16314), [#10719](https://github.com/streamlit/streamlit/issues/10719)). -- 🐞 Bug fix: Hashing falls back to MD5 on FIPS builds where BLAKE2b rejects a custom digest size ([#16324](https://github.com/streamlit/streamlit/pull/16324), [#15148](https://github.com/streamlit/streamlit/issues/15148)). -- πŸ•·οΈ Bug fix: A malformed WebSocket `BackMsg` closes the connection instead of sending a traceback to the browser ([#16392](https://github.com/streamlit/streamlit/pull/16392), [#16391](https://github.com/streamlit/streamlit/issues/16391)). -- πŸͺ³ Bug fix: The `server.enableCORS=false` startup warning no longer claims CORS is overridden to true ([#16393](https://github.com/streamlit/streamlit/pull/16393), [#16390](https://github.com/streamlit/streamlit/issues/16390)). -- πŸͺ° Bug fix: Derived `codeBackgroundColor` and `dataframeHeaderBackgroundColor` follow a custom background instead of the base theme ([#16401](https://github.com/streamlit/streamlit/pull/16401), [#16398](https://github.com/streamlit/streamlit/issues/16398)). -- 🦠 Bug fix: `st.slider` rejects date and time bounds outside the frontend-safe range instead of snapping silently ([#16475](https://github.com/streamlit/streamlit/pull/16475), [#16474](https://github.com/streamlit/streamlit/issues/16474)). -- 🦟 Bug fix: `st.toast` is preserved when `st.rerun()` follows immediately after ([#16498](https://github.com/streamlit/streamlit/pull/16498), [#7740](https://github.com/streamlit/streamlit/issues/7740)). -- πŸ¦‚ Bug fix: `st.color_picker` is interactive inside `st.dialog` again ([#16541](https://github.com/streamlit/streamlit/pull/16541), [#16538](https://github.com/streamlit/streamlit/issues/16538)). -- πŸ¦— Bug fix: `st.metric` sparklines reappear after chart data goes empty and is later populated ([#16543](https://github.com/streamlit/streamlit/pull/16543), [#16539](https://github.com/streamlit/streamlit/issues/16539)). -- πŸ•ΈοΈ Bug fix: `st.date_input` and `st.datetime_input` no longer overflow in narrow containers, and the calendar marks today ([#16565](https://github.com/streamlit/streamlit/pull/16565)). -- πŸ“ `st.table` uses 14px font to match other widgets ([#16397](https://github.com/streamlit/streamlit/pull/16397), [#16389](https://github.com/streamlit/streamlit/issues/16389)). -- πŸ“¦ Streamlit no longer depends on `tenacity` ([#16497](https://github.com/streamlit/streamlit/pull/16497)). -- πŸ”Œ Streamlit is compatible with Starlette 1.4+ after gzip middleware updates ([#16344](https://github.com/streamlit/streamlit/pull/16344), [#16462](https://github.com/streamlit/streamlit/pull/16462), [#16341](https://github.com/streamlit/streamlit/issues/16341)). +- πŸͺ„ When Streamlit raises an uncaught error during local development, the error display can offer to install Streamlit's agent skills for supported coding agents ([#15693](https://github.com/streamlit/streamlit/pull/15693)). +- πŸ“ [`st.table`](/develop/api-reference/data/st.table) uses a 14-pixel font size consistent with other Streamlit widgets ([#16397](https://github.com/streamlit/streamlit/pull/16397), [#16389](https://github.com/streamlit/streamlit/issues/16389)). +- 🚨 Invalid enum-like parameter values consistently raise `StreamlitValueError` while preserving compatibility with existing specialized exception classes ([#16422](https://github.com/streamlit/streamlit/pull/16422)). +- πŸ“¦ Streamlit no longer requires the `tenacity` dependency for SQL and Snowflake connection retries ([#16497](https://github.com/streamlit/streamlit/pull/16497)). +- πŸ› Bug fix: [`st.popover`](/develop/api-reference/layout/st.popover) keeps its contents visible and scrollable in narrow or embedded viewports ([#16173](https://github.com/streamlit/streamlit/pull/16173), [#9340](https://github.com/streamlit/streamlit/issues/9340)). +- πŸ¦‹ Bug fix: [`st.pyplot`](/develop/api-reference/charts/st.pyplot) supports SVG output through `format="svg"` ([#16283](https://github.com/streamlit/streamlit/pull/16283), [#11489](https://github.com/streamlit/streamlit/issues/11489)). +- πŸͺ² Bug fix: `runner.cacheHashSeed` lets apps change the sample used to hash large pandas, Polars, and NumPy objects without invalidating existing caches by default ([#16284](https://github.com/streamlit/streamlit/pull/16284), [#14622](https://github.com/streamlit/streamlit/issues/14622)). +- 🐜 Bug fix: Heading anchors update when heading text changes during a rerun ([#16286](https://github.com/streamlit/streamlit/pull/16286), [#8793](https://github.com/streamlit/streamlit/issues/8793)). +- 🐝 Bug fix: Altair charts reconstructed with `alt.Chart.from_json` preserve their inline datasets ([#16288](https://github.com/streamlit/streamlit/pull/16288), [#6269](https://github.com/streamlit/streamlit/issues/6269)). +- 🐞 Bug fix: Nested [`st.fragment`](/develop/api-reference/execution-flow/st.fragment) functions with queued periodic reruns no longer execute twice and create duplicate element IDs ([#16314](https://github.com/streamlit/streamlit/pull/16314), [#10719](https://github.com/streamlit/streamlit/issues/10719)). +- πŸ•·οΈ Bug fix: Multiple Streamlit servers correctly advance to the next available port on Windows ([#16315](https://github.com/streamlit/streamlit/pull/16315), [#16296](https://github.com/streamlit/streamlit/issues/16296)). +- πŸͺ³ Bug fix: Updating [`st.status`](/develop/api-reference/status/st.status) through a container created outside a fragment no longer corrupts the app's element tree ([#16316](https://github.com/streamlit/streamlit/pull/16316), [#16281](https://github.com/streamlit/streamlit/issues/16281)). +- πŸͺ° Bug fix: Streamlit falls back to MD5 for element IDs, cache keys, and file watching on FIPS-enabled systems whose BLAKE2b implementation rejects custom digest sizes ([#16324](https://github.com/streamlit/streamlit/pull/16324), [#15148](https://github.com/streamlit/streamlit/issues/15148)). +- 🦠 Bug fix: Embedded Streamlit-in-Snowflake apps can receive same-window authentication messages while retaining host-message spoofing protections ([#16327](https://github.com/streamlit/streamlit/pull/16327)). +- 🦟 Bug fix: Streamlit remains compatible with newer Starlette gzip middleware while preserving correct media, download, and range-response handling ([#16342](https://github.com/streamlit/streamlit/pull/16342), [#16344](https://github.com/streamlit/streamlit/pull/16344), [#16341](https://github.com/streamlit/streamlit/issues/16341), [#16462](https://github.com/streamlit/streamlit/pull/16462)). +- πŸ¦‚ Bug fix: Malformed WebSocket messages are rejected without exposing tracebacks or absolute server paths to the browser ([#16392](https://github.com/streamlit/streamlit/pull/16392), [#16391](https://github.com/streamlit/streamlit/issues/16391)). +- πŸ¦— Bug fix: The startup warning for `server.enableCORS=false` accurately describes CORS and XSRF behavior instead of claiming the setting is overridden ([#16393](https://github.com/streamlit/streamlit/pull/16393), [#16390](https://github.com/streamlit/streamlit/issues/16390)). +- πŸ•ΈοΈ Bug fix: Derived code and dataframe-header background colors respect custom theme background settings ([#16401](https://github.com/streamlit/streamlit/pull/16401), [#16398](https://github.com/streamlit/streamlit/issues/16398)). +- 🐌 Bug fix: Timelike [`st.slider`](/develop/api-reference/widgets/st.slider) values are validated against the frontend's safe numeric range instead of silently changing ([#16475](https://github.com/streamlit/streamlit/pull/16475), [#16474](https://github.com/streamlit/streamlit/issues/16474)). +- 🦎 Bug fix: [`st.toast`](/develop/api-reference/status/st.toast) notifications remain visible when immediately followed by `st.rerun()` ([#16498](https://github.com/streamlit/streamlit/pull/16498), [#7740](https://github.com/streamlit/streamlit/issues/7740)). +- πŸ¦€ Bug fix: [`st.color_picker`](/develop/api-reference/widgets/st.color_picker) remains interactive inside dialogs ([#16541](https://github.com/streamlit/streamlit/pull/16541), [#16538](https://github.com/streamlit/streamlit/issues/16538)). +- πŸ‘½ Bug fix: [`st.metric`](/develop/api-reference/data/st.metric) restores its sparkline after chart data becomes empty and is populated again ([#16543](https://github.com/streamlit/streamlit/pull/16543), [#16539](https://github.com/streamlit/streamlit/issues/16539)). ## **Version 1.61.0** diff --git a/content/develop/quick-references/release-notes/_index.md b/content/develop/quick-references/release-notes/_index.md index 3013f9ef6..fb94da666 100644 --- a/content/develop/quick-references/release-notes/_index.md +++ b/content/develop/quick-references/release-notes/_index.md @@ -27,46 +27,49 @@ _Release date: August 19, 2026_ **Highlights** -- ✨ Introducing `streamlit.typing` (also available as `st.typing`), a public namespace for annotating Streamlit-owned types like `UploadedFile`, `DataframeState`, and `DataEditorState` ([#16295](https://github.com/streamlit/streamlit/pull/16295), [#16275](https://github.com/streamlit/streamlit/pull/16275), [#16351](https://github.com/streamlit/streamlit/pull/16351), [#7801](https://github.com/streamlit/streamlit/issues/7801)). -- πŸ“ Introducing wrap control for horizontal layouts and widgets. A new `wrap` parameter keeps columns, containers, and labels on one row instead of wrapping: - - [`st.columns`](/develop/api-reference/layout/st.columns) `wrap=False` disables stacking on narrow viewports ([#16367](https://github.com/streamlit/streamlit/pull/16367), [#5003](https://github.com/streamlit/streamlit/issues/5003), [#2313](https://github.com/streamlit/streamlit/issues/2313)). - - [`st.container`](/develop/api-reference/layout/st.container) `wrap=False` keeps a horizontal container in a single scrolling row ([#16484](https://github.com/streamlit/streamlit/pull/16484), [#9544](https://github.com/streamlit/streamlit/issues/9544), [#12582](https://github.com/streamlit/streamlit/issues/12582)). - - Button-like elements (`st.button`, `st.download_button`, `st.link_button`, `st.form_submit_button`, `st.popover`, and `st.menu_button`) can ellipsize overflowing labels ([#16325](https://github.com/streamlit/streamlit/pull/16325)). - - [`st.checkbox`](/develop/api-reference/widgets/st.checkbox) and [`st.toggle`](/develop/api-reference/widgets/st.toggle) can keep their labels on one row ([#16470](https://github.com/streamlit/streamlit/pull/16470)). - - [`st.multiselect`](/develop/api-reference/widgets/st.multiselect) keeps selected chips in a single scrolling row ([#16509](https://github.com/streamlit/streamlit/pull/16509), [#12644](https://github.com/streamlit/streamlit/issues/12644)). +- ✨ Introducing client-side validation and specialized email, URL, phone, and search types for [`st.text_input`](/develop/api-reference/widgets/st.text_input), with smart defaults for validation, autofill, mobile keyboards, icons, and placeholders ([#15752](https://github.com/streamlit/streamlit/pull/15752), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#8790](https://github.com/streamlit/streamlit/issues/8790), [#7348](https://github.com/streamlit/streamlit/issues/7348), [#16385](https://github.com/streamlit/streamlit/pull/16385), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#10744](https://github.com/streamlit/streamlit/issues/10744)). +- 🧩 Introducing the new `wrap` parameter, which lets you choose whether horizontal layouts, widgets, and labels wrap or remain on one scrollable or truncated row: + - [`st.columns`](/develop/api-reference/layout/st.columns) and horizontal [`st.container`](/develop/api-reference/layout/st.container) layouts can remain on one horizontally scrollable row with `wrap=False` ([#16131](https://github.com/streamlit/streamlit/pull/16131), [#16367](https://github.com/streamlit/streamlit/pull/16367), [#5003](https://github.com/streamlit/streamlit/issues/5003), [#2313](https://github.com/streamlit/streamlit/issues/2313), [#16484](https://github.com/streamlit/streamlit/pull/16484), [#9544](https://github.com/streamlit/streamlit/issues/9544), [#12582](https://github.com/streamlit/streamlit/issues/12582)). + - [`st.button`](/develop/api-reference/widgets/st.button) and other button-like controls, [`st.checkbox`](/develop/api-reference/widgets/st.checkbox), and [`st.toggle`](/develop/api-reference/widgets/st.toggle) can keep labels on one line when desired ([#16325](https://github.com/streamlit/streamlit/pull/16325), [#16470](https://github.com/streamlit/streamlit/pull/16470)). + - [`st.multiselect`](/develop/api-reference/widgets/st.multiselect) can keep selected chips on one horizontally scrollable row ([#16509](https://github.com/streamlit/streamlit/pull/16509), [#12644](https://github.com/streamlit/streamlit/issues/12644)). +- πŸ†• Announcing the public `streamlit.typing` namespace for stable imports of Streamlit-owned types, including fully typed selection and data editor state values ([#16094](https://github.com/streamlit/streamlit/pull/16094), [#16275](https://github.com/streamlit/streamlit/pull/16275), [#16295](https://github.com/streamlit/streamlit/pull/16295), [#7801](https://github.com/streamlit/streamlit/issues/7801), [#16351](https://github.com/streamlit/streamlit/pull/16351), [#16471](https://github.com/streamlit/streamlit/pull/16471)). **Notable Changes** -- 🎯 [`st.text_input`](/develop/api-reference/widgets/st.text_input) adds `email`, `url`, `phone`, and `search` types, plus a `validate` parameter for client-side regex checks ([#16385](https://github.com/streamlit/streamlit/pull/16385), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#8790](https://github.com/streamlit/streamlit/issues/8790)). -- πŸ“… [`st.date_input`](/develop/api-reference/widgets/st.date_input) has been rebuilt with accessible segmented fields and keyboard calendar navigation ([#16460](https://github.com/streamlit/streamlit/pull/16460), [#7865](https://github.com/streamlit/streamlit/issues/7865), [#8556](https://github.com/streamlit/streamlit/issues/8556)). -- ⏱ [`st.datetime_input`](/develop/api-reference/widgets/st.datetime_input) uses the same segmented editor, with a time row in the calendar popover ([#16501](https://github.com/streamlit/streamlit/pull/16501), [#16502](https://github.com/streamlit/streamlit/pull/16502)). -- 🎨 Chart color theme options (`chartCategoricalColors`, `chartSequentialColors`, and `chartDivergingColors`) can now be set in `theme.light`, `theme.dark`, and sidebar sections ([#16357](https://github.com/streamlit/streamlit/pull/16357), [#16355](https://github.com/streamlit/streamlit/issues/16355)). -- πŸ”€ Theme font weights now accept 50-step values like 150 or 550 ([#16396](https://github.com/streamlit/streamlit/pull/16396), [#16354](https://github.com/streamlit/streamlit/issues/16354)). -- 🧠 When Streamlit raises an error during local development, an "Install skills" callout appears below the exception if agent skills aren't installed ([#15693](https://github.com/streamlit/streamlit/pull/15693)). -- βš™ New `runner.cacheHashSeed` config option lets you change the sample used when hashing large cached objects ([#16284](https://github.com/streamlit/streamlit/pull/16284), [#14622](https://github.com/streamlit/streamlit/issues/14622)). -- πŸ‘» **Breaking change:** The deprecated `st.cache` command has been removed. Use [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) or [`st.cache_resource`](/develop/api-reference/caching-and-state/st.cache_resource) instead ([#15787](https://github.com/streamlit/streamlit/pull/15787)). -- ❌ **Breaking change:** [`st.pyplot`](/develop/api-reference/charts/st.pyplot) now requires a figure. Calling it without one no longer uses Matplotlib's global figure ([#16464](https://github.com/streamlit/streamlit/pull/16464)). -- ☠️ **Breaking change:** Passing Matplotlib `savefig` keyword arguments to `st.pyplot` is deprecated. Save the figure and pass it to `st.image` instead ([#16450](https://github.com/streamlit/streamlit/pull/16450)). +- 🎨 Date and datetime inputs have a more accessible, keyboard-friendly editing experience: + - [`st.date_input`](/develop/api-reference/widgets/st.date_input) now uses segmented fields and an accessible calendar for single dates and ranges ([#16460](https://github.com/streamlit/streamlit/pull/16460), [#7865](https://github.com/streamlit/streamlit/issues/7865), [#8556](https://github.com/streamlit/streamlit/issues/8556), [#12699](https://github.com/streamlit/streamlit/issues/12699), [#9667](https://github.com/streamlit/streamlit/issues/9667), [#7100](https://github.com/streamlit/streamlit/issues/7100), [#4941](https://github.com/streamlit/streamlit/issues/4941), [#9946](https://github.com/streamlit/streamlit/issues/9946)). + - [`st.datetime_input`](/develop/api-reference/widgets/st.datetime_input) now offers segmented date and time fields with an integrated calendar and time editor ([#16501](https://github.com/streamlit/streamlit/pull/16501), [#16502](https://github.com/streamlit/streamlit/pull/16502)). + - Bug fix: Date and datetime values stay within their input borders in narrow containers, and calendars indicate today's date ([#16565](https://github.com/streamlit/streamlit/pull/16565)). +- πŸ“Š You can configure chart categorical, sequential, and diverging colors separately for light, dark, and sidebar themes ([#16357](https://github.com/streamlit/streamlit/pull/16357), [#16355](https://github.com/streamlit/streamlit/issues/16355)). +- πŸ”€ Theme font-weight settings support increments of 50 for finer typography control ([#16396](https://github.com/streamlit/streamlit/pull/16396), [#16354](https://github.com/streamlit/streamlit/issues/16354)). +- πŸ‘» The long-deprecated `st.cache` command has been removed; use [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) or [`st.cache_resource`](/develop/api-reference/caching-and-state/st.cache_resource) instead ([#15787](https://github.com/streamlit/streamlit/pull/15787)). +- ☠️ Passing Matplotlib `savefig` keyword arguments to [`st.pyplot`](/develop/api-reference/charts/st.pyplot) is deprecated; save the figure directly and display it with `st.image` instead ([#16450](https://github.com/streamlit/streamlit/pull/16450)). +- πŸ‘» Calling [`st.pyplot`](/develop/api-reference/charts/st.pyplot) without an explicit figure is no longer supported ([#16464](https://github.com/streamlit/streamlit/pull/16464)). **Other Changes** -- πŸ› Bug fix: `st.popover` contents stay within narrow and embedded viewports ([#16173](https://github.com/streamlit/streamlit/pull/16173), [#9340](https://github.com/streamlit/streamlit/issues/9340)). -- πŸ¦‹ Bug fix: `st.pyplot` supports `format="svg"` without crashing ([#16283](https://github.com/streamlit/streamlit/pull/16283), [#11489](https://github.com/streamlit/streamlit/issues/11489)). -- πŸͺ² Bug fix: Heading anchors update when heading text changes on rerun ([#16286](https://github.com/streamlit/streamlit/pull/16286), [#8793](https://github.com/streamlit/streamlit/issues/8793)). -- 🐜 Bug fix: Altair charts rebuilt with `alt.Chart.from_json` keep their inline data ([#16288](https://github.com/streamlit/streamlit/pull/16288), [#6269](https://github.com/streamlit/streamlit/issues/6269)). -- 🐝 Bug fix: Nested fragments with `run_every` no longer duplicate widgets when an ancestor rerun already rendered them ([#16314](https://github.com/streamlit/streamlit/pull/16314), [#10719](https://github.com/streamlit/streamlit/issues/10719)). -- 🐞 Bug fix: Hashing falls back to MD5 on FIPS builds where BLAKE2b rejects a custom digest size ([#16324](https://github.com/streamlit/streamlit/pull/16324), [#15148](https://github.com/streamlit/streamlit/issues/15148)). -- πŸ•·οΈ Bug fix: A malformed WebSocket `BackMsg` closes the connection instead of sending a traceback to the browser ([#16392](https://github.com/streamlit/streamlit/pull/16392), [#16391](https://github.com/streamlit/streamlit/issues/16391)). -- πŸͺ³ Bug fix: The `server.enableCORS=false` startup warning no longer claims CORS is overridden to true ([#16393](https://github.com/streamlit/streamlit/pull/16393), [#16390](https://github.com/streamlit/streamlit/issues/16390)). -- πŸͺ° Bug fix: Derived `codeBackgroundColor` and `dataframeHeaderBackgroundColor` follow a custom background instead of the base theme ([#16401](https://github.com/streamlit/streamlit/pull/16401), [#16398](https://github.com/streamlit/streamlit/issues/16398)). -- 🦠 Bug fix: `st.slider` rejects date and time bounds outside the frontend-safe range instead of snapping silently ([#16475](https://github.com/streamlit/streamlit/pull/16475), [#16474](https://github.com/streamlit/streamlit/issues/16474)). -- 🦟 Bug fix: `st.toast` is preserved when `st.rerun()` follows immediately after ([#16498](https://github.com/streamlit/streamlit/pull/16498), [#7740](https://github.com/streamlit/streamlit/issues/7740)). -- πŸ¦‚ Bug fix: `st.color_picker` is interactive inside `st.dialog` again ([#16541](https://github.com/streamlit/streamlit/pull/16541), [#16538](https://github.com/streamlit/streamlit/issues/16538)). -- πŸ¦— Bug fix: `st.metric` sparklines reappear after chart data goes empty and is later populated ([#16543](https://github.com/streamlit/streamlit/pull/16543), [#16539](https://github.com/streamlit/streamlit/issues/16539)). -- πŸ•ΈοΈ Bug fix: `st.date_input` and `st.datetime_input` no longer overflow in narrow containers, and the calendar marks today ([#16565](https://github.com/streamlit/streamlit/pull/16565)). -- πŸ“ `st.table` uses 14px font to match other widgets ([#16397](https://github.com/streamlit/streamlit/pull/16397), [#16389](https://github.com/streamlit/streamlit/issues/16389)). -- πŸ“¦ Streamlit no longer depends on `tenacity` ([#16497](https://github.com/streamlit/streamlit/pull/16497)). -- πŸ”Œ Streamlit is compatible with Starlette 1.4+ after gzip middleware updates ([#16344](https://github.com/streamlit/streamlit/pull/16344), [#16462](https://github.com/streamlit/streamlit/pull/16462), [#16341](https://github.com/streamlit/streamlit/issues/16341)). +- πŸͺ„ When Streamlit raises an uncaught error during local development, the error display can offer to install Streamlit's agent skills for supported coding agents ([#15693](https://github.com/streamlit/streamlit/pull/15693)). +- πŸ“ [`st.table`](/develop/api-reference/data/st.table) uses a 14-pixel font size consistent with other Streamlit widgets ([#16397](https://github.com/streamlit/streamlit/pull/16397), [#16389](https://github.com/streamlit/streamlit/issues/16389)). +- 🚨 Invalid enum-like parameter values consistently raise `StreamlitValueError` while preserving compatibility with existing specialized exception classes ([#16422](https://github.com/streamlit/streamlit/pull/16422)). +- πŸ“¦ Streamlit no longer requires the `tenacity` dependency for SQL and Snowflake connection retries ([#16497](https://github.com/streamlit/streamlit/pull/16497)). +- πŸ› Bug fix: [`st.popover`](/develop/api-reference/layout/st.popover) keeps its contents visible and scrollable in narrow or embedded viewports ([#16173](https://github.com/streamlit/streamlit/pull/16173), [#9340](https://github.com/streamlit/streamlit/issues/9340)). +- πŸ¦‹ Bug fix: [`st.pyplot`](/develop/api-reference/charts/st.pyplot) supports SVG output through `format="svg"` ([#16283](https://github.com/streamlit/streamlit/pull/16283), [#11489](https://github.com/streamlit/streamlit/issues/11489)). +- πŸͺ² Bug fix: `runner.cacheHashSeed` lets apps change the sample used to hash large pandas, Polars, and NumPy objects without invalidating existing caches by default ([#16284](https://github.com/streamlit/streamlit/pull/16284), [#14622](https://github.com/streamlit/streamlit/issues/14622)). +- 🐜 Bug fix: Heading anchors update when heading text changes during a rerun ([#16286](https://github.com/streamlit/streamlit/pull/16286), [#8793](https://github.com/streamlit/streamlit/issues/8793)). +- 🐝 Bug fix: Altair charts reconstructed with `alt.Chart.from_json` preserve their inline datasets ([#16288](https://github.com/streamlit/streamlit/pull/16288), [#6269](https://github.com/streamlit/streamlit/issues/6269)). +- 🐞 Bug fix: Nested [`st.fragment`](/develop/api-reference/execution-flow/st.fragment) functions with queued periodic reruns no longer execute twice and create duplicate element IDs ([#16314](https://github.com/streamlit/streamlit/pull/16314), [#10719](https://github.com/streamlit/streamlit/issues/10719)). +- πŸ•·οΈ Bug fix: Multiple Streamlit servers correctly advance to the next available port on Windows ([#16315](https://github.com/streamlit/streamlit/pull/16315), [#16296](https://github.com/streamlit/streamlit/issues/16296)). +- πŸͺ³ Bug fix: Updating [`st.status`](/develop/api-reference/status/st.status) through a container created outside a fragment no longer corrupts the app's element tree ([#16316](https://github.com/streamlit/streamlit/pull/16316), [#16281](https://github.com/streamlit/streamlit/issues/16281)). +- πŸͺ° Bug fix: Streamlit falls back to MD5 for element IDs, cache keys, and file watching on FIPS-enabled systems whose BLAKE2b implementation rejects custom digest sizes ([#16324](https://github.com/streamlit/streamlit/pull/16324), [#15148](https://github.com/streamlit/streamlit/issues/15148)). +- 🦠 Bug fix: Embedded Streamlit-in-Snowflake apps can receive same-window authentication messages while retaining host-message spoofing protections ([#16327](https://github.com/streamlit/streamlit/pull/16327)). +- 🦟 Bug fix: Streamlit remains compatible with newer Starlette gzip middleware while preserving correct media, download, and range-response handling ([#16342](https://github.com/streamlit/streamlit/pull/16342), [#16344](https://github.com/streamlit/streamlit/pull/16344), [#16341](https://github.com/streamlit/streamlit/issues/16341), [#16462](https://github.com/streamlit/streamlit/pull/16462)). +- πŸ¦‚ Bug fix: Malformed WebSocket messages are rejected without exposing tracebacks or absolute server paths to the browser ([#16392](https://github.com/streamlit/streamlit/pull/16392), [#16391](https://github.com/streamlit/streamlit/issues/16391)). +- πŸ¦— Bug fix: The startup warning for `server.enableCORS=false` accurately describes CORS and XSRF behavior instead of claiming the setting is overridden ([#16393](https://github.com/streamlit/streamlit/pull/16393), [#16390](https://github.com/streamlit/streamlit/issues/16390)). +- πŸ•ΈοΈ Bug fix: Derived code and dataframe-header background colors respect custom theme background settings ([#16401](https://github.com/streamlit/streamlit/pull/16401), [#16398](https://github.com/streamlit/streamlit/issues/16398)). +- 🐌 Bug fix: Timelike [`st.slider`](/develop/api-reference/widgets/st.slider) values are validated against the frontend's safe numeric range instead of silently changing ([#16475](https://github.com/streamlit/streamlit/pull/16475), [#16474](https://github.com/streamlit/streamlit/issues/16474)). +- 🦎 Bug fix: [`st.toast`](/develop/api-reference/status/st.toast) notifications remain visible when immediately followed by `st.rerun()` ([#16498](https://github.com/streamlit/streamlit/pull/16498), [#7740](https://github.com/streamlit/streamlit/issues/7740)). +- πŸ¦€ Bug fix: [`st.color_picker`](/develop/api-reference/widgets/st.color_picker) remains interactive inside dialogs ([#16541](https://github.com/streamlit/streamlit/pull/16541), [#16538](https://github.com/streamlit/streamlit/issues/16538)). +- πŸ‘½ Bug fix: [`st.metric`](/develop/api-reference/data/st.metric) restores its sparkline after chart data becomes empty and is populated again ([#16543](https://github.com/streamlit/streamlit/pull/16543), [#16539](https://github.com/streamlit/streamlit/issues/16539)). ## Older versions of Streamlit From 24efcef998a1ef633ecd3ebda396608499ad6705 Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 14:48:28 +0200 Subject: [PATCH 08/15] Document UploadedFile and ChatInputValue types Co-authored-by: Cursor --- .../develop/api-reference/chat/chat-input.md | 4 ++ .../api-reference/widgets/file_uploader.md | 4 ++ python/generate.py | 4 ++ python/streamlit.json | 45 +++++++++++++++++++ 4 files changed, 57 insertions(+) diff --git a/content/develop/api-reference/chat/chat-input.md b/content/develop/api-reference/chat/chat-input.md index ba66283fe..2f5a689b3 100644 --- a/content/develop/api-reference/chat/chat-input.md +++ b/content/develop/api-reference/chat/chat-input.md @@ -13,6 +13,10 @@ Read the [Build a basic LLM chat app](/develop/tutorials/chat-and-llm-apps/build +## Chat input value + + + For an overview of the `st.chat_input` and `st.chat_message` API, check out this video tutorial by Chanin Nantasenamat ([@dataprofessor](https://www.youtube.com/dataprofessor)), a Senior Developer Advocate at Streamlit. diff --git a/content/develop/api-reference/widgets/file_uploader.md b/content/develop/api-reference/widgets/file_uploader.md index 2a5dafb24..509f60356 100644 --- a/content/develop/api-reference/widgets/file_uploader.md +++ b/content/develop/api-reference/widgets/file_uploader.md @@ -6,3 +6,7 @@ keywords: st.file_uploader, file uploader, file upload, upload widget, file inpu --- + +## Uploaded files + + diff --git a/python/generate.py b/python/generate.py index 7883c5b1f..0ace9a96e 100644 --- a/python/generate.py +++ b/python/generate.py @@ -32,6 +32,8 @@ from streamlit.elements.deck_gl_json_chart import PydeckState, PydeckSelectionState from streamlit.elements.widgets.data_editor import DataEditorState from streamlit.elements.lib.column_config_utils import ButtonColumnClickState +from streamlit.elements.widgets.chat import ChatInputValue +from streamlit.runtime.uploaded_file_manager import UploadedFile from streamlit.elements.lib.mutable_expander_container import ExpanderContainer from streamlit.elements.lib.mutable_popover_container import PopoverContainer from streamlit.elements.lib.mutable_tab_container import TabContainer @@ -654,6 +656,8 @@ def get_streamlit_docstring_dict(): DataframeSelectionState: ["DataframeSelectionState", "DataframeSelectionState"], DataEditorState: ["DataEditorState", "DataEditorState"], ButtonColumnClickState: ["ButtonColumnClickState", "ButtonColumnClickState"], + ChatInputValue: ["ChatInputValue", "ChatInputValue"], + UploadedFile: ["UploadedFile", "UploadedFile"], PydeckState: ["PydeckState", "PydeckState"], PydeckSelectionState: ["PydeckSelectionState", "PydeckSelectionState"], BidiComponentResult: ["BidiComponentResult", "BidiComponentResult"], diff --git a/python/streamlit.json b/python/streamlit.json index 0b1b1faff..cd98407e7 100644 --- a/python/streamlit.json +++ b/python/streamlit.json @@ -432394,6 +432394,51 @@ "returns": [], "is_attribute_dict": true }, + "ChatInputValue": { + "name": "ChatInputValue", + "signature": "ChatInputValue", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/elements/widgets/chat.py#L96", + "notes": "
    \n
  • Supports dict-like access via __getitem__, __setitem__, and __delitem__.
  • \n
  • Use to_dict() to convert the value to a standard dictionary.
  • \n
  • The 'files' key is only present when accept_file=True.
  • \n
  • The 'audio' key is only present when accept_audio=True.
  • \n
\n", + "description": "

Represents the value returned by st.chat_input after user interaction.

\n

To use this type in an annotation, import it from streamlit.typing.

\n

This dataclass contains the user's input text, any files uploaded, and optionally\nan audio recording. It provides a dict-like interface for accessing and modifying\nits attributes.

\n", + "args": [ + { + "name": "text", + "type_name": "str", + "is_optional": false, + "description": "

The text input provided by the user.

\n", + "default": null + }, + { + "name": "files", + "type_name": "list[UploadedFile]", + "is_optional": false, + "description": "

A list of files uploaded by the user. Only present when accept_file=True.

\n", + "default": null + }, + { + "name": "audio", + "type_name": "UploadedFile or None", + "is_optional": true, + "description": "

An audio recording uploaded by the user, if any. Only present when accept_audio=True.

\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "UploadedFile": { + "name": "UploadedFile", + "signature": "UploadedFile", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.62.0/lib/streamlit/runtime/uploaded_file_manager.py#L61", + "description": "

A mutable uploaded file.

\n

To use this type in an annotation, import it from streamlit.typing.

\n

This class extends BytesIO, which has copy-on-write semantics when\ninitialized with bytes.

\n", + "args": [], + "returns": [], + "is_attribute_dict": true + }, "PydeckState": { "name": "PydeckState", "signature": "PydeckState", From cdc3589cac4b7d59405e08ddf4f37dba3c0cb999 Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 14:51:52 +0200 Subject: [PATCH 09/15] Name validate and type in the 1.62.0 text_input highlight Co-authored-by: Cursor --- content/develop/quick-references/release-notes/2026.md | 2 +- content/develop/quick-references/release-notes/_index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/develop/quick-references/release-notes/2026.md b/content/develop/quick-references/release-notes/2026.md index 612af1f97..7b79801f5 100644 --- a/content/develop/quick-references/release-notes/2026.md +++ b/content/develop/quick-references/release-notes/2026.md @@ -15,7 +15,7 @@ _Release date: August 19, 2026_ **Highlights** -- ✨ Introducing client-side validation and specialized email, URL, phone, and search types for [`st.text_input`](/develop/api-reference/widgets/st.text_input), with smart defaults for validation, autofill, mobile keyboards, icons, and placeholders ([#15752](https://github.com/streamlit/streamlit/pull/15752), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#8790](https://github.com/streamlit/streamlit/issues/8790), [#7348](https://github.com/streamlit/streamlit/issues/7348), [#16385](https://github.com/streamlit/streamlit/pull/16385), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#10744](https://github.com/streamlit/streamlit/issues/10744)). +- ✨ Introducing client-side validation (`validate`) and specialized email, URL, phone, and search types (`type`) for [`st.text_input`](/develop/api-reference/widgets/st.text_input), with smart defaults for validation, autofill, mobile keyboards, icons, and placeholders ([#15752](https://github.com/streamlit/streamlit/pull/15752), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#8790](https://github.com/streamlit/streamlit/issues/8790), [#7348](https://github.com/streamlit/streamlit/issues/7348), [#16385](https://github.com/streamlit/streamlit/pull/16385), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#10744](https://github.com/streamlit/streamlit/issues/10744)). - 🧩 Introducing the new `wrap` parameter, which lets you choose whether horizontal layouts, widgets, and labels wrap or remain on one scrollable or truncated row: - [`st.columns`](/develop/api-reference/layout/st.columns) and horizontal [`st.container`](/develop/api-reference/layout/st.container) layouts can remain on one horizontally scrollable row with `wrap=False` ([#16131](https://github.com/streamlit/streamlit/pull/16131), [#16367](https://github.com/streamlit/streamlit/pull/16367), [#5003](https://github.com/streamlit/streamlit/issues/5003), [#2313](https://github.com/streamlit/streamlit/issues/2313), [#16484](https://github.com/streamlit/streamlit/pull/16484), [#9544](https://github.com/streamlit/streamlit/issues/9544), [#12582](https://github.com/streamlit/streamlit/issues/12582)). - [`st.button`](/develop/api-reference/widgets/st.button) and other button-like controls, [`st.checkbox`](/develop/api-reference/widgets/st.checkbox), and [`st.toggle`](/develop/api-reference/widgets/st.toggle) can keep labels on one line when desired ([#16325](https://github.com/streamlit/streamlit/pull/16325), [#16470](https://github.com/streamlit/streamlit/pull/16470)). diff --git a/content/develop/quick-references/release-notes/_index.md b/content/develop/quick-references/release-notes/_index.md index fb94da666..693db56b2 100644 --- a/content/develop/quick-references/release-notes/_index.md +++ b/content/develop/quick-references/release-notes/_index.md @@ -27,7 +27,7 @@ _Release date: August 19, 2026_ **Highlights** -- ✨ Introducing client-side validation and specialized email, URL, phone, and search types for [`st.text_input`](/develop/api-reference/widgets/st.text_input), with smart defaults for validation, autofill, mobile keyboards, icons, and placeholders ([#15752](https://github.com/streamlit/streamlit/pull/15752), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#8790](https://github.com/streamlit/streamlit/issues/8790), [#7348](https://github.com/streamlit/streamlit/issues/7348), [#16385](https://github.com/streamlit/streamlit/pull/16385), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#10744](https://github.com/streamlit/streamlit/issues/10744)). +- ✨ Introducing client-side validation (`validate`) and specialized email, URL, phone, and search types (`type`) for [`st.text_input`](/develop/api-reference/widgets/st.text_input), with smart defaults for validation, autofill, mobile keyboards, icons, and placeholders ([#15752](https://github.com/streamlit/streamlit/pull/15752), [#15714](https://github.com/streamlit/streamlit/pull/15714), [#8790](https://github.com/streamlit/streamlit/issues/8790), [#7348](https://github.com/streamlit/streamlit/issues/7348), [#16385](https://github.com/streamlit/streamlit/pull/16385), [#6704](https://github.com/streamlit/streamlit/issues/6704), [#10744](https://github.com/streamlit/streamlit/issues/10744)). - 🧩 Introducing the new `wrap` parameter, which lets you choose whether horizontal layouts, widgets, and labels wrap or remain on one scrollable or truncated row: - [`st.columns`](/develop/api-reference/layout/st.columns) and horizontal [`st.container`](/develop/api-reference/layout/st.container) layouts can remain on one horizontally scrollable row with `wrap=False` ([#16131](https://github.com/streamlit/streamlit/pull/16131), [#16367](https://github.com/streamlit/streamlit/pull/16367), [#5003](https://github.com/streamlit/streamlit/issues/5003), [#2313](https://github.com/streamlit/streamlit/issues/2313), [#16484](https://github.com/streamlit/streamlit/pull/16484), [#9544](https://github.com/streamlit/streamlit/issues/9544), [#12582](https://github.com/streamlit/streamlit/issues/12582)). - [`st.button`](/develop/api-reference/widgets/st.button) and other button-like controls, [`st.checkbox`](/develop/api-reference/widgets/st.checkbox), and [`st.toggle`](/develop/api-reference/widgets/st.toggle) can keep labels on one line when desired ([#16325](https://github.com/streamlit/streamlit/pull/16325), [#16470](https://github.com/streamlit/streamlit/pull/16470)). From a4c396dc425febddee2930f1bb2a443278c9abaf Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 15:17:58 +0200 Subject: [PATCH 10/15] Remove add_rows docs and redundant Autofunction headings add_rows is gone from Streamlit, so drop the deprecated API docs and update demos to redraw charts in place. Keep grouping headings only when a page documents multiple state types. Co-authored-by: Cursor --- .../api-reference/charts/altair_chart.md | 4 ---- .../api-reference/charts/area_chart.md | 2 -- .../develop/api-reference/charts/bar_chart.md | 2 -- .../api-reference/charts/line_chart.md | 2 -- content/develop/api-reference/charts/map.md | 2 -- .../api-reference/charts/scatter_chart.md | 2 -- .../api-reference/charts/vega_lite_chart.md | 4 ---- .../develop/api-reference/chat/chat-input.md | 2 -- .../data/column_config/buttoncolumn.md | 2 -- .../develop/api-reference/data/data_editor.md | 8 +++---- .../develop/api-reference/data/dataframe.md | 2 -- content/develop/api-reference/data/table.md | 2 -- .../api-reference/widgets/file_uploader.md | 2 -- .../concepts/app-design/animate-elements.md | 18 ++++++--------- .../quick-references/api-cheat-sheet.md | 18 --------------- .../tutorials/create-a-multi-page-app.md | 22 ++++++++++--------- python/api-examples-source/hello/hello.py | 11 +++++----- .../1_\360\237\223\210_Plotting_Demo.py" | 11 +++++----- python/generate.py | 1 - 19 files changed, 34 insertions(+), 83 deletions(-) diff --git a/content/develop/api-reference/charts/altair_chart.md b/content/develop/api-reference/charts/altair_chart.md index 9195cbf54..376d51f7b 100644 --- a/content/develop/api-reference/charts/altair_chart.md +++ b/content/develop/api-reference/charts/altair_chart.md @@ -7,12 +7,8 @@ keywords: altair_chart, altair, chart, visualization, data, plot, graph, vega-li -## Chart selections - - - ## Theming Altair charts are displayed using the Streamlit theme by default. This theme is sleek, user-friendly, and incorporates Streamlit's color palette. The added benefit is that your charts better integrate with the rest of your app's design. diff --git a/content/develop/api-reference/charts/area_chart.md b/content/develop/api-reference/charts/area_chart.md index cfe1d7b01..15d068482 100644 --- a/content/develop/api-reference/charts/area_chart.md +++ b/content/develop/api-reference/charts/area_chart.md @@ -6,5 +6,3 @@ keywords: area chart, chart, visualization, data, plot, graph, dataframe, filled --- - - diff --git a/content/develop/api-reference/charts/bar_chart.md b/content/develop/api-reference/charts/bar_chart.md index 926835e85..f8b32fd92 100644 --- a/content/develop/api-reference/charts/bar_chart.md +++ b/content/develop/api-reference/charts/bar_chart.md @@ -6,5 +6,3 @@ keywords: bar chart, chart, visualization, data, plot, graph, dataframe, categor --- - - diff --git a/content/develop/api-reference/charts/line_chart.md b/content/develop/api-reference/charts/line_chart.md index 27519e991..4fbcbb855 100644 --- a/content/develop/api-reference/charts/line_chart.md +++ b/content/develop/api-reference/charts/line_chart.md @@ -6,5 +6,3 @@ keywords: line chart, chart, visualization, data, plot, graph, dataframe, time s --- - - diff --git a/content/develop/api-reference/charts/map.md b/content/develop/api-reference/charts/map.md index 75ae30b01..f52225429 100644 --- a/content/develop/api-reference/charts/map.md +++ b/content/develop/api-reference/charts/map.md @@ -6,5 +6,3 @@ keywords: map, geographic, visualization, data, plot, graph, dataframe, coordina --- - - diff --git a/content/develop/api-reference/charts/scatter_chart.md b/content/develop/api-reference/charts/scatter_chart.md index a76a0d711..66a182112 100644 --- a/content/develop/api-reference/charts/scatter_chart.md +++ b/content/develop/api-reference/charts/scatter_chart.md @@ -6,5 +6,3 @@ keywords: scatter chart, chart, visualization, data, plot, graph, dataframe, cor --- - - diff --git a/content/develop/api-reference/charts/vega_lite_chart.md b/content/develop/api-reference/charts/vega_lite_chart.md index b604736fa..c5559a7db 100644 --- a/content/develop/api-reference/charts/vega_lite_chart.md +++ b/content/develop/api-reference/charts/vega_lite_chart.md @@ -7,12 +7,8 @@ keywords: vega_lite_chart, vega-lite, chart, visualization, data, plot, graph, i -## Chart selections - - - ## Theming Vega-Lite charts are displayed using the Streamlit theme by default. This theme is sleek, user-friendly, and incorporates Streamlit's color palette. The added benefit is that your charts better integrate with the rest of your app's design. diff --git a/content/develop/api-reference/chat/chat-input.md b/content/develop/api-reference/chat/chat-input.md index 2f5a689b3..9bc61d933 100644 --- a/content/develop/api-reference/chat/chat-input.md +++ b/content/develop/api-reference/chat/chat-input.md @@ -13,8 +13,6 @@ Read the [Build a basic LLM chat app](/develop/tutorials/chat-and-llm-apps/build -## Chat input value - For an overview of the `st.chat_input` and `st.chat_message` API, check out this video tutorial by Chanin Nantasenamat ([@dataprofessor](https://www.youtube.com/dataprofessor)), a Senior Developer Advocate at Streamlit. diff --git a/content/develop/api-reference/data/column_config/buttoncolumn.md b/content/develop/api-reference/data/column_config/buttoncolumn.md index c4bbbe15d..82411cf34 100644 --- a/content/develop/api-reference/data/column_config/buttoncolumn.md +++ b/content/develop/api-reference/data/column_config/buttoncolumn.md @@ -7,6 +7,4 @@ keywords: st.column_config.ButtonColumn, button column, clickable buttons, dataf -## Button click state - diff --git a/content/develop/api-reference/data/data_editor.md b/content/develop/api-reference/data/data_editor.md index 1b4d13205..731e161b2 100644 --- a/content/develop/api-reference/data/data_editor.md +++ b/content/develop/api-reference/data/data_editor.md @@ -13,12 +13,10 @@ This page only contains information on the `st.data_editor` API. For an overview -## Data editor state - - - -### Configuring columns +## Configuring columns You can configure the display and editing behavior of columns in `st.dataframe` and `st.data_editor` via the [Column configuration API](/develop/api-reference/data/st.column_config). We have developed the API to let you add images, charts, and clickable URLs in dataframe and data editor columns. Additionally, you can make individual columns editable, set columns as categorical and specify which options they can take, hide the index of the dataframe, and much more. + + diff --git a/content/develop/api-reference/data/dataframe.md b/content/develop/api-reference/data/dataframe.md index 9f32768a4..d6b61a9e9 100644 --- a/content/develop/api-reference/data/dataframe.md +++ b/content/develop/api-reference/data/dataframe.md @@ -19,8 +19,6 @@ Learn more in our [Dataframes](/develop/concepts/design/dataframes) guide and ch - - ## Interactivity Dataframes displayed with `st.dataframe` are interactive. End users can sort, resize, search, and copy data to their clipboard. For on overview of features, read our [Dataframes](/develop/concepts/design/dataframes#additional-ui-features) guide. diff --git a/content/develop/api-reference/data/table.md b/content/develop/api-reference/data/table.md index 643cd4225..77d4ad7b6 100644 --- a/content/develop/api-reference/data/table.md +++ b/content/develop/api-reference/data/table.md @@ -12,5 +12,3 @@ Static tables with `st.table` are the most basic way to display dataframes. For - - diff --git a/content/develop/api-reference/widgets/file_uploader.md b/content/develop/api-reference/widgets/file_uploader.md index 509f60356..f857a0455 100644 --- a/content/develop/api-reference/widgets/file_uploader.md +++ b/content/develop/api-reference/widgets/file_uploader.md @@ -7,6 +7,4 @@ keywords: st.file_uploader, file uploader, file upload, upload widget, file inpu -## Uploaded files - diff --git a/content/develop/concepts/app-design/animate-elements.md b/content/develop/concepts/app-design/animate-elements.md index 4ea0ff18d..a8e950590 100644 --- a/content/develop/concepts/app-design/animate-elements.md +++ b/content/develop/concepts/app-design/animate-elements.md @@ -2,7 +2,7 @@ title: Update and replace elements slug: /develop/concepts/design/animate description: Learn how Streamlit commands return objects you can use to update, replace, or clear elements in place. Understand the difference between element objects, container objects, widget values, and widget-mode elements. -keywords: element objects, update elements, replace elements, st.empty, add_rows, dynamic content, live updates, in-place updates, containers, widgets, widget mode +keywords: element objects, update elements, replace elements, st.empty, dynamic content, live updates, in-place updates, containers, widgets, widget mode --- # Update and replace elements @@ -182,9 +182,9 @@ time.sleep(1) msg.toast("Done!", icon="βœ…") ``` -## Appending data with `.add_rows()` +## Appending data to charts -`st.dataframe`, `st.table`, and basic chart elements like `st.line_chart` support an `.add_rows()` method that appends data to the element without replacing it. This is useful for streaming data or building up a chart incrementally: +To stream data into a chart, keep the data in a variable and redraw the chart in place with `st.empty`: ```python import streamlit as st @@ -193,18 +193,14 @@ import numpy as np import time df = pd.DataFrame(np.random.randn(15, 3), columns=["A", "B", "C"]) -chart = st.line_chart(df) +chart = st.empty() +chart.line_chart(df) for tick in range(10): time.sleep(0.5) new_row = pd.DataFrame(np.random.randn(1, 3), columns=["A", "B", "C"]) - chart.add_rows(new_row) + df = pd.concat([df, new_row], ignore_index=True) + chart.line_chart(df) st.button("Regenerate") ``` - - - -The Streamlit team is evaluating the future of `.add_rows()`. If you use this method, please share your feedback in the [community discussion](https://github.com/streamlit/streamlit/issues/13063). - - diff --git a/content/develop/quick-references/api-cheat-sheet.md b/content/develop/quick-references/api-cheat-sheet.md index 89586a58b..55eff5bc7 100644 --- a/content/develop/quick-references/api-cheat-sheet.md +++ b/content/develop/quick-references/api-cheat-sheet.md @@ -363,24 +363,6 @@ Learn how to [Build a basic LLM chat app](/develop/tutorials/chat-and-llm-apps/b -#### Mutate data - -```python hideHeader -# Add rows to a dataframe after -# showing it. -element = st.dataframe(df1) -element.add_rows(df2) - -# Add rows to a chart after -# showing it. -element = st.line_chart(df1) -element.add_rows(df2) -``` - - - - - #### Display code ```python hideHeader diff --git a/content/get-started/fundamentals/tutorials/create-a-multi-page-app.md b/content/get-started/fundamentals/tutorials/create-a-multi-page-app.md index 5db97eb81..dfd98b1ff 100644 --- a/content/get-started/fundamentals/tutorials/create-a-multi-page-app.md +++ b/content/get-started/fundamentals/tutorials/create-a-multi-page-app.md @@ -166,15 +166,16 @@ Streamlit. We're generating a bunch of random numbers in a loop for around progress_bar = st.sidebar.progress(0) status_text = st.sidebar.empty() - last_rows = np.random.randn(1, 1) - chart = st.line_chart(last_rows) + data = np.random.randn(1, 1) + chart = st.empty() + chart.line_chart(data) for i in range(1, 101): - new_rows = last_rows[-1, :] + np.random.randn(5, 1).cumsum(axis=0) + new_rows = data[-1, :] + np.random.randn(5, 1).cumsum(axis=0) + data = np.concatenate([data, new_rows]) status_text.text("%i%% Complete" % i) - chart.add_rows(new_rows) + chart.line_chart(data) progress_bar.progress(i) - last_rows = new_rows time.sleep(0.05) progress_bar.empty() @@ -354,15 +355,16 @@ Streamlit. We're generating a bunch of random numbers in a loop for around progress_bar = st.sidebar.progress(0) status_text = st.sidebar.empty() -last_rows = np.random.randn(1, 1) -chart = st.line_chart(last_rows) +data = np.random.randn(1, 1) +chart = st.empty() +chart.line_chart(data) for i in range(1, 101): - new_rows = last_rows[-1, :] + np.random.randn(5, 1).cumsum(axis=0) + new_rows = data[-1, :] + np.random.randn(5, 1).cumsum(axis=0) + data = np.concatenate([data, new_rows]) status_text.text("%i%% Complete" % i) - chart.add_rows(new_rows) + chart.line_chart(data) progress_bar.progress(i) - last_rows = new_rows time.sleep(0.05) progress_bar.empty() diff --git a/python/api-examples-source/hello/hello.py b/python/api-examples-source/hello/hello.py index 70e7c6bc0..c2a759964 100644 --- a/python/api-examples-source/hello/hello.py +++ b/python/api-examples-source/hello/hello.py @@ -146,15 +146,16 @@ def plotting_demo(): progress_bar = st.sidebar.progress(0) status_text = st.sidebar.empty() - last_rows = np.random.randn(1, 1) - chart = st.line_chart(last_rows) + data = np.random.randn(1, 1) + chart = st.empty() + chart.line_chart(data) for i in range(1, 101): - new_rows = last_rows[-1, :] + np.random.randn(5, 1).cumsum(axis=0) + new_rows = data[-1, :] + np.random.randn(5, 1).cumsum(axis=0) + data = np.concatenate([data, new_rows]) status_text.text("%i%% Complete" % i) - chart.add_rows(new_rows) + chart.line_chart(data) progress_bar.progress(i) - last_rows = new_rows time.sleep(0.05) progress_bar.empty() diff --git "a/python/api-examples-source/mpa-hello/pages/1_\360\237\223\210_Plotting_Demo.py" "b/python/api-examples-source/mpa-hello/pages/1_\360\237\223\210_Plotting_Demo.py" index 37ae5216f..0bff03b7d 100644 --- "a/python/api-examples-source/mpa-hello/pages/1_\360\237\223\210_Plotting_Demo.py" +++ "b/python/api-examples-source/mpa-hello/pages/1_\360\237\223\210_Plotting_Demo.py" @@ -21,15 +21,16 @@ def plotting_demo(): progress_bar = st.sidebar.progress(0) status_text = st.sidebar.empty() - last_rows = np.random.randn(1, 1) - chart = st.line_chart(last_rows) + data = np.random.randn(1, 1) + chart = st.empty() + chart.line_chart(data) for i in range(1, 101): - new_rows = last_rows[-1, :] + np.random.randn(5, 1).cumsum(axis=0) + new_rows = data[-1, :] + np.random.randn(5, 1).cumsum(axis=0) + data = np.concatenate([data, new_rows]) status_text.text("%i%% Complete" % i) - chart.add_rows(new_rows) + chart.line_chart(data) progress_bar.progress(i) - last_rows = new_rows time.sleep(0.05) progress_bar.empty() diff --git a/python/generate.py b/python/generate.py index 0ace9a96e..5f48d4119 100644 --- a/python/generate.py +++ b/python/generate.py @@ -627,7 +627,6 @@ def get_streamlit_docstring_dict(): streamlit.column_config: ["streamlit.column_config", "st.column_config"], componentsv1: ["streamlit.components.v1", "st.components.v1"], componentsv2: ["streamlit.components.v2", "st.components.v2"], - streamlit.delta_generator.DeltaGenerator: ["DeltaGenerator", "element", ["add_rows"]], # Only store docstring for element.add_rows StatusContainer: ["StatusContainer", "StatusContainer", ["update"]], # Only store docstring for StatusContainer.update streamlit.testing.v1: ["streamlit.testing.v1", "st.testing.v1"], AppTest: ["AppTest", "AppTest"], From 37d53033ae2d1b5f787d19fbc9b7e961a6665663 Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 15:45:11 +0200 Subject: [PATCH 11/15] Point readers to streamlit skills for AI coding agents Co-authored-by: Cursor --- .../develop/api-reference/command-line/_index.md | 8 +++++++- .../develop/quick-references/api-cheat-sheet.md | 1 + .../develop/tutorials/custom-components/_index.md | 6 ++++++ .../fundamentals/additional-features.md | 14 ++++++++++++-- content/get-started/installation/_index.md | 12 ++++++++++++ content/get-started/installation/command-line.md | 13 +++++++++++++ 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/content/develop/api-reference/command-line/_index.md b/content/develop/api-reference/command-line/_index.md index 13b81ac37..922022589 100644 --- a/content/develop/api-reference/command-line/_index.md +++ b/content/develop/api-reference/command-line/_index.md @@ -2,7 +2,7 @@ title: Command-line options slug: /develop/api-reference/cli description: Run Streamlit apps and manage configuration using the command-line interface for app execution, cache management, and system diagnostics. -keywords: cli, command line, streamlit run, cache, config, docs, hello, help, init, version, terminal, command +keywords: cli, command line, streamlit run, cache, config, docs, hello, help, init, version, terminal, command, streamlit skills --- # Command-line interface @@ -11,6 +11,12 @@ When you install Streamlit, a command-line (CLI) tool gets installed as well. The purpose of this tool is to run Streamlit apps, change Streamlit configuration options, and help you diagnose and fix issues. + + +If you use an AI coding agent, run [`streamlit skills`](/develop/api-reference/cli/skills) to install Streamlit's official agent skills. + + + ## Available commands - [`streamlit cache clear`](/develop/api-reference/cli/cache): Clear the on-disk cache. diff --git a/content/develop/quick-references/api-cheat-sheet.md b/content/develop/quick-references/api-cheat-sheet.md index 55eff5bc7..c7b99d9cb 100644 --- a/content/develop/quick-references/api-cheat-sheet.md +++ b/content/develop/quick-references/api-cheat-sheet.md @@ -49,6 +49,7 @@ streamlit hello streamlit help streamlit init streamlit run streamlit_app.py +streamlit skills streamlit version ``` diff --git a/content/develop/tutorials/custom-components/_index.md b/content/develop/tutorials/custom-components/_index.md index 5255b8270..6ffde5f96 100644 --- a/content/develop/tutorials/custom-components/_index.md +++ b/content/develop/tutorials/custom-components/_index.md @@ -9,6 +9,12 @@ keywords: custom components v2, tutorials, TypeScript, React, template, package- Build package-based Streamlit custom components using the official [component template](https://github.com/streamlit/component-template). These tutorials walk you through generating a project, understanding the generated code, and extending the template. + + +If you use an AI coding agent while building a component, install Streamlit's official agent skills with [`streamlit skills`](/develop/api-reference/cli/skills). + + + diff --git a/content/get-started/fundamentals/additional-features.md b/content/get-started/fundamentals/additional-features.md index b63c47068..0c401b3d5 100644 --- a/content/get-started/fundamentals/additional-features.md +++ b/content/get-started/fundamentals/additional-features.md @@ -1,8 +1,8 @@ --- title: Additional Streamlit features slug: /get-started/fundamentals/additional-features -description: Explore additional Streamlit features including theming, multipage apps, fragments, custom components, and advanced UI customization options. -keywords: additional features, theming, multipage apps, fragments, custom components, UI customization, advanced features, streamlit extras +description: Explore additional Streamlit features including theming, multipage apps, fragments, custom components, AI coding skills, and advanced UI customization options. +keywords: additional features, theming, multipage apps, fragments, custom components, UI customization, advanced features, streamlit extras, ai skills --- # Additional Streamlit features @@ -124,6 +124,16 @@ Now run `streamlit run streamlit_app.py` and view your shiny new multipage app! Our documentation on [Multipage apps](/develop/concepts/multipage-apps) teaches you how to add pages to your app, including how to define pages, structure and run multipage apps, and navigate between pages. Once you understand the basics, [create your first multipage app](/get-started/tutorials/create-a-multipage-app)! +## AI coding skills + +Streamlit bundles official skills for AI coding agents. Install them in your project so your agent follows current Streamlit APIs: + +```bash +streamlit skills +``` + +Use `streamlit skills --global` to install them once for every project on your machine. For details, see [`streamlit skills`](/develop/api-reference/cli/skills). + ## Custom components If you can't find the right component within the Streamlit library, try out custom components to extend Streamlit's built-in functionality. Explore and browse through popular, community-created components in the [Components gallery](https://streamlit.io/components). If you dabble in frontend development, you can build your own custom component with Streamlit's [components API](/develop/concepts/custom-components/intro). diff --git a/content/get-started/installation/_index.md b/content/get-started/installation/_index.md index e5c8940b3..712e38698 100644 --- a/content/get-started/installation/_index.md +++ b/content/get-started/installation/_index.md @@ -38,6 +38,18 @@ _playground_!) 1. Jump to our [Basic concepts](/get-started/fundamentals/main-concepts). + + +If you use an AI coding agent, install Streamlit's official agent skills so it follows current Streamlit APIs: + +```bash +streamlit skills +``` + +For details, see [`streamlit skills`](/develop/api-reference/cli/skills). + + + ## Install Streamlit on your machine ### Option 1: I like the command line diff --git a/content/get-started/installation/command-line.md b/content/get-started/installation/command-line.md index f5d6c5d41..09079beab 100644 --- a/content/get-started/installation/command-line.md +++ b/content/get-started/installation/command-line.md @@ -101,6 +101,19 @@ computer is properly set up. More specifically, you’ll need: 8. Streamlit's Hello app should appear in a new tab in your web browser! + + + +If you use an AI coding agent, install Streamlit's official agent skills so it follows current Streamlit APIs: + +```bash +streamlit skills +``` + +For details, see [`streamlit skills`](/develop/api-reference/cli/skills). + + + 9. Close your terminal when you are done. ## Create a "Hello World" app and run it From c07c8e323cfde563c44f82c90bd49c712d3f90d2 Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 15:45:21 +0200 Subject: [PATCH 12/15] Sync config.toml and theming docs with Streamlit 1.62 Co-authored-by: Cursor --- .../configuration/config-toml.md | 236 +++++++++++++++--- .../theming-colors-and-borders.md | 4 +- .../concepts/configuration/theming-fonts.md | 8 +- .../develop/concepts/configuration/theming.md | 3 +- .../FAQ/pydeck-chart-custom-mapbox-styles.md | 2 +- 5 files changed, 205 insertions(+), 48 deletions(-) diff --git a/content/develop/api-reference/configuration/config-toml.md b/content/develop/api-reference/configuration/config-toml.md index 050a2d55c..5e4432a41 100644 --- a/content/develop/api-reference/configuration/config-toml.md +++ b/content/develop/api-reference/configuration/config-toml.md @@ -2,7 +2,7 @@ title: config.toml slug: /develop/api-reference/configuration/config.toml description: Complete reference guide for Streamlit's config.toml configuration file, including all available sections and options for customizing your Streamlit application settings. -keywords: config.toml, streamlit configuration, toml configuration file, streamlit settings, theme configuration, server configuration, client configuration, logger configuration, browser configuration, mapbox configuration, secrets configuration, sidebar theme, configuration options, streamlit config show +keywords: config.toml, streamlit configuration, toml configuration file, streamlit settings, theme configuration, server configuration, client configuration, logger configuration, browser configuration, secrets configuration, sidebar theme, configuration options, streamlit config show --- ## config.toml @@ -143,6 +143,22 @@ showSidebarNavigation = true # # Default: "auto" showErrorLinks = "auto" + +# When true, hides the built-in controls for exporting data from +# components that support it: +# +# - Hides the CSV download button for st.dataframe, st.data_editor, +# and chart table views. +# - Disables clipboard copy for read-only tables (st.dataframe and +# chart table views), while keeping st.data_editor copy/paste enabled. +# +# This only hides the built-in export and copy controls. It does not +# prevent users from otherwise accessing the underlying data (e.g. via +# screenshots, browser developer tools, or network inspection), so it +# should not be relied upon as a security or data-protection control. +# +# Default: false +disableDataExport = false ``` #### Runner @@ -190,6 +206,39 @@ enforceSerializableSessionState = false # # Default: "nameOnly" enumCoercion = "nameOnly" + +# Maximum number of parallel fragment worker threads per script run. +# Sizes the per-run thread pool. Defaults to Python's +# ThreadPoolExecutor default (min(32, os.cpu_count() + 4)). +parallelMaxWorkers = + +# Escape hatch for an app whose @st.cache_data / @st.cache_resource cache +# returns the wrong value for a large pandas, polars, or numpy object. +# +# Large objects are hashed from a fixed random sample rather than in full, +# which keeps cache lookups fast. Because the sample positions are derived +# from this seed, two large objects that differ only outside the sampled +# positions produce the same cache key, and the cached value of one is +# returned for the other. +# +# Set an integer from 0 to 4294967295 (2**32 - 1) to move which positions +# are sampled. This does not eliminate collisions β€” it selects a different +# set of them β€” so it resolves a collision an app has actually hit rather +# than guaranteeing uniqueness. A value that cannot be converted to an +# integer, or that falls outside that range, is ignored with a warning and +# the default is used instead. A float is truncated toward zero, so 1.5 +# becomes 1. +# +# Changing this value changes the cache key of every large object and so +# invalidates existing cached entries. Keep it stable across restarts and +# across replicas, or a shared/persisted cache will miss. +# +# If you need hashing to be exact rather than a different sample, pass your +# own function for the type via the `hash_funcs` argument of +# `@st.cache_data` / `@st.cache_resource`, which bypasses sampling entirely. +# +# Default: 0 +cacheHashSeed = 0 ``` #### Server @@ -223,7 +272,8 @@ folderWatchBlacklist = [] # # Allowed values: # - "auto" : Streamlit will attempt to use the watchdog module, and -# falls back to polling if watchdog isn't available. +# falls back to polling if watchdog isn't available. In WSL +# environments, polling is always used for compatibility. # - "watchdog" : Force Streamlit to use the watchdog module. # - "poll" : Force Streamlit to always use polling. # - "none" : Streamlit will not watch files. @@ -231,6 +281,19 @@ folderWatchBlacklist = [] # Default: "auto" fileWatcherType = "auto" +# If True, Streamlit will use a recursive object graph traversal to +# calculate memory usage statistics for the /_stcore/metrics endpoint. +# +# This can be slow for large session state or cached resource objects. If +# False (the default), Streamlit reports fast proxy values for those +# objects: item counts (the number of cached entries or session-state +# keys) rather than byte sizes. The cache_memory_bytes metric will +# therefore reflect entry counts, not memory consumption, for those +# objects. +# +# Default: false +enableExpensiveMemoryStats = false + # Symmetric key used to produce signed cookies. If deploying on multiple # replicas, this should be set to the same value across all replicas to ensure # they all share the same secret. @@ -279,8 +342,10 @@ baseUrlPath = "" # Enables support for Cross-Origin Resource Sharing (CORS) protection, # for added security. # -# If XSRF protection is enabled and CORS protection is disabled at the -# same time, Streamlit will enable them both instead. +# If you set this option to `False`, Streamlit sends +# `Access-Control-Allow-Origin: *` on most HTTP routes and accepts a +# WebSocket connection from any origin. Streamlit does not enable this +# option for you when `server.enableXsrfProtection` is `True`. # # Default: true enableCORS = true @@ -298,15 +363,61 @@ enableCORS = true # Default: [] corsAllowedOrigins = [] +# Allow-list of hostnames for incoming WebSocket connections. +# +# Use this option to protect against DNS rebinding attacks when the +# hostnames used to access the app are known. Ports in the Host header are +# ignored. Wildcard subdomains are supported with a leading `*.`. Use `*` +# to accept any valid Host header. +# +# If this list is empty (the default), Streamlit accepts any Host header +# to preserve compatibility with dynamically configured reverse proxies +# and custom domains. +# +# Example: ['localhost', 'app.example.com', '*.example.com'] +# +# Default: [] +allowedHosts = [] + # Enables support for Cross-Site Request Forgery (XSRF) protection, for # added security. # -# If XSRF protection is enabled and CORS protection is disabled at the -# same time, Streamlit will enable them both instead. +# This option does not enable `server.enableCORS`. Streamlit does not +# need a valid XSRF token to open a WebSocket connection, so this option +# does not replace `server.enableCORS`. # # Default: true enableXsrfProtection = true +# Controls the SameSite attribute of the cookie Streamlit uses for +# Cross-Site Request Forgery (XSRF) protection. This only has an effect +# when XSRF protection is enabled (via `server.enableXsrfProtection` or +# an `[auth]` section in your secrets); otherwise no XSRF cookie is set. +# It does not affect authentication cookies, which always use +# SameSite=Lax. +# +# Allowed values: +# - "lax" (default): The XSRF cookie is sent on same-site requests and +# top-level cross-site navigations. This is the recommended, secure +# default. +# - "strict": The XSRF cookie is only sent on same-site requests. +# - "none": The XSRF cookie is sent on all requests, including cross-site +# requests. This is required when embedding a Streamlit app in an +# iframe hosted on a different origin (for example, to make +# `st.file_uploader` work inside a cross-origin iframe). Browsers +# only accept `SameSite=None` cookies that also have the `Secure` +# attribute, so Streamlit sets `Secure` automatically in this case. +# This means your app must be served over HTTPS (either directly or via +# a TLS-terminating proxy), otherwise browsers will drop the cookie. +# +# Note: Setting this to "none" relaxes the browser's SameSite-based CSRF +# mitigation, so protection then relies on Streamlit's XSRF token +# validation together with the CORS origin allowlist. Only use "none" if +# you understand this tradeoff. +# +# Default: "lax" +xsrfCookieSameSite = "lax" + # Max size, in megabytes, for files uploaded with the file_uploader. # # Default: 200 @@ -331,8 +442,7 @@ enableWebsocketCompression = false # "Connection error" messages), you may want to try adjusting this value. # # Note: When you set this option, Streamlit automatically sets the ping -# timeout to match this interval. For Tornado >=6.5, a value less than 30 -# may cause connection issues. +# timeout to match this interval. websocketPingInterval = # Enable serving files from a `static` directory in the running app's @@ -353,12 +463,6 @@ enableStaticServing = false # Default: 120 disconnectedSessionTTL = 120 -# Enable the experimental Starlette-based server implementation instead of -# Tornado. This is an experimental feature and may be removed in the future. -# -# Default: false -useStarlette = false - # Server certificate file for connecting via HTTPS. # Must be set at the same time as "server.sslKeyFile". # @@ -414,25 +518,6 @@ gatherUsageStats = true serverPort = 8501 ``` -#### Mapbox - -```toml -[mapbox] - -# If you'd like to show maps using Mapbox rather than Carto, use this -# to pass the Mapbox API token. -# -# THIS IS DEPRECATED. -# -# Instead of this, you should use either the MAPBOX_API_KEY environment -# variable or PyDeck's `api_keys` argument. -# -# This option will be removed on or after 2026-05-01. -# -# Default: "" -token = "" -``` - #### Theme To define switchable light and dark themes, the configuration options in the @@ -443,10 +528,11 @@ tables, except for the following options: - `fontFaces` - `baseFontSize` - `baseFontWeight` +- `metricValueFontSize` +- `metricValueFontWeight` - `showSidebarBorder` -- `chartCategoricalColors` -- `chartSequentialColors` -- `chartDivergingColors` + +Chart series colors (`chartCategoricalColors`, `chartSequentialColors`, and `chartDivergingColors`) can be set in `[theme]`, `[theme.light]`, `[theme.dark]`, and the corresponding sidebar sections. Unset sections inherit from `[theme]`. Additionally, everything in `[theme.sidebar]` can be configured in separate `[theme.dark.sidebar]` and `[theme.light.sidebar]` tables. @@ -745,11 +831,31 @@ baseFontSize = # The root font weight for the app. # # This determines the overall weight of text and UI elements. This is an -# integer multiple of 100. Values can be between 100 and 600, inclusive. +# integer multiple of 50. Values can be between 100 and 600, inclusive. +# +# Streamlit derives heavier weights from this base (+100 / +200 / +300). +# The maximum is 600 so the heaviest derived weight never exceeds 900. # # If this isn't set, the font weight will be set to 400 (normal weight). baseFontWeight = +# The font size for st.metric value text. +# +# Font sizes can be specified in pixels or rem, like "48px" or "3rem". +# If a numeric string is provided without a unit, it will be treated as +# pixels. If you pass an integer or float directly, it will be ignored. +# +# If this isn't set, the font size will be 2.25rem. +metricValueFontSize = + +# The font weight for st.metric value text. +# +# This is an integer multiple of 50. Values can be between 100 and 900, +# inclusive. +# +# If this isn't set, the font weight will inherit from the parent element. +metricValueFontWeight = + # The font family to use for headings. # # This can be one of the following: @@ -794,6 +900,9 @@ headingFontSizes = # One or more font weights for h1-h6 headings. # +# Each weight must be an integer multiple of 50, between 100 and 900 +# inclusive. Invalid values are ignored and the default weight is used. +# # If no weights are set, Streamlit will use the default weights for h1-h6 # headings. Heading font weights set in [theme] are not inherited by # [theme.sidebar]. The following weights are used by default: @@ -814,7 +923,7 @@ headingFontSizes = # # Setting a single value (not in an array) will set the font weight for # all h1-h6 headings to that value: -# headingFontWeights = 500 +# headingFontWeights = 550 headingFontWeights = # The font family to use for code (monospace) in the sidebar. @@ -841,9 +950,12 @@ codeFontSize = # The font weight for code blocks and code text. # # This applies to font in inline code, code blocks, `st.json`, and -# `st.help`. This is an integer multiple of 100. Values can be between +# `st.help`. This is an integer multiple of 50. Values can be between # 100 and 600, inclusive. # +# Streamlit derives heavier code weights from this base (+200 / +300). +# The maximum is 600 so the heaviest derived weight never exceeds 900. +# # If this isn't set, the code font weight will be 400 (normal weight). codeFontWeight = @@ -911,6 +1023,10 @@ showSidebarBorder = # more categories than colors. If no chart categorical colors are set, # Streamlit uses a default set of colors. # +# This option can be set in `[theme]`, `[theme.light]`, `[theme.dark]`, +# and the corresponding sidebar sections. Unset sections inherit from +# `[theme]`. +# # For light themes, the following colors are the default: # [ # "#0068c9", # blue80 @@ -947,6 +1063,10 @@ chartCategoricalColors = # Invalid color strings are skipped. If there are not exactly ten # valid colors specified, Streamlit uses a default set of colors. # +# This option can be set in `[theme]`, `[theme.light]`, `[theme.dark]`, +# and the corresponding sidebar sections. Unset sections inherit from +# `[theme]`. +# # For light themes, the following colors are the default: # [ # "#e4f5ff", #blue10 @@ -984,6 +1104,10 @@ chartSequentialColors = # Invalid color strings are skipped. If there are not exactly ten # valid colors specified, Streamlit uses a default set of colors. # +# This option can be set in `[theme]`, `[theme.light]`, `[theme.dark]`, +# and the corresponding sidebar sections. Unset sections inherit from +# `[theme]`. +# # The default colors are: # [ # "#7d353b", #red100 @@ -1293,6 +1417,9 @@ headingFontSizes = # One or more font weights for h1-h6 headings. # +# Each weight must be an integer multiple of 50, between 100 and 900 +# inclusive. Invalid values are ignored and the default weight is used. +# # If no weights are set, Streamlit will use the default weights for h1-h6 # headings. Heading font weights set in [theme] are not inherited by # [theme.sidebar]. The following weights are used by default: @@ -1313,7 +1440,7 @@ headingFontSizes = # # Setting a single value (not in an array) will set the font weight for # all h1-h6 headings to that value: -# headingFontWeights = 500 +# headingFontWeights = 550 headingFontWeights = # The font family to use for code (monospace) in the sidebar. @@ -1340,9 +1467,12 @@ codeFontSize = # The font weight for code blocks and code text. # # This applies to font in inline code, code blocks, `st.json`, and -# `st.help`. This is an integer multiple of 100. Values can be between +# `st.help`. This is an integer multiple of 50. Values can be between # 100 and 600, inclusive. # +# Streamlit derives heavier code weights from this base (+200 / +300). +# The maximum is 600 so the heaviest derived weight never exceeds 900. +# # If this isn't set, the code font weight will be 400 (normal weight). codeFontWeight = @@ -1395,6 +1525,30 @@ dataframeHeaderBackgroundColor = # Whether to show a border around input widgets. showWidgetBorder = + +# An array of colors to use for categorical chart data. +# +# See `theme.chartCategoricalColors` for the full description. This +# option can be set in `[theme]`, `[theme.light]`, `[theme.dark]`, and +# the corresponding sidebar sections. Unset sections inherit from +# `[theme]`. +chartCategoricalColors = + +# An array of ten colors to use for sequential or continuous chart data. +# +# See `theme.chartSequentialColors` for the full description. This +# option can be set in `[theme]`, `[theme.light]`, `[theme.dark]`, and +# the corresponding sidebar sections. Unset sections inherit from +# `[theme]`. +chartSequentialColors = + +# An array of ten colors to use for diverging chart data. +# +# See `theme.chartDivergingColors` for the full description. This +# option can be set in `[theme]`, `[theme.light]`, `[theme.dark]`, and +# the corresponding sidebar sections. Unset sections inherit from +# `[theme]`. +chartDivergingColors = ``` #### Secrets diff --git a/content/develop/concepts/configuration/theming-colors-and-borders.md b/content/develop/concepts/configuration/theming-colors-and-borders.md index 4060f5fb0..bec20ebb4 100644 --- a/content/develop/concepts/configuration/theming-colors-and-borders.md +++ b/content/develop/concepts/configuration/theming-colors-and-borders.md @@ -34,9 +34,8 @@ The following two configuration options can only be applied to the whole app: - `theme.base` sets the default colors for your app's theme to match one of Streamlit's two default themes (`"light"` or `"dark"`). If any theme configuation option is used and `theme.base` is not set, then Streamlit will use `"light"`. - `theme.showSidebarBorder` sets the visibility of the border between the sidebar and the main body of your app. -- `theme.chartCategoricalColors`, `theme.chartSequentialColors`, and `theme.chartDivergingColors` set the series colors for Plotly, Altair, and Vega-Lite charts. -The following configuration options can be set separately for the sidebar by using the `[theme.sidebar]` table instead of the `[theme]` table in `config.toml`: +The following configuration options can be set separately for the sidebar by using the `[theme.sidebar]` table instead of the `[theme]` table in `config.toml`. Chart series colors can also be set separately in `[theme.light]`, `[theme.dark]`, and the corresponding sidebar sections; unset sections inherit from `[theme]`. - `theme.primaryColor` - `theme.backgroundColor` @@ -52,6 +51,7 @@ The following configuration options can be set separately for the sidebar by usi - `theme.dataframeBorderColor` - `theme.dataframeHeaderBackgroundColor` - `theme.showWidgetBorder` +- `theme.chartCategoricalColors`, `theme.chartSequentialColors`, and `theme.chartDivergingColors` - All color palette options For brevity, on the rest of this page, theming configuration options will not include the `theme.` or `theme.sidebar.` prefix. diff --git a/content/develop/concepts/configuration/theming-fonts.md b/content/develop/concepts/configuration/theming-fonts.md index 5d5abbf63..8eaf2ca3c 100644 --- a/content/develop/concepts/configuration/theming-fonts.md +++ b/content/develop/concepts/configuration/theming-fonts.md @@ -29,17 +29,19 @@ codeFont = "monospace" You can set the base font weight and size in the `[theme]` table in `config.toml`. These can't be configured separately in the sidebar. - `theme.baseFontSize` sets the root font size for your app. -- `theme.baseFontWeight` sets the root font weight for your app. +- `theme.baseFontWeight` sets the root font weight for your app. Weights are integer multiples of 50 between 100 and 600. +- `theme.metricValueFontSize` sets the font size of `st.metric` values. +- `theme.metricValueFontWeight` sets the font weight of `st.metric` values. Weights are integer multiples of 50 between 100 and 900. The following configuration options can be set separately for the sidebar by using the `[theme.sidebar]` table instead of the `[theme]` table in `config.toml`: - `theme.font` sets the default font for all text in the app (except inline code and code blocks). This is `"sans-serif"` (Source Sans) by default. - `theme.headingFont` sets the default font for all headings in the app. If this is not set, Streamlit uses `theme.font` instead. - `theme.headingFontSizes` sets the font sizes for `

`-`

` headings. -- `theme.headingFontWeights` sets the font sizes for `

`-`

` headings. +- `theme.headingFontWeights` sets the font weights for `

`-`

` headings. Weights are integer multiples of 50 between 100 and 900. - `theme.codeFont` sets the default font for all inline code and code blocks. This is `"monospace"` (Source Code) by default. - `theme.codeFontSize` sets the size of code text in code blocks, `st.json`, and `st.help` (but not inline code). -- `theme.codeFontWeight` sets the weight of code text in code blocks, `st.json`, and `st.help` (but not inline code). +- `theme.codeFontWeight` sets the weight of code text in code blocks, `st.json`, and `st.help` (but not inline code). Weights are integer multiples of 50 between 100 and 600. When fonts are not declared in `[theme.sidebar]`, Streamlit will inherit each option from `[theme]` before defaulting to less specific options. For example, if `theme.sidebar.headingFont` is not set, Streamlit uses (in order of precedence) `theme.headingFont`, `theme.sidebar.font`, or `theme.font` instead. diff --git a/content/develop/concepts/configuration/theming.md b/content/develop/concepts/configuration/theming.md index 44d108ec7..1dfdade35 100644 --- a/content/develop/concepts/configuration/theming.md +++ b/content/develop/concepts/configuration/theming.md @@ -17,7 +17,7 @@ light-theme tables: - **Base color scheme**: Set your custom theme to inherit from Streamlit's light or dark theme, or use an external theming TOML file. - **Base font**: Set the base font weight and size. (This can be configured separately for heading and code font.) -- **Chart color**: Set series colors for Plotly, Altair, and Vega-Lite charts. +- **Metric value font**: Set the font size and weight of `st.metric` values. - **Sidebar border**: Set the visibility of the sidebar border. The following options can be configured separately for the main body of your app and the sidebar. They can also be specified separately for @@ -31,6 +31,7 @@ dark and light themes (`[theme.light]`, `[theme.light.sidebar]`, `[theme.dark]`, - **Border radius**: Set the roundness of elements and widgets. - **Border color**: Set the color and visibility of element, widget, sidebar, and dataframe borders. - **Basic color palette**: Set the color palette (red, orange, yellow, green, blue, violet, and gray/grey) for things like colored Markdown text and sparklines. +- **Chart color**: Set series colors for Plotly, Altair, and Vega-Lite charts. Unset light, dark, and sidebar sections inherit from `[theme]`. ## Example themes diff --git a/content/kb/FAQ/pydeck-chart-custom-mapbox-styles.md b/content/kb/FAQ/pydeck-chart-custom-mapbox-styles.md index c63ae4d64..54ec23ec6 100644 --- a/content/kb/FAQ/pydeck-chart-custom-mapbox-styles.md +++ b/content/kb/FAQ/pydeck-chart-custom-mapbox-styles.md @@ -5,4 +5,4 @@ slug: /knowledge-base/using-streamlit/pydeck-chart-custom-mapbox-styles # How can I make st.pydeck_chart use custom Mapbox styles? -If you are supplying a Mapbox token, but the resulting `pydeck_chart` doesn't show your custom Mapbox styles, please check that you are adding the Mapbox token to the Streamlit `config.toml` configuration file. Streamlit DOES NOT read Mapbox tokens from inside of a PyDeck specification (i.e. from inside of the Streamlit app). Please see this [forum thread](https://discuss.streamlit.io/t/deprecation-warning-deckgl-pydeck-maps-to-require-mapbox-token-for-production-usage/2982/10) for more information. +If you are supplying a Mapbox token, but the resulting `pydeck_chart` doesn't show your custom Mapbox styles, set the token with the `MAPBOX_API_KEY` environment variable or PyDeck's `api_keys` argument. Streamlit does not read Mapbox tokens from inside of a PyDeck specification (i.e. from inside of the Streamlit app). Please see this [forum thread](https://discuss.streamlit.io/t/deprecation-warning-deckgl-pydeck-maps-to-require-mapbox-token-for-production-usage/2982/10) for more information. From b4c823e2ac86da5048b68da68e2a3ea2e2b672c5 Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 15:45:30 +0200 Subject: [PATCH 13/15] Move third-party components to the end of the API reference Co-authored-by: Cursor --- content/develop/api-reference/_index.md | 1533 +++++++---------- .../develop/api-reference/charts/_index.md | 141 +- .../api-reference/control-flow/_index.md | 55 - content/develop/api-reference/data/_index.md | 106 -- .../develop/api-reference/layout/_index.md | 55 - content/develop/api-reference/media/_index.md | 100 -- .../develop/api-reference/status/_index.md | 55 - content/develop/api-reference/text/_index.md | 72 - .../develop/api-reference/widgets/_index.md | 157 -- content/menu.md | 2 +- 10 files changed, 622 insertions(+), 1654 deletions(-) diff --git a/content/develop/api-reference/_index.md b/content/develop/api-reference/_index.md index f84acf17a..7347bc327 100644 --- a/content/develop/api-reference/_index.md +++ b/content/develop/api-reference/_index.md @@ -249,78 +249,6 @@ st.iframe("my_content.html") - - - -screenshot - -

Annotated text

- -Display annotated text in Streamlit apps. Created by [@tvst](https://github.com/tvst). - -```python -annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".") -``` - -
- - - -screenshot - -

Drawable Canvas

- -Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). - -```python -st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) -``` - -
- - - -screenshot - -

Tags

- -Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). - -```python -st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') -``` - -
- - - -screenshot - -

NLU

- -Apply text mining on a dataframe. Created by [@JohnSnowLabs](https://github.com/JohnSnowLabs/). - -```python -nlu.load("sentiment").predict("I love NLU! <3") -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",) -``` - -
-
- ### Data elements
@@ -403,112 +331,6 @@ st.json(my_dict) - - - - -screenshot - -

Streamlit Aggrid

- -Implementation of Ag-Grid component for Streamlit. Created by [@PablocFonseca](https://github.com/PablocFonseca). - -```python -df = pd.DataFrame({'col1': [1, 2, 3], 'col2': [4, 5, 6]}) -grid_return = AgGrid(df, editable=True) - -new_df = grid_return['data'] -``` - -
- - - -screenshot - -

Streamlit Folium

- -Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). - -```python -m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) -folium.Marker([39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell").add_to(m) - -st_data = st_folium(m, width=725) -``` - -
- - - -screenshot - -

Pandas Profiling

- -Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/). - -```python -df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv") -pr = df.profile_report() - -st_profile_report(pr) -``` - -
- - - -screenshot - -

Image Coordinates

- -Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). - -```python -from streamlit_image_coordinates import streamlit_image_coordinates -value = streamlit_image_coordinates("https://placekitten.com/200/300") - -st.write(value) -``` - -
- - - -screenshot - -

Plotly Events

- -Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). - -```python -from streamlit_plotly_events import plotly_events -fig = px.line(x=[1], y=[1]) - -selected_points = plotly_events(fig) -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -from streamlit_extras.metric_cards import style_metric_cards -col3.metric(label="No Change", value=5000, delta=0) - -style_metric_cards() -``` - -
- -
- ### Chart elements
@@ -662,223 +484,84 @@ st.mermaid_chart("graph LR\n A --> B") - +### Input widgets - +
-screenshot + + -

Plost

+screenshot -A deceptively simple plotting library for Streamlit. Created by [@tvst](https://github.com/tvst). +

Button

+ +Display a button widget. ```python -import plost -plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',) +clicked = st.button("Click me") ``` -
- - + + -screenshot +screenshot -

HiPlot

+

Download button

-High dimensional Interactive Plotting. Created by [@facebookresearch](https://github.com/facebookresearch). +Display a download button widget. ```python -data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}] -hip.Experiment.from_iterable(data).display() +st.download_button("Download file", file) ``` -
- - + + -screenshot +screenshot -

ECharts

+

Form button

-High dimensional Interactive Plotting. Created by [@andfanilo](https://github.com/andfanilo). +Display a form submit button. For use with `st.form`. ```python -from streamlit_echarts import st_echarts -st_echarts(options=options) +st.form_submit_button("Sign up") ``` -
- - + + -screenshot +screenshot -

Streamlit Folium

+

Link button

-Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). +Display a link button. ```python -m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) -st_data = st_folium(m, width=725) +st.link_button("Go to gallery", url) ``` -
+ - + -screenshot +screenshot -

Spacy-Streamlit

+

Menu button

-spaCy building blocks and visualizers for Streamlit apps. Created by [@explosion](https://github.com/explosion). +Display a menu button. ```python -models = ["en_core_web_sm", "en_core_web_md"] -spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.") +st.menu_button("Export", options=["CSV", "JSON", "PDF"]) ``` -
- - + + -screenshot +screenshot -

Streamlit Agraph

+

Page link

-A Streamlit Graph Vis, based on [react-grah-vis](https://github.com/crubier/react-graph-vis). Created by [@ChrisDelClea](https://github.com/ChrisDelClea). - -```python -from streamlit_agraph import agraph, Node, Edge, Config -agraph(nodes=nodes, edges=edges, config=config) -``` - -
- - - -screenshot - -

Streamlit Lottie

- -Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). - -```python -lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") -st_lottie(lottie_hello, key="hello") -``` - -
- - - -screenshot - -

Plotly Events

- -Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). - -```python -fig = px.line(x=[1], y=[1]) -selected_points = plotly_events(fig) -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],) -st.altair_chart(chart, use_container_width=True) -``` - -
- -
- -### Input widgets - -
- - - - -screenshot - -

Button

- -Display a button widget. - -```python -clicked = st.button("Click me") -``` - -
- - -screenshot - -

Download button

- -Display a download button widget. - -```python -st.download_button("Download file", file) -``` - -
- - -screenshot - -

Form button

- -Display a form submit button. For use with `st.form`. - -```python -st.form_submit_button("Sign up") -``` - -
- - -screenshot - -

Link button

- -Display a link button. - -```python -st.link_button("Go to gallery", url) -``` - -
- - - -screenshot - -

Menu button

- -Display a menu button. - -```python -st.menu_button("Export", options=["CSV", "JSON", "PDF"]) -``` - -
- - -screenshot - -

Page link

- -Display a link to another page in a multipage app. +Display a link to another page in a multipage app. ```python st.page_link("app.py", label="Home", icon="🏠") @@ -1189,371 +872,114 @@ image = st.camera_input("Take a picture")
- +### Media elements - +
-screenshot + + -

Streamlit Elements

+screenshot -Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). +

Image

-```python -from streamlit_elements import elements, mui, html +Display an image or list of images. -with elements("new_element"): - mui.Typography("Hello world") +```python +st.image(numpy_array) +st.image(image_bytes) +st.image(file) +st.image("https://example.com/myimage.jpg") ``` -
- - + + -screenshot +screenshot -

Tags

+

Logo

-Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). +Display a logo in the upper-left corner of your app and its sidebar. ```python -from streamlit_tags import st_tags - -st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], -suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') +st.logo("logo.jpg") ``` -
- - + + -screenshot +screenshot -

Stqdm

+

PDF

-The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). +Display a PDF file. ```python -from stqdm import stqdm - -for _ in stqdm(range(50)): - sleep(0.5) +st.pdf("my_document.pdf") ``` -
- - + + -screenshot +screenshot -

Timeline

+

Audio

-Display a Timeline in Streamlit apps using [TimelineJS](https://timeline.knightlab.com/). Created by [@innerdoc](https://github.com/innerdoc). +Display an audio player. ```python -from streamlit_timeline import timeline - -with open('example.json', "r") as f: - timeline(f.read(), height=800) +st.audio(numpy_array) +st.audio(audio_bytes) +st.audio(file) +st.audio("https://example.com/myaudio.mp3", format="audio/mp3") ``` -
- - + + -screenshot +screenshot -

Camera input live

+

Video

-Alternative for st.camera_input which returns the webcam images live. Created by [@blackary](https://github.com/blackary). +Display a video player. ```python -from camera_input_live import camera_input_live - -image = camera_input_live() -st.image(value) +st.video(numpy_array) +st.video(video_bytes) +st.video(file) +st.video("https://example.com/myvideo.mp4", format="video/mp4") ``` -
+ + - +### Layouts and containers -screenshot +
-

Streamlit Ace

+ + -Ace editor component for Streamlit. Created by [@okld](https://github.com/okld). +screenshot -```python -from streamlit_ace import st_ace +

Columns

-content = st_ace() -content -``` +Insert containers laid out as side-by-side columns. -
+```python +col1, col2 = st.columns(2) +col1.write("this is column 1") +col2.write("this is column 2") +``` - + + -screenshot +screenshot -

Streamlit Chat

+

Container

-Streamlit Component for a Chatbot UI. Created by [@AI-Yash](https://github.com/AI-Yash). - -```python -from streamlit_chat import message - -message("My message") -message("Hello bot!", is_user=True) # align's the message to the right -``` - -
- - - -screenshot - -

Streamlit Option Menu

- -Select a single item from a list of options in a menu. Created by [@victoryhb](https://github.com/victoryhb). - -```python -from streamlit_option_menu import option_menu - -option_menu("Main Menu", ["Home", 'Settings'], - icons=['house', 'gear'], menu_icon="cast", default_index=1) -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -from streamlit_extras.stoggle import stoggle - -stoggle( - "Click me!", """πŸ₯· Surprise! Here's some additional content""",) -``` - -
- -
- -### Media elements - -
- - - - -screenshot - -

Image

- -Display an image or list of images. - -```python -st.image(numpy_array) -st.image(image_bytes) -st.image(file) -st.image("https://example.com/myimage.jpg") -``` - -
- - -screenshot - -

Logo

- -Display a logo in the upper-left corner of your app and its sidebar. - -```python -st.logo("logo.jpg") -``` - -
- - -screenshot - -

PDF

- -Display a PDF file. - -```python -st.pdf("my_document.pdf") -``` - -
- - -screenshot - -

Audio

- -Display an audio player. - -```python -st.audio(numpy_array) -st.audio(audio_bytes) -st.audio(file) -st.audio("https://example.com/myaudio.mp3", format="audio/mp3") -``` - -
- - -screenshot - -

Video

- -Display a video player. - -```python -st.video(numpy_array) -st.video(video_bytes) -st.video(file) -st.video("https://example.com/myvideo.mp4", format="video/mp4") -``` - -
-
- - - - - -screenshot - -

Streamlit Webrtc

- -Handling and transmitting real-time video/audio streams with Streamlit. Created by [@whitphx](https://github.com/whitphx). - -```python -from streamlit_webrtc import webrtc_streamer - -webrtc_streamer(key="sample") -``` - -
- - - -screenshot - -

Drawable Canvas

- -Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). - -```python -from streamlit_drawable_canvas import st_canvas - -st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) -``` - -
- - - -screenshot - -

Image Comparison

- -Compare images with a slider using [JuxtaposeJS](https://juxtapose.knightlab.com/). Created by [@fcakyon](https://github.com/fcakyon). - -```python -from streamlit_image_comparison import image_comparison - -image_comparison(img1="image1.jpg", img2="image2.jpg",) -``` - -
- - - -screenshot - -

Streamlit Cropper

- -A simple image cropper for Streamlit. Created by [@turner-anderson](https://github.com/turner-anderson). - -```python -from streamlit_cropper import st_cropper - -st_cropper(img, realtime_update=realtime_update, box_color=box_color, aspect_ratio=aspect_ratio) -``` - -
- - - -screenshot - -

Image Coordinates

- -Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). - -```python -from streamlit_image_coordinates import streamlit_image_coordinates - -streamlit_image_coordinates("https://placekitten.com/200/300") -``` - -
- - - -screenshot - -

Streamlit Lottie

- -Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). - -```python -lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") - -st_lottie(lottie_hello, key="hello") -``` - -
- -
- -### Layouts and containers - -
- - - - -screenshot - -

Columns

- -Insert containers laid out as side-by-side columns. - -```python -col1, col2 = st.columns(2) -col1.write("this is column 1") -col2.write("this is column 2") -``` - -
- - -screenshot - -

Container

- -Insert a multi-element container. +Insert a multi-element container. ```python c = st.container() @@ -1680,71 +1106,16 @@ tab2.write("this is tab 2")
- +### Chat elements - +
-screenshot +Streamlit provides a few commands to help you build conversational apps. These chat elements are designed to be used in conjunction with each other, but you can also use them separately. -

Streamlit Elements

+`st.chat_message` lets you insert a chat message container into the app so you can display messages from the user or the app. Chat containers can contain other Streamlit elements, including charts, tables, text, and more. `st.chat_input` lets you display a chat input widget so the user can type in a message. -Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). - -```python -from streamlit_elements import elements, mui, html - -with elements("new_element"): - mui.Typography("Hello world") -``` - -
- - - -screenshot - -

Pydantic

- -Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). - -```python -import streamlit_pydantic as sp - -sp.pydantic_form(key="my_form", - model=ExampleModel) -``` - -
- - - -screenshot - -

Streamlit Pages

- -An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). - -```python -from st_pages import Page, show_pages, add_page_title - -show_pages([ Page("streamlit_app.py", "Home", "🏠"), - Page("other_pages/page2.py", "Page 2", ":books:"), ]) -``` - -
- -
- -### Chat elements - -
- -Streamlit provides a few commands to help you build conversational apps. These chat elements are designed to be used in conjunction with each other, but you can also use them separately. - -`st.chat_message` lets you insert a chat message container into the app so you can display messages from the user or the app. Chat containers can contain other Streamlit elements, including charts, tables, text, and more. `st.chat_input` lets you display a chat input widget so the user can type in a message. - - - + + screenshot @@ -1979,61 +1350,6 @@ st.exception(e) - - - - -screenshot - -

Stqdm

- -The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). - -```python -from stqdm import stqdm - -for _ in stqdm(range(50)): - sleep(0.5) -``` - -
- - - -screenshot - -

Custom notification box

- -A custom notification box with the ability to close it out. Created by [@Socvest](https://github.com/Socvest). - -```python -from streamlit_custom_notification_box import custom_notification_box - -styles = {'material-icons':{'color': 'red'}, 'text-icon-link-close-container': {'box-shadow': '#3896de 0px 4px'}, 'notification-text': {'':''}, 'close-button':{'':''}, 'link':{'':''}} -custom_notification_box(icon='info', textDisplay='We are almost done with your registration...', externalLink='more info', url='#', styles=styles, key="foo") -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -from streamlit_extras.let_it_rain import rain - -rain(emoji="🎈", font_size=54, - falling_speed=5, animation_length="infinite",) -``` - -
- -
- ## App logic and configuration ### App server @@ -2239,61 +1555,6 @@ st.stop()
- - - - -screenshot - -

Autorefresh

- -Force a refresh without tying up a script. Created by [@kmcgrady](https://github.com/kmcgrady). - -```python -from streamlit_autorefresh import st_autorefresh - -st_autorefresh(interval=2000, limit=100, - key="fizzbuzzcounter") -``` - -
- - - -screenshot - -

Pydantic

- -Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). - -```python -import streamlit_pydantic as sp - -sp.pydantic_form(key="my_form", - model=ExampleModel) -``` - -
- - - -screenshot - -

Streamlit Pages

- -An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). - -```python -from st_pages import Page, show_pages, add_page_title - -show_pages([ Page("streamlit_app.py", "Home", "🏠"), - Page("other_pages/page2.py", "Page 2", ":books:"), ]) -``` - -
- -
- ### Caching and state
@@ -2477,61 +1738,6 @@ OpenAI_key = "" - - - - -screenshot - -

Authenticator

- -A secure authentication module to validate user credentials. Created by [@mkhorasani](https://github.com/mkhorasani). - -```python -import streamlit_authenticator as stauth - -authenticator = stauth.Authenticate( config['credentials'], config['cookie']['name'], -config['cookie']['key'], config['cookie']['expiry_days'], config['preauthorized']) -``` - -
- - - -screenshot - -

WS localStorage

- -A simple synchronous way of accessing localStorage from your app. Created by [@gagangoku](https://github.com/gagangoku). - -```python -from streamlit_ws_localstorage import injectWebsocketCode - -ret = conn.setLocalStorageVal(key='k1', val='v1') -st.write('ret: ' + ret) -``` - -
- - - -screenshot - -

Streamlit Auth0

- -The fastest way to provide comprehensive login inside Streamlit. Created by [@conradbez](https://github.com/conradbez). - -```python -from auth0_component import login_button - -user_info = login_button(clientId, domain = domain) -st.write(user_info) -``` - -
- -
- ### Custom Components
@@ -3038,38 +2244,539 @@ at.toggle[0].set_value("True").run() +## Third-party components + +Browse community-built components in the [Component gallery](https://streamlit.io/components). + - + -screenshot +screenshot -

Pandas Profiling

+

Annotated text

-Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/). +Display annotated text in Streamlit apps. Created by [@tvst](https://github.com/tvst). ```python -df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv") -pr = df.profile_report() +annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".") +``` -st_profile_report(pr) +
+ + + +screenshot + +

Drawable Canvas

+ +Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). + +```python +st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) ```
- + -screenshot +screenshot -

Streamlit Ace

+

Tags

-Ace editor component for Streamlit. Created by [@okld](https://github.com/okld). +Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). ```python -from streamlit_ace import st_ace +st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') +``` -content = st_ace() -content +
+ + + +screenshot + +

NLU

+ +Apply text mining on a dataframe. Created by [@JohnSnowLabs](https://github.com/JohnSnowLabs/). + +```python +nlu.load("sentiment").predict("I love NLU! <3") +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",) +``` + +
+ + + +screenshot + +

Streamlit Aggrid

+ +Implementation of Ag-Grid component for Streamlit. Created by [@PablocFonseca](https://github.com/PablocFonseca). + +```python +df = pd.DataFrame({'col1': [1, 2, 3], 'col2': [4, 5, 6]}) +grid_return = AgGrid(df, editable=True) + +new_df = grid_return['data'] +``` + +
+ + + +screenshot + +

Streamlit Folium

+ +Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). + +```python +m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) +folium.Marker([39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell").add_to(m) + +st_data = st_folium(m, width=725) +``` + +
+ + + +screenshot + +

Pandas Profiling

+ +Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/). + +```python +df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv") +pr = df.profile_report() + +st_profile_report(pr) +``` + +
+ + + +screenshot + +

Image Coordinates

+ +Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). + +```python +from streamlit_image_coordinates import streamlit_image_coordinates +value = streamlit_image_coordinates("https://placekitten.com/200/300") + +st.write(value) +``` + +
+ + + +screenshot + +

Plotly Events

+ +Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). + +```python +from streamlit_plotly_events import plotly_events +fig = px.line(x=[1], y=[1]) + +selected_points = plotly_events(fig) +``` + +
+ + + +screenshot + +

Plost

+ +A deceptively simple plotting library for Streamlit. Created by [@tvst](https://github.com/tvst). + +```python +import plost +plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',) +``` + +
+ + + +screenshot + +

HiPlot

+ +High dimensional Interactive Plotting. Created by [@facebookresearch](https://github.com/facebookresearch). + +```python +data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}] +hip.Experiment.from_iterable(data).display() +``` + +
+ + + +screenshot + +

ECharts

+ +High dimensional Interactive Plotting. Created by [@andfanilo](https://github.com/andfanilo). + +```python +from streamlit_echarts import st_echarts +st_echarts(options=options) +``` + +
+ + + +screenshot + +

Spacy-Streamlit

+ +spaCy building blocks and visualizers for Streamlit apps. Created by [@explosion](https://github.com/explosion). + +```python +models = ["en_core_web_sm", "en_core_web_md"] +spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.") +``` + +
+ + + +screenshot + +

Streamlit Agraph

+ +A Streamlit Graph Vis, based on [react-grah-vis](https://github.com/crubier/react-graph-vis). Created by [@ChrisDelClea](https://github.com/ChrisDelClea). + +```python +from streamlit_agraph import agraph, Node, Edge, Config +agraph(nodes=nodes, edges=edges, config=config) +``` + +
+ + + +screenshot + +

Streamlit Lottie

+ +Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). + +```python +lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") +st_lottie(lottie_hello, key="hello") +``` + +
+ + + +screenshot + +

Streamlit Elements

+ +Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). + +```python +from streamlit_elements import elements, mui, html + +with elements("new_element"): + mui.Typography("Hello world") +``` + +
+ + + +screenshot + +

Stqdm

+ +The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). + +```python +from stqdm import stqdm + +for _ in stqdm(range(50)): + sleep(0.5) +``` + +
+ + + +screenshot + +

Timeline

+ +Display a Timeline in Streamlit apps using [TimelineJS](https://timeline.knightlab.com/). Created by [@innerdoc](https://github.com/innerdoc). + +```python +from streamlit_timeline import timeline + +with open('example.json', "r") as f: + timeline(f.read(), height=800) +``` + +
+ + + +screenshot + +

Camera input live

+ +Alternative for st.camera_input which returns the webcam images live. Created by [@blackary](https://github.com/blackary). + +```python +from camera_input_live import camera_input_live + +image = camera_input_live() +st.image(value) +``` + +
+ + + +screenshot + +

Streamlit Ace

+ +Ace editor component for Streamlit. Created by [@okld](https://github.com/okld). + +```python +from streamlit_ace import st_ace + +content = st_ace() +content +``` + +
+ + + +screenshot + +

Streamlit Chat

+ +Streamlit Component for a Chatbot UI. Created by [@AI-Yash](https://github.com/AI-Yash). + +```python +from streamlit_chat import message + +message("My message") +message("Hello bot!", is_user=True) # align's the message to the right +``` + +
+ + + +screenshot + +

Streamlit Option Menu

+ +Select a single item from a list of options in a menu. Created by [@victoryhb](https://github.com/victoryhb). + +```python +from streamlit_option_menu import option_menu + +option_menu("Main Menu", ["Home", 'Settings'], + icons=['house', 'gear'], menu_icon="cast", default_index=1) +``` + +
+ + + +screenshot + +

Streamlit Webrtc

+ +Handling and transmitting real-time video/audio streams with Streamlit. Created by [@whitphx](https://github.com/whitphx). + +```python +from streamlit_webrtc import webrtc_streamer + +webrtc_streamer(key="sample") +``` + +
+ + + +screenshot + +

Image Comparison

+ +Compare images with a slider using [JuxtaposeJS](https://juxtapose.knightlab.com/). Created by [@fcakyon](https://github.com/fcakyon). + +```python +from streamlit_image_comparison import image_comparison + +image_comparison(img1="image1.jpg", img2="image2.jpg",) +``` + +
+ + + +screenshot + +

Streamlit Cropper

+ +A simple image cropper for Streamlit. Created by [@turner-anderson](https://github.com/turner-anderson). + +```python +from streamlit_cropper import st_cropper + +st_cropper(img, realtime_update=realtime_update, box_color=box_color, aspect_ratio=aspect_ratio) +``` + +
+ + + +screenshot + +

Pydantic

+ +Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). + +```python +import streamlit_pydantic as sp + +sp.pydantic_form(key="my_form", + model=ExampleModel) +``` + +
+ + + +screenshot + +

Streamlit Pages

+ +An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). + +```python +from st_pages import Page, show_pages, add_page_title + +show_pages([ Page("streamlit_app.py", "Home", "🏠"), + Page("other_pages/page2.py", "Page 2", ":books:"), ]) +``` + +
+ + + +screenshot + +

Custom notification box

+ +A custom notification box with the ability to close it out. Created by [@Socvest](https://github.com/Socvest). + +```python +from streamlit_custom_notification_box import custom_notification_box + +styles = {'material-icons':{'color': 'red'}, 'text-icon-link-close-container': {'box-shadow': '#3896de 0px 4px'}, 'notification-text': {'':''}, 'close-button':{'':''}, 'link':{'':''}} +custom_notification_box(icon='info', textDisplay='We are almost done with your registration...', externalLink='more info', url='#', styles=styles, key="foo") +``` + +
+ + + +screenshot + +

Autorefresh

+ +Force a refresh without tying up a script. Created by [@kmcgrady](https://github.com/kmcgrady). + +```python +from streamlit_autorefresh import st_autorefresh + +st_autorefresh(interval=2000, limit=100, + key="fizzbuzzcounter") +``` + +
+ + + +screenshot + +

Authenticator

+ +A secure authentication module to validate user credentials. Created by [@mkhorasani](https://github.com/mkhorasani). + +```python +import streamlit_authenticator as stauth + +authenticator = stauth.Authenticate( config['credentials'], config['cookie']['name'], +config['cookie']['key'], config['cookie']['expiry_days'], config['preauthorized']) +``` + +
+ + + +screenshot + +

WS localStorage

+ +A simple synchronous way of accessing localStorage from your app. Created by [@gagangoku](https://github.com/gagangoku). + +```python +from streamlit_ws_localstorage import injectWebsocketCode + +ret = conn.setLocalStorageVal(key='k1', val='v1') +st.write('ret: ' + ret) +``` + +
+ + + +screenshot + +

Streamlit Auth0

+ +The fastest way to provide comprehensive login inside Streamlit. Created by [@conradbez](https://github.com/conradbez). + +```python +from auth0_component import login_button + +user_info = login_button(clientId, domain = domain) +st.write(user_info) ```
diff --git a/content/develop/api-reference/charts/_index.md b/content/develop/api-reference/charts/_index.md index b106d41d4..1fbf7da69 100644 --- a/content/develop/api-reference/charts/_index.md +++ b/content/develop/api-reference/charts/_index.md @@ -1,7 +1,7 @@ --- title: Chart elements slug: /develop/api-reference/charts -description: Create interactive data visualizations with Streamlit's charting capabilities including simple charts, advanced visualization libraries, and community components. +description: Create interactive data visualizations with Streamlit's charting capabilities including simple charts and advanced visualization libraries. keywords: charts, visualization, matplotlib, vega-lite, deck.gl, altair, plotly, bokeh, pydeck, graphviz, maps, line chart, bar chart, area chart, scatter chart --- @@ -170,142 +170,3 @@ st.mermaid_chart("graph LR\n A --> B") - - - - - -screenshot - -

Plost

- -A deceptively simple plotting library for Streamlit. Created by [@tvst](https://github.com/tvst). - -```python -import plost -plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',) -``` - -
- - - -screenshot - -

HiPlot

- -High dimensional Interactive Plotting. Created by [@facebookresearch](https://github.com/facebookresearch). - -```python -data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}] -hip.Experiment.from_iterable(data).display() -``` - -
- - - -screenshot - -

ECharts

- -High dimensional Interactive Plotting. Created by [@andfanilo](https://github.com/andfanilo). - -```python -from streamlit_echarts import st_echarts -st_echarts(options=options) -``` - -
- - - -screenshot - -

Streamlit Folium

- -Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). - -```python -m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) -st_data = st_folium(m, width=725) -``` - -
- - - -screenshot - -

Spacy-Streamlit

- -spaCy building blocks and visualizers for Streamlit apps. Created by [@explosion](https://github.com/explosion). - -```python -models = ["en_core_web_sm", "en_core_web_md"] -spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.") -``` - -
- - - -screenshot - -

Streamlit Agraph

- -A Streamlit Graph Vis, based on [react-grah-vis](https://github.com/crubier/react-graph-vis). Created by [@ChrisDelClea](https://github.com/ChrisDelClea). - -```python -from streamlit_agraph import agraph, Node, Edge, Config -agraph(nodes=nodes, edges=edges, config=config) -``` - -
- - - -screenshot - -

Streamlit Lottie

- -Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). - -```python -lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") -st_lottie(lottie_hello, key="hello") -``` - -
- - - -screenshot - -

Plotly Events

- -Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). - -```python -fig = px.line(x=[1], y=[1]) -selected_points = plotly_events(fig) -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],) -st.altair_chart(chart, use_container_width=True) -``` - -
- -
diff --git a/content/develop/api-reference/control-flow/_index.md b/content/develop/api-reference/control-flow/_index.md index 2b5eb7b79..93c76a28b 100644 --- a/content/develop/api-reference/control-flow/_index.md +++ b/content/develop/api-reference/control-flow/_index.md @@ -109,58 +109,3 @@ with st.form(key='my_form'): - - - - - -screenshot - -

Autorefresh

- -Force a refresh without tying up a script. Created by [@kmcgrady](https://github.com/kmcgrady). - -```python -from streamlit_autorefresh import st_autorefresh - -st_autorefresh(interval=2000, limit=100, - key="fizzbuzzcounter") -``` - -
- - - -screenshot - -

Pydantic

- -Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). - -```python -import streamlit_pydantic as sp - -sp.pydantic_form(key="my_form", - model=ExampleModel) -``` - -
- - - -screenshot - -

Streamlit Pages

- -An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). - -```python -from st_pages import Page, show_pages, add_page_title - -show_pages([ Page("streamlit_app.py", "Home", "🏠"), - Page("other_pages/page2.py", "Page 2", ":books:"), ]) -``` - -
- -
diff --git a/content/develop/api-reference/data/_index.md b/content/develop/api-reference/data/_index.md index ebb8be0df..1f3a2e9c0 100644 --- a/content/develop/api-reference/data/_index.md +++ b/content/develop/api-reference/data/_index.md @@ -91,109 +91,3 @@ st.json(my_dict) - - - - - -screenshot - -

Streamlit Aggrid

- -Implementation of Ag-Grid component for Streamlit. Created by [@PablocFonseca](https://github.com/PablocFonseca). - -```python -df = pd.DataFrame({'col1': [1, 2, 3], 'col2': [4, 5, 6]}) -grid_return = AgGrid(df, editable=True) - -new_df = grid_return['data'] -``` - -
- - - -screenshot - -

Streamlit Folium

- -Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). - -```python -m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) -folium.Marker([39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell").add_to(m) - -st_data = st_folium(m, width=725) -``` - -
- - - -screenshot - -

Pandas Profiling

- -Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/). - -```python -df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv") -pr = df.profile_report() - -st_profile_report(pr) -``` - -
- - - -screenshot - -

Image Coordinates

- -Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). - -```python -from streamlit_image_coordinates import streamlit_image_coordinates -value = streamlit_image_coordinates("https://placekitten.com/200/300") - -st.write(value) -``` - -
- - - -screenshot - -

Plotly Events

- -Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). - -```python -from streamlit_plotly_events import plotly_events -fig = px.line(x=[1], y=[1]) - -selected_points = plotly_events(fig) -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -from streamlit_extras.metric_cards import style_metric_cards -col3.metric(label="No Change", value=5000, delta=0) - -style_metric_cards() -``` - -
- -
diff --git a/content/develop/api-reference/layout/_index.md b/content/develop/api-reference/layout/_index.md index 2cba82440..cb07dc5ec 100644 --- a/content/develop/api-reference/layout/_index.md +++ b/content/develop/api-reference/layout/_index.md @@ -159,58 +159,3 @@ tab2.write("this is tab 2") - - - - - -screenshot - -

Streamlit Elements

- -Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). - -```python -from streamlit_elements import elements, mui, html - -with elements("new_element"): - mui.Typography("Hello world") -``` - -
- - - -screenshot - -

Pydantic

- -Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). - -```python -import streamlit_pydantic as sp - -sp.pydantic_form(key="my_form", - model=ExampleModel) -``` - -
- - - -screenshot - -

Streamlit Pages

- -An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). - -```python -from st_pages import Page, show_pages, add_page_title - -show_pages([ Page("streamlit_app.py", "Home", "🏠"), - Page("other_pages/page2.py", "Page 2", ":books:"), ]) -``` - -
- -
diff --git a/content/develop/api-reference/media/_index.md b/content/develop/api-reference/media/_index.md index a6fe4b88f..5eb28042d 100644 --- a/content/develop/api-reference/media/_index.md +++ b/content/develop/api-reference/media/_index.md @@ -85,103 +85,3 @@ st.video("https://example.com/myvideo.mp4", format="video/mp4") - - - - - -screenshot - -

Streamlit Webrtc

- -Handling and transmitting real-time video/audio streams with Streamlit. Created by [@whitphx](https://github.com/whitphx). - -```python -from streamlit_webrtc import webrtc_streamer - -webrtc_streamer(key="sample") -``` - -
- - - -screenshot - -

Drawable Canvas

- -Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). - -```python -from streamlit_drawable_canvas import st_canvas - -st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) -``` - -
- - - -screenshot - -

Image Comparison

- -Compare images with a slider using [JuxtaposeJS](https://juxtapose.knightlab.com/). Created by [@fcakyon](https://github.com/fcakyon). - -```python -from streamlit_image_comparison import image_comparison - -image_comparison(img1="image1.jpg", img2="image2.jpg",) -``` - -
- - - -screenshot - -

Streamlit Cropper

- -A simple image cropper for Streamlit. Created by [@turner-anderson](https://github.com/turner-anderson). - -```python -from streamlit_cropper import st_cropper - -st_cropper(img, realtime_update=realtime_update, box_color=box_color, aspect_ratio=aspect_ratio) -``` - -
- - - -screenshot - -

Image Coordinates

- -Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). - -```python -from streamlit_image_coordinates import streamlit_image_coordinates - -streamlit_image_coordinates("https://placekitten.com/200/300") -``` - -
- - - -screenshot - -

Streamlit Lottie

- -Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). - -```python -lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") - -st_lottie(lottie_hello, key="hello") -``` - -
- -
diff --git a/content/develop/api-reference/status/_index.md b/content/develop/api-reference/status/_index.md index 7192082cd..666423187 100644 --- a/content/develop/api-reference/status/_index.md +++ b/content/develop/api-reference/status/_index.md @@ -182,58 +182,3 @@ st.exception(e) - - - - - -screenshot - -

Stqdm

- -The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). - -```python -from stqdm import stqdm - -for _ in stqdm(range(50)): - sleep(0.5) -``` - -
- - - -screenshot - -

Custom notification box

- -A custom notification box with the ability to close it out. Created by [@Socvest](https://github.com/Socvest). - -```python -from streamlit_custom_notification_box import custom_notification_box - -styles = {'material-icons':{'color': 'red'}, 'text-icon-link-close-container': {'box-shadow': '#3896de 0px 4px'}, 'notification-text': {'':''}, 'close-button':{'':''}, 'link':{'':''}} -custom_notification_box(icon='info', textDisplay='We are almost done with your registration...', externalLink='more info', url='#', styles=styles, key="foo") -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -from streamlit_extras.let_it_rain import rain - -rain(emoji="🎈", font_size=54, - falling_speed=5, animation_length="infinite",) -``` - -
- -
diff --git a/content/develop/api-reference/text/_index.md b/content/develop/api-reference/text/_index.md index adc780d51..12ac88baf 100644 --- a/content/develop/api-reference/text/_index.md +++ b/content/develop/api-reference/text/_index.md @@ -212,75 +212,3 @@ st.iframe("my_content.html") - - - - -screenshot - -

Annotated text

- -Display annotated text in Streamlit apps. Created by [@tvst](https://github.com/tvst). - -```python -annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".") -``` - -
- - - -screenshot - -

Drawable Canvas

- -Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). - -```python -st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) -``` - -
- - - -screenshot - -

Tags

- -Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). - -```python -st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') -``` - -
- - - -screenshot - -

NLU

- -Apply text mining on a dataframe. Created by [@JohnSnowLabs](https://github.com/JohnSnowLabs/). - -```python -nlu.load('sentiment').predict('I love NLU! <3') -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",) -``` - -
-
diff --git a/content/develop/api-reference/widgets/_index.md b/content/develop/api-reference/widgets/_index.md index 8b4b16610..c586cd933 100644 --- a/content/develop/api-reference/widgets/_index.md +++ b/content/develop/api-reference/widgets/_index.md @@ -431,160 +431,3 @@ image = st.camera_input("Take a picture") - - - - - -screenshot - -

Streamlit Elements

- -Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). - -```python -from streamlit_elements import elements, mui, html - -with elements("new_element"): - mui.Typography("Hello world") -``` - -
- - - -screenshot - -

Tags

- -Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). - -```python -from streamlit_tags import st_tags - -st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], -suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') -``` - -
- - - -screenshot - -

Stqdm

- -The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). - -```python -from stqdm import stqdm - -for _ in stqdm(range(50)): - sleep(0.5) -``` - -
- - - -screenshot - -

Timeline

- -Display a Timeline in Streamlit apps using [TimelineJS](https://timeline.knightlab.com/). Created by [@innerdoc](https://github.com/innerdoc). - -```python -from streamlit_timeline import timeline - -with open('example.json', "r") as f: - timeline(f.read(), height=800) -``` - -
- - - -screenshot - -

Camera input live

- -Alternative for st.camera_input which returns the webcam images live. Created by [@blackary](https://github.com/blackary). - -```python -from camera_input_live import camera_input_live - -image = camera_input_live() -st.image(value) -``` - -
- - - -screenshot - -

Streamlit Ace

- -Ace editor component for Streamlit. Created by [@okld](https://github.com/okld). - -```python -from streamlit_ace import st_ace - -content = st_ace() -content -``` - -
- - - -screenshot - -

Streamlit Chat

- -Streamlit Component for a Chatbot UI. Created by [@AI-Yash](https://github.com/AI-Yash). - -```python -from streamlit_chat import message - -message("My message") -message("Hello bot!", is_user=True) # align's the message to the right -``` - -
- - - -screenshot - -

Streamlit Option Menu

- -Select a single item from a list of options in a menu. Created by [@victoryhb](https://github.com/victoryhb). - -```python -from streamlit_option_menu import option_menu - -option_menu("Main Menu", ["Home", 'Settings'], - icons=['house', 'gear'], menu_icon="cast", default_index=1) -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -from streamlit_extras.stoggle import stoggle - -stoggle( - "Click me!", """πŸ₯· Surprise! Here's some additional content""",) -``` - -
- -
diff --git a/content/menu.md b/content/menu.md index 6a55c8d22..5e521e20b 100644 --- a/content/menu.md +++ b/content/menu.md @@ -451,7 +451,7 @@ site_menu: - category: Develop / API reference / Status elements / st.snow url: /develop/api-reference/status/st.snow - category: Develop / API reference / Third-party components - url: https://streamlit.io/components + url: /develop/api-reference#third-party-components - category: Develop / API reference / APPLICATION LOGIC - category: Develop / API reference / App server url: /develop/api-reference/server From f3f297630b4608a486dd78d80e9342a5fbe0adcd Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Fri, 21 Aug 2026 15:46:08 +0200 Subject: [PATCH 14/15] Revert "Move third-party components to the end of the API reference" This reverts commit b4c823e2ac86da5048b68da68e2a3ea2e2b672c5. --- content/develop/api-reference/_index.md | 1697 ++++++++++------- .../develop/api-reference/charts/_index.md | 141 +- .../api-reference/control-flow/_index.md | 55 + content/develop/api-reference/data/_index.md | 106 + .../develop/api-reference/layout/_index.md | 55 + content/develop/api-reference/media/_index.md | 100 + .../develop/api-reference/status/_index.md | 55 + content/develop/api-reference/text/_index.md | 72 + .../develop/api-reference/widgets/_index.md | 157 ++ content/menu.md | 2 +- 10 files changed, 1736 insertions(+), 704 deletions(-) diff --git a/content/develop/api-reference/_index.md b/content/develop/api-reference/_index.md index 7347bc327..f84acf17a 100644 --- a/content/develop/api-reference/_index.md +++ b/content/develop/api-reference/_index.md @@ -249,6 +249,78 @@ st.iframe("my_content.html") + + + +screenshot + +

Annotated text

+ +Display annotated text in Streamlit apps. Created by [@tvst](https://github.com/tvst). + +```python +annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".") +``` + +
+ + + +screenshot + +

Drawable Canvas

+ +Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). + +```python +st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) +``` + +
+ + + +screenshot + +

Tags

+ +Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). + +```python +st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') +``` + +
+ + + +screenshot + +

NLU

+ +Apply text mining on a dataframe. Created by [@JohnSnowLabs](https://github.com/JohnSnowLabs/). + +```python +nlu.load("sentiment").predict("I love NLU! <3") +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",) +``` + +
+
+ ### Data elements
@@ -331,6 +403,112 @@ st.json(my_dict) + + + + +screenshot + +

Streamlit Aggrid

+ +Implementation of Ag-Grid component for Streamlit. Created by [@PablocFonseca](https://github.com/PablocFonseca). + +```python +df = pd.DataFrame({'col1': [1, 2, 3], 'col2': [4, 5, 6]}) +grid_return = AgGrid(df, editable=True) + +new_df = grid_return['data'] +``` + +
+ + + +screenshot + +

Streamlit Folium

+ +Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). + +```python +m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) +folium.Marker([39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell").add_to(m) + +st_data = st_folium(m, width=725) +``` + +
+ + + +screenshot + +

Pandas Profiling

+ +Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/). + +```python +df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv") +pr = df.profile_report() + +st_profile_report(pr) +``` + +
+ + + +screenshot + +

Image Coordinates

+ +Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). + +```python +from streamlit_image_coordinates import streamlit_image_coordinates +value = streamlit_image_coordinates("https://placekitten.com/200/300") + +st.write(value) +``` + +
+ + + +screenshot + +

Plotly Events

+ +Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). + +```python +from streamlit_plotly_events import plotly_events +fig = px.line(x=[1], y=[1]) + +selected_points = plotly_events(fig) +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +from streamlit_extras.metric_cards import style_metric_cards +col3.metric(label="No Change", value=5000, delta=0) + +style_metric_cards() +``` + +
+ +
+ ### Chart elements
@@ -484,84 +662,223 @@ st.mermaid_chart("graph LR\n A --> B") -### Input widgets - -
+ - - + -screenshot +screenshot -

Button

+

Plost

-Display a button widget. +A deceptively simple plotting library for Streamlit. Created by [@tvst](https://github.com/tvst). ```python -clicked = st.button("Click me") +import plost +plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',) ``` -
- +
-screenshot + -

Download button

+screenshot -Display a download button widget. +

HiPlot

+ +High dimensional Interactive Plotting. Created by [@facebookresearch](https://github.com/facebookresearch). ```python -st.download_button("Download file", file) +data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}] +hip.Experiment.from_iterable(data).display() ``` - - +
-screenshot + -

Form button

+screenshot -Display a form submit button. For use with `st.form`. +

ECharts

+ +High dimensional Interactive Plotting. Created by [@andfanilo](https://github.com/andfanilo). ```python -st.form_submit_button("Sign up") +from streamlit_echarts import st_echarts +st_echarts(options=options) ``` - - +
-screenshot + -

Link button

+screenshot -Display a link button. +

Streamlit Folium

+ +Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). ```python -st.link_button("Go to gallery", url) +m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) +st_data = st_folium(m, width=725) ``` - +
- + -screenshot +screenshot -

Menu button

+

Spacy-Streamlit

-Display a menu button. +spaCy building blocks and visualizers for Streamlit apps. Created by [@explosion](https://github.com/explosion). ```python -st.menu_button("Export", options=["CSV", "JSON", "PDF"]) +models = ["en_core_web_sm", "en_core_web_md"] +spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.") ``` -
- +
-screenshot + -

Page link

+screenshot -Display a link to another page in a multipage app. +

Streamlit Agraph

+ +A Streamlit Graph Vis, based on [react-grah-vis](https://github.com/crubier/react-graph-vis). Created by [@ChrisDelClea](https://github.com/ChrisDelClea). + +```python +from streamlit_agraph import agraph, Node, Edge, Config +agraph(nodes=nodes, edges=edges, config=config) +``` + +
+ + + +screenshot + +

Streamlit Lottie

+ +Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). + +```python +lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") +st_lottie(lottie_hello, key="hello") +``` + +
+ + + +screenshot + +

Plotly Events

+ +Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). + +```python +fig = px.line(x=[1], y=[1]) +selected_points = plotly_events(fig) +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],) +st.altair_chart(chart, use_container_width=True) +``` + +
+ +
+ +### Input widgets + +
+ + + + +screenshot + +

Button

+ +Display a button widget. + +```python +clicked = st.button("Click me") +``` + +
+ + +screenshot + +

Download button

+ +Display a download button widget. + +```python +st.download_button("Download file", file) +``` + +
+ + +screenshot + +

Form button

+ +Display a form submit button. For use with `st.form`. + +```python +st.form_submit_button("Sign up") +``` + +
+ + +screenshot + +

Link button

+ +Display a link button. + +```python +st.link_button("Go to gallery", url) +``` + +
+ + + +screenshot + +

Menu button

+ +Display a menu button. + +```python +st.menu_button("Export", options=["CSV", "JSON", "PDF"]) +``` + +
+ + +screenshot + +

Page link

+ +Display a link to another page in a multipage app. ```python st.page_link("app.py", label="Home", icon="🏠") @@ -872,120 +1189,377 @@ image = st.camera_input("Take a picture")
-### Media elements - -
+ - - + -screenshot +screenshot -

Image

+

Streamlit Elements

-Display an image or list of images. +Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). ```python -st.image(numpy_array) -st.image(image_bytes) -st.image(file) -st.image("https://example.com/myimage.jpg") +from streamlit_elements import elements, mui, html + +with elements("new_element"): + mui.Typography("Hello world") ``` -
- + -screenshot + -

Logo

+screenshot -Display a logo in the upper-left corner of your app and its sidebar. +

Tags

+ +Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). ```python -st.logo("logo.jpg") +from streamlit_tags import st_tags + +st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], +suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') ``` -
- + -screenshot + -

PDF

+screenshot -Display a PDF file. +

Stqdm

+ +The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). ```python -st.pdf("my_document.pdf") +from stqdm import stqdm + +for _ in stqdm(range(50)): + sleep(0.5) ``` -
- + -screenshot + -

Audio

+screenshot -Display an audio player. +

Timeline

+ +Display a Timeline in Streamlit apps using [TimelineJS](https://timeline.knightlab.com/). Created by [@innerdoc](https://github.com/innerdoc). ```python -st.audio(numpy_array) -st.audio(audio_bytes) -st.audio(file) -st.audio("https://example.com/myaudio.mp3", format="audio/mp3") +from streamlit_timeline import timeline + +with open('example.json', "r") as f: + timeline(f.read(), height=800) ``` -
- + -screenshot + -

Video

+screenshot -Display a video player. +

Camera input live

-```python -st.video(numpy_array) -st.video(video_bytes) -st.video(file) -st.video("https://example.com/myvideo.mp4", format="video/mp4") -``` +Alternative for st.camera_input which returns the webcam images live. Created by [@blackary](https://github.com/blackary). -
-
+```python +from camera_input_live import camera_input_live -### Layouts and containers +image = camera_input_live() +st.image(value) +``` -
+ - - + -screenshot +screenshot -

Columns

+

Streamlit Ace

-Insert containers laid out as side-by-side columns. +Ace editor component for Streamlit. Created by [@okld](https://github.com/okld). ```python -col1, col2 = st.columns(2) -col1.write("this is column 1") -col2.write("this is column 2") +from streamlit_ace import st_ace + +content = st_ace() +content ``` -
- + -screenshot + -

Container

+screenshot -Insert a multi-element container. +

Streamlit Chat

+ +Streamlit Component for a Chatbot UI. Created by [@AI-Yash](https://github.com/AI-Yash). ```python -c = st.container() -st.write("This will show last") -c.write("This will show first") -c.write("This will show second") +from streamlit_chat import message + +message("My message") +message("Hello bot!", is_user=True) # align's the message to the right +``` + +
+ + + +screenshot + +

Streamlit Option Menu

+ +Select a single item from a list of options in a menu. Created by [@victoryhb](https://github.com/victoryhb). + +```python +from streamlit_option_menu import option_menu + +option_menu("Main Menu", ["Home", 'Settings'], + icons=['house', 'gear'], menu_icon="cast", default_index=1) +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +from streamlit_extras.stoggle import stoggle + +stoggle( + "Click me!", """πŸ₯· Surprise! Here's some additional content""",) +``` + +
+ +
+ +### Media elements + +
+ + + + +screenshot + +

Image

+ +Display an image or list of images. + +```python +st.image(numpy_array) +st.image(image_bytes) +st.image(file) +st.image("https://example.com/myimage.jpg") +``` + +
+ + +screenshot + +

Logo

+ +Display a logo in the upper-left corner of your app and its sidebar. + +```python +st.logo("logo.jpg") +``` + +
+ + +screenshot + +

PDF

+ +Display a PDF file. + +```python +st.pdf("my_document.pdf") +``` + +
+ + +screenshot + +

Audio

+ +Display an audio player. + +```python +st.audio(numpy_array) +st.audio(audio_bytes) +st.audio(file) +st.audio("https://example.com/myaudio.mp3", format="audio/mp3") +``` + +
+ + +screenshot + +

Video

+ +Display a video player. + +```python +st.video(numpy_array) +st.video(video_bytes) +st.video(file) +st.video("https://example.com/myvideo.mp4", format="video/mp4") +``` + +
+
+ + + + + +screenshot + +

Streamlit Webrtc

+ +Handling and transmitting real-time video/audio streams with Streamlit. Created by [@whitphx](https://github.com/whitphx). + +```python +from streamlit_webrtc import webrtc_streamer + +webrtc_streamer(key="sample") +``` + +
+ + + +screenshot + +

Drawable Canvas

+ +Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). + +```python +from streamlit_drawable_canvas import st_canvas + +st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) +``` + +
+ + + +screenshot + +

Image Comparison

+ +Compare images with a slider using [JuxtaposeJS](https://juxtapose.knightlab.com/). Created by [@fcakyon](https://github.com/fcakyon). + +```python +from streamlit_image_comparison import image_comparison + +image_comparison(img1="image1.jpg", img2="image2.jpg",) +``` + +
+ + + +screenshot + +

Streamlit Cropper

+ +A simple image cropper for Streamlit. Created by [@turner-anderson](https://github.com/turner-anderson). + +```python +from streamlit_cropper import st_cropper + +st_cropper(img, realtime_update=realtime_update, box_color=box_color, aspect_ratio=aspect_ratio) +``` + +
+ + + +screenshot + +

Image Coordinates

+ +Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). + +```python +from streamlit_image_coordinates import streamlit_image_coordinates + +streamlit_image_coordinates("https://placekitten.com/200/300") +``` + +
+ + + +screenshot + +

Streamlit Lottie

+ +Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). + +```python +lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") + +st_lottie(lottie_hello, key="hello") +``` + +
+ +
+ +### Layouts and containers + +
+ + + + +screenshot + +

Columns

+ +Insert containers laid out as side-by-side columns. + +```python +col1, col2 = st.columns(2) +col1.write("this is column 1") +col2.write("this is column 2") +``` + +
+ + +screenshot + +

Container

+ +Insert a multi-element container. + +```python +c = st.container() +st.write("This will show last") +c.write("This will show first") +c.write("This will show second") ```
@@ -1106,9 +1680,64 @@ tab2.write("this is tab 2")
-### Chat elements + -
+ + +screenshot + +

Streamlit Elements

+ +Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). + +```python +from streamlit_elements import elements, mui, html + +with elements("new_element"): + mui.Typography("Hello world") +``` + +
+ + + +screenshot + +

Pydantic

+ +Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). + +```python +import streamlit_pydantic as sp + +sp.pydantic_form(key="my_form", + model=ExampleModel) +``` + +
+ + + +screenshot + +

Streamlit Pages

+ +An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). + +```python +from st_pages import Page, show_pages, add_page_title + +show_pages([ Page("streamlit_app.py", "Home", "🏠"), + Page("other_pages/page2.py", "Page 2", ":books:"), ]) +``` + +
+ +
+ +### Chat elements + +
Streamlit provides a few commands to help you build conversational apps. These chat elements are designed to be used in conjunction with each other, but you can also use them separately. @@ -1350,6 +1979,61 @@ st.exception(e) + + + + +screenshot + +

Stqdm

+ +The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). + +```python +from stqdm import stqdm + +for _ in stqdm(range(50)): + sleep(0.5) +``` + +
+ + + +screenshot + +

Custom notification box

+ +A custom notification box with the ability to close it out. Created by [@Socvest](https://github.com/Socvest). + +```python +from streamlit_custom_notification_box import custom_notification_box + +styles = {'material-icons':{'color': 'red'}, 'text-icon-link-close-container': {'box-shadow': '#3896de 0px 4px'}, 'notification-text': {'':''}, 'close-button':{'':''}, 'link':{'':''}} +custom_notification_box(icon='info', textDisplay='We are almost done with your registration...', externalLink='more info', url='#', styles=styles, key="foo") +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +from streamlit_extras.let_it_rain import rain + +rain(emoji="🎈", font_size=54, + falling_speed=5, animation_length="infinite",) +``` + +
+ +
+ ## App logic and configuration ### App server @@ -1555,6 +2239,61 @@ st.stop() + + + + +screenshot + +

Autorefresh

+ +Force a refresh without tying up a script. Created by [@kmcgrady](https://github.com/kmcgrady). + +```python +from streamlit_autorefresh import st_autorefresh + +st_autorefresh(interval=2000, limit=100, + key="fizzbuzzcounter") +``` + +
+ + + +screenshot + +

Pydantic

+ +Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). + +```python +import streamlit_pydantic as sp + +sp.pydantic_form(key="my_form", + model=ExampleModel) +``` + +
+ + + +screenshot + +

Streamlit Pages

+ +An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). + +```python +from st_pages import Page, show_pages, add_page_title + +show_pages([ Page("streamlit_app.py", "Home", "🏠"), + Page("other_pages/page2.py", "Page 2", ":books:"), ]) +``` + +
+ +
+ ### Caching and state
@@ -1738,6 +2477,61 @@ OpenAI_key = "" + + + + +screenshot + +

Authenticator

+ +A secure authentication module to validate user credentials. Created by [@mkhorasani](https://github.com/mkhorasani). + +```python +import streamlit_authenticator as stauth + +authenticator = stauth.Authenticate( config['credentials'], config['cookie']['name'], +config['cookie']['key'], config['cookie']['expiry_days'], config['preauthorized']) +``` + +
+ + + +screenshot + +

WS localStorage

+ +A simple synchronous way of accessing localStorage from your app. Created by [@gagangoku](https://github.com/gagangoku). + +```python +from streamlit_ws_localstorage import injectWebsocketCode + +ret = conn.setLocalStorageVal(key='k1', val='v1') +st.write('ret: ' + ret) +``` + +
+ + + +screenshot + +

Streamlit Auth0

+ +The fastest way to provide comprehensive login inside Streamlit. Created by [@conradbez](https://github.com/conradbez). + +```python +from auth0_component import login_button + +user_info = login_button(clientId, domain = domain) +st.write(user_info) +``` + +
+ +
+ ### Custom Components
@@ -2057,726 +2851,225 @@ The base class for representation of all elements, including: # at.title returns a sequence of Title # Title inherits from Element assert at.title[0].value == "My awesome app" -``` - - - - - -

Button

- -A representation of `st.button` and `st.form_submit_button`. - -```python -at.button[0].click().run() -``` - -
- - - -

ChatInput

- -A representation of `st.chat_input`. - -```python -at.chat_input[0].set_value("What is Streamlit?").run() -``` - -
- - - -

Checkbox

- -A representation of `st.checkbox`. - -```python -at.checkbox[0].check().run() -``` - -
- - - -

ColorPicker

- -A representation of `st.color_picker`. - -```python -at.color_picker[0].pick("#FF4B4B").run() -``` - -
- - - -

DateInput

- -A representation of `st.date_input`. - -```python -release_date = datetime.date(2023, 10, 26) -at.date_input[0].set_value(release_date).run() -``` - -
- - - -

Multiselect

- -A representation of `st.multiselect`. - -```python -at.multiselect[0].select("New York").run() -``` - -
- - - -

NumberInput

- -A representation of `st.number_input`. - -```python -at.number_input[0].increment().run() -``` - -
- - - -

Radio

- -A representation of `st.radio`. - -```python -at.radio[0].set_value("New York").run() -``` - -
- - - -

SelectSlider

- -A representation of `st.select_slider`. - -```python -at.select_slider[0].set_range("A","C").run() -``` - -
- - - -

Selectbox

- -A representation of `st.selectbox`. - -```python -at.selectbox[0].select("New York").run() -``` - -
- - - -

Slider

- -A representation of `st.slider`. - -```python -at.slider[0].set_range(2,5).run() -``` - -
- - - -

TextArea

- -A representation of `st.text_area`. - -```python -at.text_area[0].input("Streamlit is awesome!").run() -``` - -
- - - -

TextInput

- -A representation of `st.text_input`. - -```python -at.text_input[0].input("Streamlit").run() -``` - -
- - - -

TimeInput

- -A representation of `st.time_input`. - -```python -at.time_input[0].increment().run() -``` - -
- - - -

Toggle

- -A representation of `st.toggle`. - -```python -at.toggle[0].set_value("True").run() -``` - -
- - - -## Third-party components - -Browse community-built components in the [Component gallery](https://streamlit.io/components). - - - - - -screenshot - -

Annotated text

- -Display annotated text in Streamlit apps. Created by [@tvst](https://github.com/tvst). - -```python -annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".") -``` - -
- - - -screenshot - -

Drawable Canvas

- -Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). - -```python -st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) -``` - -
- - - -screenshot - -

Tags

- -Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). - -```python -st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') -``` - -
- - - -screenshot - -

NLU

- -Apply text mining on a dataframe. Created by [@JohnSnowLabs](https://github.com/JohnSnowLabs/). - -```python -nlu.load("sentiment").predict("I love NLU! <3") -``` - -
- - - -screenshot - -

Streamlit Extras

- -A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). - -```python -mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",) -``` - -
- - - -screenshot - -

Streamlit Aggrid

- -Implementation of Ag-Grid component for Streamlit. Created by [@PablocFonseca](https://github.com/PablocFonseca). - -```python -df = pd.DataFrame({'col1': [1, 2, 3], 'col2': [4, 5, 6]}) -grid_return = AgGrid(df, editable=True) - -new_df = grid_return['data'] -``` - -
- - - -screenshot - -

Streamlit Folium

- -Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). - -```python -m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) -folium.Marker([39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell").add_to(m) - -st_data = st_folium(m, width=725) -``` - -
- - - -screenshot - -

Pandas Profiling

- -Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/). - -```python -df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv") -pr = df.profile_report() - -st_profile_report(pr) -``` - -
- - - -screenshot - -

Image Coordinates

- -Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). - -```python -from streamlit_image_coordinates import streamlit_image_coordinates -value = streamlit_image_coordinates("https://placekitten.com/200/300") - -st.write(value) -``` - -
- - - -screenshot - -

Plotly Events

- -Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). - -```python -from streamlit_plotly_events import plotly_events -fig = px.line(x=[1], y=[1]) - -selected_points = plotly_events(fig) -``` - -
- - - -screenshot - -

Plost

- -A deceptively simple plotting library for Streamlit. Created by [@tvst](https://github.com/tvst). - -```python -import plost -plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',) -``` - -
- - - -screenshot - -

HiPlot

- -High dimensional Interactive Plotting. Created by [@facebookresearch](https://github.com/facebookresearch). - -```python -data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}] -hip.Experiment.from_iterable(data).display() -``` - -
- - - -screenshot - -

ECharts

- -High dimensional Interactive Plotting. Created by [@andfanilo](https://github.com/andfanilo). - -```python -from streamlit_echarts import st_echarts -st_echarts(options=options) -``` - -
- - - -screenshot - -

Spacy-Streamlit

- -spaCy building blocks and visualizers for Streamlit apps. Created by [@explosion](https://github.com/explosion). - -```python -models = ["en_core_web_sm", "en_core_web_md"] -spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.") -``` - -
- - - -screenshot - -

Streamlit Agraph

- -A Streamlit Graph Vis, based on [react-grah-vis](https://github.com/crubier/react-graph-vis). Created by [@ChrisDelClea](https://github.com/ChrisDelClea). - -```python -from streamlit_agraph import agraph, Node, Edge, Config -agraph(nodes=nodes, edges=edges, config=config) -``` - -
- - - -screenshot - -

Streamlit Lottie

- -Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). - -```python -lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") -st_lottie(lottie_hello, key="hello") -``` - -
+``` - + -screenshot + -

Streamlit Elements

+

Button

-Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). +A representation of `st.button` and `st.form_submit_button`. ```python -from streamlit_elements import elements, mui, html - -with elements("new_element"): - mui.Typography("Hello world") +at.button[0].click().run() ``` -
- - + -screenshot + -

Stqdm

+

ChatInput

-The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). +A representation of `st.chat_input`. ```python -from stqdm import stqdm - -for _ in stqdm(range(50)): - sleep(0.5) +at.chat_input[0].set_value("What is Streamlit?").run() ``` -
- - + -screenshot + -

Timeline

+

Checkbox

-Display a Timeline in Streamlit apps using [TimelineJS](https://timeline.knightlab.com/). Created by [@innerdoc](https://github.com/innerdoc). +A representation of `st.checkbox`. ```python -from streamlit_timeline import timeline - -with open('example.json', "r") as f: - timeline(f.read(), height=800) +at.checkbox[0].check().run() ``` -
- - + -screenshot + -

Camera input live

+

ColorPicker

-Alternative for st.camera_input which returns the webcam images live. Created by [@blackary](https://github.com/blackary). +A representation of `st.color_picker`. ```python -from camera_input_live import camera_input_live - -image = camera_input_live() -st.image(value) +at.color_picker[0].pick("#FF4B4B").run() ``` -
- - + -screenshot + -

Streamlit Ace

+

DateInput

-Ace editor component for Streamlit. Created by [@okld](https://github.com/okld). +A representation of `st.date_input`. ```python -from streamlit_ace import st_ace - -content = st_ace() -content +release_date = datetime.date(2023, 10, 26) +at.date_input[0].set_value(release_date).run() ``` -
- - + -screenshot + -

Streamlit Chat

+

Multiselect

-Streamlit Component for a Chatbot UI. Created by [@AI-Yash](https://github.com/AI-Yash). +A representation of `st.multiselect`. ```python -from streamlit_chat import message - -message("My message") -message("Hello bot!", is_user=True) # align's the message to the right +at.multiselect[0].select("New York").run() ``` -
- - + -screenshot + -

Streamlit Option Menu

+

NumberInput

-Select a single item from a list of options in a menu. Created by [@victoryhb](https://github.com/victoryhb). +A representation of `st.number_input`. ```python -from streamlit_option_menu import option_menu - -option_menu("Main Menu", ["Home", 'Settings'], - icons=['house', 'gear'], menu_icon="cast", default_index=1) +at.number_input[0].increment().run() ``` -
- - + -screenshot + -

Streamlit Webrtc

+

Radio

-Handling and transmitting real-time video/audio streams with Streamlit. Created by [@whitphx](https://github.com/whitphx). +A representation of `st.radio`. ```python -from streamlit_webrtc import webrtc_streamer - -webrtc_streamer(key="sample") +at.radio[0].set_value("New York").run() ``` -
- - + -screenshot + -

Image Comparison

+

SelectSlider

-Compare images with a slider using [JuxtaposeJS](https://juxtapose.knightlab.com/). Created by [@fcakyon](https://github.com/fcakyon). +A representation of `st.select_slider`. ```python -from streamlit_image_comparison import image_comparison - -image_comparison(img1="image1.jpg", img2="image2.jpg",) +at.select_slider[0].set_range("A","C").run() ``` -
- - + -screenshot + -

Streamlit Cropper

+

Selectbox

-A simple image cropper for Streamlit. Created by [@turner-anderson](https://github.com/turner-anderson). +A representation of `st.selectbox`. ```python -from streamlit_cropper import st_cropper - -st_cropper(img, realtime_update=realtime_update, box_color=box_color, aspect_ratio=aspect_ratio) +at.selectbox[0].select("New York").run() ``` -
- - + -screenshot + -

Pydantic

+

Slider

-Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). +A representation of `st.slider`. ```python -import streamlit_pydantic as sp - -sp.pydantic_form(key="my_form", - model=ExampleModel) +at.slider[0].set_range(2,5).run() ``` -
- - + -screenshot + -

Streamlit Pages

+

TextArea

-An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). +A representation of `st.text_area`. ```python -from st_pages import Page, show_pages, add_page_title - -show_pages([ Page("streamlit_app.py", "Home", "🏠"), - Page("other_pages/page2.py", "Page 2", ":books:"), ]) +at.text_area[0].input("Streamlit is awesome!").run() ``` -
- - + -screenshot + -

Custom notification box

+

TextInput

-A custom notification box with the ability to close it out. Created by [@Socvest](https://github.com/Socvest). +A representation of `st.text_input`. ```python -from streamlit_custom_notification_box import custom_notification_box - -styles = {'material-icons':{'color': 'red'}, 'text-icon-link-close-container': {'box-shadow': '#3896de 0px 4px'}, 'notification-text': {'':''}, 'close-button':{'':''}, 'link':{'':''}} -custom_notification_box(icon='info', textDisplay='We are almost done with your registration...', externalLink='more info', url='#', styles=styles, key="foo") +at.text_input[0].input("Streamlit").run() ``` -
- - + -screenshot + -

Autorefresh

+

TimeInput

-Force a refresh without tying up a script. Created by [@kmcgrady](https://github.com/kmcgrady). +A representation of `st.time_input`. ```python -from streamlit_autorefresh import st_autorefresh - -st_autorefresh(interval=2000, limit=100, - key="fizzbuzzcounter") +at.time_input[0].increment().run() ``` -
- - + -screenshot + -

Authenticator

+

Toggle

-A secure authentication module to validate user credentials. Created by [@mkhorasani](https://github.com/mkhorasani). +A representation of `st.toggle`. ```python -import streamlit_authenticator as stauth - -authenticator = stauth.Authenticate( config['credentials'], config['cookie']['name'], -config['cookie']['key'], config['cookie']['expiry_days'], config['preauthorized']) +at.toggle[0].set_value("True").run() ``` -
+ - + -screenshot + -

WS localStorage

+ -A simple synchronous way of accessing localStorage from your app. Created by [@gagangoku](https://github.com/gagangoku). +screenshot + +

Pandas Profiling

+ +Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/). ```python -from streamlit_ws_localstorage import injectWebsocketCode +df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv") +pr = df.profile_report() -ret = conn.setLocalStorageVal(key='k1', val='v1') -st.write('ret: ' + ret) +st_profile_report(pr) ```
- + -screenshot +screenshot -

Streamlit Auth0

+

Streamlit Ace

-The fastest way to provide comprehensive login inside Streamlit. Created by [@conradbez](https://github.com/conradbez). +Ace editor component for Streamlit. Created by [@okld](https://github.com/okld). ```python -from auth0_component import login_button +from streamlit_ace import st_ace -user_info = login_button(clientId, domain = domain) -st.write(user_info) +content = st_ace() +content ```
diff --git a/content/develop/api-reference/charts/_index.md b/content/develop/api-reference/charts/_index.md index 1fbf7da69..b106d41d4 100644 --- a/content/develop/api-reference/charts/_index.md +++ b/content/develop/api-reference/charts/_index.md @@ -1,7 +1,7 @@ --- title: Chart elements slug: /develop/api-reference/charts -description: Create interactive data visualizations with Streamlit's charting capabilities including simple charts and advanced visualization libraries. +description: Create interactive data visualizations with Streamlit's charting capabilities including simple charts, advanced visualization libraries, and community components. keywords: charts, visualization, matplotlib, vega-lite, deck.gl, altair, plotly, bokeh, pydeck, graphviz, maps, line chart, bar chart, area chart, scatter chart --- @@ -170,3 +170,142 @@ st.mermaid_chart("graph LR\n A --> B") + + + + + +screenshot + +

Plost

+ +A deceptively simple plotting library for Streamlit. Created by [@tvst](https://github.com/tvst). + +```python +import plost +plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',) +``` + +
+ + + +screenshot + +

HiPlot

+ +High dimensional Interactive Plotting. Created by [@facebookresearch](https://github.com/facebookresearch). + +```python +data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}] +hip.Experiment.from_iterable(data).display() +``` + +
+ + + +screenshot + +

ECharts

+ +High dimensional Interactive Plotting. Created by [@andfanilo](https://github.com/andfanilo). + +```python +from streamlit_echarts import st_echarts +st_echarts(options=options) +``` + +
+ + + +screenshot + +

Streamlit Folium

+ +Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). + +```python +m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) +st_data = st_folium(m, width=725) +``` + +
+ + + +screenshot + +

Spacy-Streamlit

+ +spaCy building blocks and visualizers for Streamlit apps. Created by [@explosion](https://github.com/explosion). + +```python +models = ["en_core_web_sm", "en_core_web_md"] +spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.") +``` + +
+ + + +screenshot + +

Streamlit Agraph

+ +A Streamlit Graph Vis, based on [react-grah-vis](https://github.com/crubier/react-graph-vis). Created by [@ChrisDelClea](https://github.com/ChrisDelClea). + +```python +from streamlit_agraph import agraph, Node, Edge, Config +agraph(nodes=nodes, edges=edges, config=config) +``` + +
+ + + +screenshot + +

Streamlit Lottie

+ +Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). + +```python +lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") +st_lottie(lottie_hello, key="hello") +``` + +
+ + + +screenshot + +

Plotly Events

+ +Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). + +```python +fig = px.line(x=[1], y=[1]) +selected_points = plotly_events(fig) +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],) +st.altair_chart(chart, use_container_width=True) +``` + +
+ +
diff --git a/content/develop/api-reference/control-flow/_index.md b/content/develop/api-reference/control-flow/_index.md index 93c76a28b..2b5eb7b79 100644 --- a/content/develop/api-reference/control-flow/_index.md +++ b/content/develop/api-reference/control-flow/_index.md @@ -109,3 +109,58 @@ with st.form(key='my_form'): + + + + + +screenshot + +

Autorefresh

+ +Force a refresh without tying up a script. Created by [@kmcgrady](https://github.com/kmcgrady). + +```python +from streamlit_autorefresh import st_autorefresh + +st_autorefresh(interval=2000, limit=100, + key="fizzbuzzcounter") +``` + +
+ + + +screenshot + +

Pydantic

+ +Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). + +```python +import streamlit_pydantic as sp + +sp.pydantic_form(key="my_form", + model=ExampleModel) +``` + +
+ + + +screenshot + +

Streamlit Pages

+ +An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). + +```python +from st_pages import Page, show_pages, add_page_title + +show_pages([ Page("streamlit_app.py", "Home", "🏠"), + Page("other_pages/page2.py", "Page 2", ":books:"), ]) +``` + +
+ +
diff --git a/content/develop/api-reference/data/_index.md b/content/develop/api-reference/data/_index.md index 1f3a2e9c0..ebb8be0df 100644 --- a/content/develop/api-reference/data/_index.md +++ b/content/develop/api-reference/data/_index.md @@ -91,3 +91,109 @@ st.json(my_dict) + + + + + +screenshot + +

Streamlit Aggrid

+ +Implementation of Ag-Grid component for Streamlit. Created by [@PablocFonseca](https://github.com/PablocFonseca). + +```python +df = pd.DataFrame({'col1': [1, 2, 3], 'col2': [4, 5, 6]}) +grid_return = AgGrid(df, editable=True) + +new_df = grid_return['data'] +``` + +
+ + + +screenshot + +

Streamlit Folium

+ +Streamlit Component for rendering Folium maps. Created by [@randyzwitch](https://github.com/randyzwitch). + +```python +m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) +folium.Marker([39.949610, -75.150282], popup="Liberty Bell", tooltip="Liberty Bell").add_to(m) + +st_data = st_folium(m, width=725) +``` + +
+ + + +screenshot + +

Pandas Profiling

+ +Pandas profiling component for Streamlit. Created by [@okld](https://github.com/okld/). + +```python +df = pd.read_csv("https://storage.googleapis.com/tf-datasets/titanic/train.csv") +pr = df.profile_report() + +st_profile_report(pr) +``` + +
+ + + +screenshot + +

Image Coordinates

+ +Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). + +```python +from streamlit_image_coordinates import streamlit_image_coordinates +value = streamlit_image_coordinates("https://placekitten.com/200/300") + +st.write(value) +``` + +
+ + + +screenshot + +

Plotly Events

+ +Make Plotly charts interactive!. Created by [@null-jones](https://github.com/null-jones/). + +```python +from streamlit_plotly_events import plotly_events +fig = px.line(x=[1], y=[1]) + +selected_points = plotly_events(fig) +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +from streamlit_extras.metric_cards import style_metric_cards +col3.metric(label="No Change", value=5000, delta=0) + +style_metric_cards() +``` + +
+ +
diff --git a/content/develop/api-reference/layout/_index.md b/content/develop/api-reference/layout/_index.md index cb07dc5ec..2cba82440 100644 --- a/content/develop/api-reference/layout/_index.md +++ b/content/develop/api-reference/layout/_index.md @@ -159,3 +159,58 @@ tab2.write("this is tab 2") + + + + + +screenshot + +

Streamlit Elements

+ +Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). + +```python +from streamlit_elements import elements, mui, html + +with elements("new_element"): + mui.Typography("Hello world") +``` + +
+ + + +screenshot + +

Pydantic

+ +Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by [@lukasmasuch](https://github.com/lukasmasuch). + +```python +import streamlit_pydantic as sp + +sp.pydantic_form(key="my_form", + model=ExampleModel) +``` + +
+ + + +screenshot + +

Streamlit Pages

+ +An experimental version of Streamlit Multi-Page Apps. Created by [@blackary](https://github.com/blackary). + +```python +from st_pages import Page, show_pages, add_page_title + +show_pages([ Page("streamlit_app.py", "Home", "🏠"), + Page("other_pages/page2.py", "Page 2", ":books:"), ]) +``` + +
+ +
diff --git a/content/develop/api-reference/media/_index.md b/content/develop/api-reference/media/_index.md index 5eb28042d..a6fe4b88f 100644 --- a/content/develop/api-reference/media/_index.md +++ b/content/develop/api-reference/media/_index.md @@ -85,3 +85,103 @@ st.video("https://example.com/myvideo.mp4", format="video/mp4") + + + + + +screenshot + +

Streamlit Webrtc

+ +Handling and transmitting real-time video/audio streams with Streamlit. Created by [@whitphx](https://github.com/whitphx). + +```python +from streamlit_webrtc import webrtc_streamer + +webrtc_streamer(key="sample") +``` + +
+ + + +screenshot + +

Drawable Canvas

+ +Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). + +```python +from streamlit_drawable_canvas import st_canvas + +st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) +``` + +
+ + + +screenshot + +

Image Comparison

+ +Compare images with a slider using [JuxtaposeJS](https://juxtapose.knightlab.com/). Created by [@fcakyon](https://github.com/fcakyon). + +```python +from streamlit_image_comparison import image_comparison + +image_comparison(img1="image1.jpg", img2="image2.jpg",) +``` + +
+ + + +screenshot + +

Streamlit Cropper

+ +A simple image cropper for Streamlit. Created by [@turner-anderson](https://github.com/turner-anderson). + +```python +from streamlit_cropper import st_cropper + +st_cropper(img, realtime_update=realtime_update, box_color=box_color, aspect_ratio=aspect_ratio) +``` + +
+ + + +screenshot + +

Image Coordinates

+ +Get the coordinates of clicks on an image. Created by [@blackary](https://github.com/blackary/). + +```python +from streamlit_image_coordinates import streamlit_image_coordinates + +streamlit_image_coordinates("https://placekitten.com/200/300") +``` + +
+ + + +screenshot + +

Streamlit Lottie

+ +Integrate [Lottie](https://lottiefiles.com/) animations inside your Streamlit app. Created by [@andfanilo](https://github.com/andfanilo). + +```python +lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") + +st_lottie(lottie_hello, key="hello") +``` + +
+ +
diff --git a/content/develop/api-reference/status/_index.md b/content/develop/api-reference/status/_index.md index 666423187..7192082cd 100644 --- a/content/develop/api-reference/status/_index.md +++ b/content/develop/api-reference/status/_index.md @@ -182,3 +182,58 @@ st.exception(e) + + + + + +screenshot + +

Stqdm

+ +The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). + +```python +from stqdm import stqdm + +for _ in stqdm(range(50)): + sleep(0.5) +``` + +
+ + + +screenshot + +

Custom notification box

+ +A custom notification box with the ability to close it out. Created by [@Socvest](https://github.com/Socvest). + +```python +from streamlit_custom_notification_box import custom_notification_box + +styles = {'material-icons':{'color': 'red'}, 'text-icon-link-close-container': {'box-shadow': '#3896de 0px 4px'}, 'notification-text': {'':''}, 'close-button':{'':''}, 'link':{'':''}} +custom_notification_box(icon='info', textDisplay='We are almost done with your registration...', externalLink='more info', url='#', styles=styles, key="foo") +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +from streamlit_extras.let_it_rain import rain + +rain(emoji="🎈", font_size=54, + falling_speed=5, animation_length="infinite",) +``` + +
+ +
diff --git a/content/develop/api-reference/text/_index.md b/content/develop/api-reference/text/_index.md index 12ac88baf..adc780d51 100644 --- a/content/develop/api-reference/text/_index.md +++ b/content/develop/api-reference/text/_index.md @@ -212,3 +212,75 @@ st.iframe("my_content.html") + + + + +screenshot + +

Annotated text

+ +Display annotated text in Streamlit apps. Created by [@tvst](https://github.com/tvst). + +```python +annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".") +``` + +
+ + + +screenshot + +

Drawable Canvas

+ +Provides a sketching canvas using [Fabric.js](http://fabricjs.com/). Created by [@andfanilo](https://github.com/andfanilo). + +```python +st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) +``` + +
+ + + +screenshot + +

Tags

+ +Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). + +```python +st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') +``` + +
+ + + +screenshot + +

NLU

+ +Apply text mining on a dataframe. Created by [@JohnSnowLabs](https://github.com/JohnSnowLabs/). + +```python +nlu.load('sentiment').predict('I love NLU! <3') +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",) +``` + +
+
diff --git a/content/develop/api-reference/widgets/_index.md b/content/develop/api-reference/widgets/_index.md index c586cd933..8b4b16610 100644 --- a/content/develop/api-reference/widgets/_index.md +++ b/content/develop/api-reference/widgets/_index.md @@ -431,3 +431,160 @@ image = st.camera_input("Take a picture") + + + + + +screenshot + +

Streamlit Elements

+ +Create a draggable and resizable dashboard in Streamlit. Created by [@okls](https://github.com/okls). + +```python +from streamlit_elements import elements, mui, html + +with elements("new_element"): + mui.Typography("Hello world") +``` + +
+ + + +screenshot + +

Tags

+ +Add tags to your Streamlit apps. Created by [@gagan3012](https://github.com/gagan3012). + +```python +from streamlit_tags import st_tags + +st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], +suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') +``` + +
+ + + +screenshot + +

Stqdm

+ +The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg). + +```python +from stqdm import stqdm + +for _ in stqdm(range(50)): + sleep(0.5) +``` + +
+ + + +screenshot + +

Timeline

+ +Display a Timeline in Streamlit apps using [TimelineJS](https://timeline.knightlab.com/). Created by [@innerdoc](https://github.com/innerdoc). + +```python +from streamlit_timeline import timeline + +with open('example.json', "r") as f: + timeline(f.read(), height=800) +``` + +
+ + + +screenshot + +

Camera input live

+ +Alternative for st.camera_input which returns the webcam images live. Created by [@blackary](https://github.com/blackary). + +```python +from camera_input_live import camera_input_live + +image = camera_input_live() +st.image(value) +``` + +
+ + + +screenshot + +

Streamlit Ace

+ +Ace editor component for Streamlit. Created by [@okld](https://github.com/okld). + +```python +from streamlit_ace import st_ace + +content = st_ace() +content +``` + +
+ + + +screenshot + +

Streamlit Chat

+ +Streamlit Component for a Chatbot UI. Created by [@AI-Yash](https://github.com/AI-Yash). + +```python +from streamlit_chat import message + +message("My message") +message("Hello bot!", is_user=True) # align's the message to the right +``` + +
+ + + +screenshot + +

Streamlit Option Menu

+ +Select a single item from a list of options in a menu. Created by [@victoryhb](https://github.com/victoryhb). + +```python +from streamlit_option_menu import option_menu + +option_menu("Main Menu", ["Home", 'Settings'], + icons=['house', 'gear'], menu_icon="cast", default_index=1) +``` + +
+ + + +screenshot + +

Streamlit Extras

+ +A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/). + +```python +from streamlit_extras.stoggle import stoggle + +stoggle( + "Click me!", """πŸ₯· Surprise! Here's some additional content""",) +``` + +
+ +
diff --git a/content/menu.md b/content/menu.md index 5e521e20b..6a55c8d22 100644 --- a/content/menu.md +++ b/content/menu.md @@ -451,7 +451,7 @@ site_menu: - category: Develop / API reference / Status elements / st.snow url: /develop/api-reference/status/st.snow - category: Develop / API reference / Third-party components - url: /develop/api-reference#third-party-components + url: https://streamlit.io/components - category: Develop / API reference / APPLICATION LOGIC - category: Develop / API reference / App server url: /develop/api-reference/server From ef11acbdcb2419c7f0b5d176c3e39d23beaef407 Mon Sep 17 00:00:00 2001 From: lukasmasuch Date: Sat, 22 Aug 2026 11:47:02 +0200 Subject: [PATCH 15/15] Teach the release skill to sync config and handle removed APIs. Co-authored-by: Cursor --- .../skills/update-docs-for-release/SKILL.md | 79 ++++++++++++++++++- 1 file changed, 76 insertions(+), 3 deletions(-) diff --git a/.cursor/skills/update-docs-for-release/SKILL.md b/.cursor/skills/update-docs-for-release/SKILL.md index 8ba37a2ae..024625f3a 100644 --- a/.cursor/skills/update-docs-for-release/SKILL.md +++ b/.cursor/skills/update-docs-for-release/SKILL.md @@ -1,6 +1,6 @@ --- name: update-docs-for-release -description: Update the streamlit/docs repo for a new Streamlit release. Covers branch setup, release notes, API docstring generation, and API tiles/pages. Use when the user asks to update docs for a new Streamlit release, add release notes, generate docstrings, or add API tiles for new commands. +description: Update the streamlit/docs repo for a new Streamlit release. Covers branch setup, release notes, API docstring generation, config.toml, API tiles/pages, and removing or deprecating commands and parameters. Use when the user asks to update docs for a new Streamlit release, add release notes, generate docstrings, or add API tiles for new commands. disable-model-invocation: true --- @@ -172,6 +172,79 @@ After adding all files, present a table to the user: The user will handle deploying the apps to Community Cloud. -## 6. Commit and push +## 6. Configuration options -Make focused commits per logical unit of work (release notes, docstrings, API tiles, images, example apps). Push to the branch and open a PR against `main`. +After generating docstrings, compare Streamlit's live config with the docs. The source of truth is `streamlit config show` from the same virtualenv used in step 3: + +```bash +cd python +.venv-generate/bin/python -c "import streamlit; print(streamlit.__version__)" +.venv-generate/bin/python -m streamlit config show +``` + +**Primary file:** `content/develop/api-reference/configuration/config-toml.md` + +Diff the option keys and comments from `streamlit config show` against that page: + +- **Added options** β€” copy the CLI description into the matching `[section]` TOML block, using the same comment style as neighboring options. +- **Changed descriptions or defaults** β€” update the existing comments (for example allowed values, inheritance rules, or default numbers). +- **Removed options** β€” delete them from `config-toml.md`. If other pages still mention the option (FAQs, theming guides, tutorials), update or remove those references too. + +Do not paste every `theme.light.*` / `theme.dark.*` key as its own table. Document those as inheriting from `[theme]` (and `[theme.sidebar]` where applicable), and only list exceptions that cannot be set per light/dark/sidebar. + +**Related pages** β€” if theme or server options changed, check whether these still match the CLI: + +- `content/develop/concepts/configuration/theming.md` +- `content/develop/concepts/configuration/theming-fonts.md` +- `content/develop/concepts/configuration/theming-colors-and-borders.md` + +Release-note bullets about `client.*`, `server.*`, `runner.*`, or `theme.*` are a useful hint for what moved, but `streamlit config show` is authoritative. + +## 7. Removed and deprecated APIs + +If this version **removes** or **deprecates** commands or parameters, update the current docs to match. Start from the release notes (removal and deprecation bullets) and confirm against the new `python/streamlit.json` key: + +```bash +cd python +.venv-generate/bin/python -c " +import json +d = json.load(open('streamlit.json')) +prev, new = d['x.y-1.0'], d['x.y.0'] +print('removed commands:', sorted(set(prev) - set(new))) +for k in sorted(set(prev) & set(new)): + old_args = {a['name'] for a in (prev[k].get('args') or [])} + new_args = {a['name'] for a in (new[k].get('args') or [])} + gone = sorted(old_args - new_args) + if gone: + print(f'removed params on {k}:', gone) +" +``` + +Do not edit historical yearly release-note pages. Search `content/` (skip `content/develop/quick-references/release-notes/` except the current version) plus `python/api-examples-source/`, `python/generate.py`, `content/menu.md`, and `content/develop/quick-references/api-cheat-sheet.md`. + +### Deprecated (still in Streamlit) + +Keep the API page. Mark it so readers see the replacement: + +- On the detail page Autofunction: `deprecated={true}` and a `deprecatedText` that names the version and the replacement, for example: + +```markdown + +``` + +- Add `deprecated` to the page `keywords`. +- On the section `_index.md` RefCard: `deprecated={true}`. If the section already groups deprecated APIs (for example **Deprecated classes**), put the tile there. +- Parameter deprecations usually flow from docstrings (`.. deprecated::` is parsed into `streamlit.json`). Still rewrite tutorials, cheat-sheet snippets, and extra examples that recommend the old parameter as current. + +### Removed + +Clear the command or parameter from anything that presents it as current API: + +- **Parameters** β€” they drop from the new Autofunction after docstring generation. Remove them from extra examples, tutorials, concept pages, cheat-sheet snippets, and `python/api-examples-source/` files. Rewrite those examples to the replacement API. +- **Commands with a dedicated page** β€” keep the slug so old links work. Strip the live Autofunction body down to a deprecation stub whose `deprecatedText` says the command was deprecated in version A and **removed** in this version, and points to the replacement (see `content/develop/api-reference/charts/bokeh_chart.md`). Keep the `content/menu.md` entry. +- **Commands or methods without a dedicated page** (for example a DeltaGenerator method) β€” delete Autofunctions, tiles, and cheat-sheet lines, and rewrite tutorials or demo apps that still call them. +- If `generate.py` errors because an object no longer exists, remove that entry from `obj_key` (or related dicts) and re-run, as in step 3. + +## 8. Commit and push + +Make focused commits per logical unit of work (release notes, docstrings, config, API tiles, deprecations/removals, images, example apps). Push to the branch and open a PR against `main`.