# st-modal
A modern modal dialog component for Streamlit applications. This is a fork of the original [streamlit_modal](https://github.com/teamtv/streamlit_modal) with improvements and adjustments.
## Installation
```bash
pip install st-modal
```
## Quick Start
```python
import streamlit as st
from st_modal import Modal
# Create modal with markdown title
modal = Modal("## 🎉 My Modal", key="my-modal")
# Trigger to open modal
if st.button("Open Modal"):
modal.open()
# Modal content
if modal.is_open():
with modal.container():
st.write("Hello from inside the modal!")
value = st.slider("Pick a value", 0, 100, 50)
st.write(f"Selected: {value}")
if st.button("Close", key="close-modal"):
modal.close()
```
## API Reference
### Modal Class
```python
Modal(title, key, padding=20, max_width=744, show_close_button=True)
```
**Parameters:**
- `title` (str): Title displayed at the top of the modal. Supports full markdown syntax including `#` headers, **bold**, *italic*, and emojis
- `key` (str): Unique identifier for the modal (required)
- `padding` (int): Internal padding in pixels (default: 20)
- `max_width` (int): Maximum width in pixels (default: 744)
- `show_close_button` (bool): Whether to show the Material Design close button (default: True)
**Methods:**
- `modal.open()`: Opens the modal and triggers a rerun
- `modal.close()`: Closes the modal and triggers a rerun
- `modal.is_open()`: Returns True if modal is currently open
- `modal.container()`: Context manager for adding content to the modal
Raw data
{
"_id": null,
"home_page": "https://github.com/teamtv/streamlit_modal",
"name": "st-modal",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "streamlit, modal, dialog, ui, component",
"author": "Peter van Lunteren",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/95/66/806c09c3f27d737cd6a89489ceb2710ae44d9fdb932ca2a6ca5dc4354ea1/st_modal-1.0.1.tar.gz",
"platform": null,
"description": "# st-modal\n\nA modern modal dialog component for Streamlit applications. This is a fork of the original [streamlit_modal](https://github.com/teamtv/streamlit_modal) with improvements and adjustments.\n\n## Installation\n\n```bash\npip install st-modal\n```\n\n## Quick Start\n\n```python\nimport streamlit as st\nfrom st_modal import Modal\n\n# Create modal with markdown title\nmodal = Modal(\"## \ud83c\udf89 My Modal\", key=\"my-modal\")\n\n# Trigger to open modal\nif st.button(\"Open Modal\"):\n modal.open()\n\n# Modal content\nif modal.is_open():\n with modal.container():\n st.write(\"Hello from inside the modal!\")\n \n value = st.slider(\"Pick a value\", 0, 100, 50)\n st.write(f\"Selected: {value}\")\n \n if st.button(\"Close\", key=\"close-modal\"):\n modal.close()\n```\n\n## API Reference\n\n### Modal Class\n\n```python\nModal(title, key, padding=20, max_width=744, show_close_button=True)\n```\n\n**Parameters:**\n- `title` (str): Title displayed at the top of the modal. Supports full markdown syntax including `#` headers, **bold**, *italic*, and emojis\n- `key` (str): Unique identifier for the modal (required)\n- `padding` (int): Internal padding in pixels (default: 20)\n- `max_width` (int): Maximum width in pixels (default: 744)\n- `show_close_button` (bool): Whether to show the Material Design close button (default: True)\n\n**Methods:**\n- `modal.open()`: Opens the modal and triggers a rerun\n- `modal.close()`: Closes the modal and triggers a rerun\n- `modal.is_open()`: Returns True if modal is currently open\n- `modal.container()`: Context manager for adding content to the modal\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Modal for streamlit",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/teamtv/streamlit_modal"
},
"split_keywords": [
"streamlit",
" modal",
" dialog",
" ui",
" component"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8da061f608ab9373459a664dc1ca47c5a5e7a9480ee91cc84db56cfa8ade3680",
"md5": "bc136ed9c837568968e2f3b0c1efa39d",
"sha256": "760be22cd28dd7920dfe49f922644a5068b916a87b9d7b78b03447fbfaee75ed"
},
"downloads": -1,
"filename": "st_modal-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc136ed9c837568968e2f3b0c1efa39d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5388,
"upload_time": "2025-08-11T09:24:27",
"upload_time_iso_8601": "2025-08-11T09:24:27.093954Z",
"url": "https://files.pythonhosted.org/packages/8d/a0/61f608ab9373459a664dc1ca47c5a5e7a9480ee91cc84db56cfa8ade3680/st_modal-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9566806c09c3f27d737cd6a89489ceb2710ae44d9fdb932ca2a6ca5dc4354ea1",
"md5": "3644b425dff1b9ee0d0dc0cd1312ad7d",
"sha256": "56c636d8bf23b26f1ca3f437cd2305a8c65287048fc8cbaf0b2e6ca8512c4de9"
},
"downloads": -1,
"filename": "st_modal-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "3644b425dff1b9ee0d0dc0cd1312ad7d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5535,
"upload_time": "2025-08-11T09:24:28",
"upload_time_iso_8601": "2025-08-11T09:24:28.947312Z",
"url": "https://files.pythonhosted.org/packages/95/66/806c09c3f27d737cd6a89489ceb2710ae44d9fdb932ca2a6ca5dc4354ea1/st_modal-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-11 09:24:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "teamtv",
"github_project": "streamlit_modal",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "st-modal"
}