Skip to main content

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, 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

Release files for st-modal 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for st-modal 1.0.2
File Size Uploaded
st_modal-1.0.2.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for st-modal 1.0.2
File Interpreter ABI Platform
st_modal-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / st_modal-1.0.2.tar.gz

Download URL st_modal-1.0.2.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
71e9d2afa0b5ddbb7a073aca4709f9113dac5925c4e182129673c502fe648085
BLAKE2b-256 checksum
How to use checksums
ce1383e6b8caf0c04b569610dc992bcdc1cf2751be2afdd4dc1465babfe5db10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release files / st_modal-1.0.2-py3-none-any.whl

Download URL st_modal-1.0.2-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e86bf86ff9c0e5b7ea303b8d54957e253b26cc3ecb7ee029fc0e6e62d9c37043
BLAKE2b-256 checksum
How to use checksums
7fccf9b840d0cb88d10a45cdc1813d5d8d7c7a209ce094c03e6293efd2a8a59b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page