Modal for streamlit
Project description
st-modal
A modern modal dialog component for Streamlit applications. This is a fork of the original streamlit_modal with improvements and adjustments.
Installation
pip install st-modal
Quick Start
import streamlit as st
from st_modal import Modal
# Create modal
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
Modal(title, key, padding=20, max_width=744, show_close_button=True)
Parameters:
title(str): Title displayed at the top of the modalkey(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 X close button (default: True)
Methods:
modal.open(): Opens the modal and triggers a rerunmodal.close(): Closes the modal and triggers a rerunmodal.is_open(): Returns True if modal is currently openmodal.container(): Context manager for adding content to the modal
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
st_modal-0.1.3.tar.gz
(4.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file st_modal-0.1.3.tar.gz.
File metadata
- Download URL: st_modal-0.1.3.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27375a476e66ccc26a668fa059d8f842fcec2c012bd132de81f9f44eaee5b8b5
|
|
| MD5 |
e49025cd46c170643262a712997d52e4
|
|
| BLAKE2b-256 |
b1aca3509a267711e896b8c96732f26c9ffc41ccd9d4208d3ed0fec80353241b
|
File details
Details for the file st_modal-0.1.3-py3-none-any.whl.
File metadata
- Download URL: st_modal-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3db6bd7e31b283e6858fbb740355f547f2243810d216c2f5e1ae597d6678d355
|
|
| MD5 |
984dd449fc0abd4a88964ce6d3c001bf
|
|
| BLAKE2b-256 |
1fbf399b59c192dad65a7f20e8f2ec71386b986662cca0c2cc58344c13624492
|