Metadata-Version: 2.4
Name: st-modal
Version: 1.0.2
Summary: Modal for streamlit
Author: Peter van Lunteren
License: BSD
Project-URL: Homepage, https://github.com/PetervanLunteren/st-modal
Project-URL: Repository, https://github.com/PetervanLunteren/st-modal
Project-URL: Issues, https://github.com/PetervanLunteren/st-modal/issues
Keywords: streamlit,modal,dialog,ui,component
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Scientific/Engineering
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: streamlit
Requires-Dist: deprecation
Dynamic: license-file

# 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
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, show_title=True, show_divider=True)
```

**Parameters:**
- `title` (str): Title displayed at the top of the modal
- `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 X close button (default: True)
- `show_title` (bool): Whether to show the title header (default: True)
- `show_divider` (bool): Whether to show the divider line below the header (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
