- Contents
- st.popover
- PopoverContainer
st.popover
Insert a popover container.
Inserts a multi-element container as a popover. It consists of a button-like element and a container that opens when the button is clicked.
Opening and closing the popover will not trigger a rerun. Interacting with widgets inside of an open popover will rerun the app while keeping the popover open. Clicking outside of the popover will close it.
To add elements to the returned container, you can use the "with" notation (preferred) or just call methods directly on the returned object. See examples below.
Warning
You may not put a popover inside another popover.
| Function signature[source] | |
|---|---|
st.popover(label, *, help=None, disabled=False, use_container_width=False) | |
| Parameters | |
label (str) | The label of the button that opens the popover container. The label can optionally contain Markdown and supports the following elements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links. This also supports:
Unsupported elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g. 1\. Not an ordered list. |
help (str) | An optional tooltip that gets displayed when the popover button is hovered over. |
disabled (bool) | An optional boolean, which disables the popover button if set to True. The default is False. |
use_container_width (bool) | An optional boolean, which makes the popover button stretch its width to match the parent container. This only affects the button and not the width of the popover container. |
Examples
You can use the with notation to insert any element into a popover:
PythonOr you can just call methods directly on the returned objects:
Python
Still have questions?
Our forums are full of helpful information and Streamlit experts.
