Streamlit Component for MUI Dialogs
Project description
Streamlit MUI Dialog Component
This streamlit component adds a Dialog (Modal) with two buttons to Streamlit Apps.
It implements the MUI Alert Dialog: https://mui.com/material-ui/react-dialog/
Installation
$ pip install st-mui-dialog
Usage
Import the Component
$ from st_mui_dialog import st_mui_dialog
Initialize an instant
$ answer = st_mui_dialog(title="Confirmation", content="Please confirm that you want to save the changes")
Configuration Options
Button Labels
#Open Button Label
st_mui_dialog(..., button_txt = "Open the Dialog")
#Abort Button Label
st_mui_dialog(..., abortlabel = "DISAGREE")
#Agree Button Label
st_mui_dialog(..., abortlabel = "AGREE")
Styling
Dividers
st_mui_dialog(..., divider = True)
Open the Dialog in Fullscreen (whole iFrame)
#The open button will be hidden
st_mui_dialog(..., fullscreen = True)
Transition Modes
Currently not working
st_mui_dialog(..., transition_mode = "zoom")
#if the transition mode is 'slide' the paramater 'slide_direction' is needed
st_mui_dialog(..., transition_mode = "slide", slide_direction = "up")
Width of the Dialog
The width is always limited to the widht of the iframe
#Sets the max width to "xl"
st_mui_dialog(..., width_dialog = "xl")
#Always shows the max width of the dialog - If false the width will be dependent on the content.
st_mui_dialog(..., adapt_width_dialog = True)
Button Styles
#Button Types
#Open Button
st_mui_dialog(..., button_open_type = "primary")
#Agree Button
st_mui_dialog(..., button_agree_type = "warning")
#Abort Button
st_mui_dialog(..., button_abort_type = "success")
CSS Styles
It is possible to apply CSS Styles to the different MUI Elements of the Dialog
st_mui_dialog(..., styling_dialog = """{"& .MuiModal-backdrop": {"backgroundColor": "red"},"& .MuiModal-container":{"backgroundColor" :"red"}""")
st_mui_dialog(..., styling_open_button = """{"backgroundColor" :"lightgreen"}""")
st_mui_dialog(..., styling_agree_button = """{"backgroundColor" :"yellow"}"""")
st_mui_dialog(..., styling_abort_button = """{"backgroundColor" :"blue"}""")
st_mui_dialog(..., styling_dialog_content = """{"backgroundColor" :"blue"}""")
st_mui_dialog(..., styling_dialog_title = """{"backgroundColor" :"blue"}""")
st_mui_dialog(..., styling_dialog_content_text = """{"backgroundColor" :"blue"}""")
Event Handlers
It is possible to execute JavaScript commands on Open, Close, Agree and Abort.
st_mui_dialog(..., on_open = """console.log("Open")""")
st_mui_dialog(..., on_close = """console.log("Close")""")
st_mui_dialog(..., on_agree = """console.log("Agree")""")
st_mui_dialog(..., on_abort = """console.log("Abort")""")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
st_mui_dialog-0.0.10.tar.gz
(702.0 kB
view details)
Built Distribution
File details
Details for the file st_mui_dialog-0.0.10.tar.gz
.
File metadata
- Download URL: st_mui_dialog-0.0.10.tar.gz
- Upload date:
- Size: 702.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 889f7a8b47f10a1a56d0e74119bc976d3fbf2b273c3657121364a403708e510d |
|
MD5 | be82ac0fe16669ce24c6333bd5421d9d |
|
BLAKE2b-256 | c1dd347bbde1a04d9fdcdb2e6c46e08c02dc5e87509bcce2b1e8fa99b12b0337 |
File details
Details for the file st_mui_dialog-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: st_mui_dialog-0.0.10-py3-none-any.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddbcf582c99e01c63279049520653414d280f90f8da2f669b3f27de0f5023eab |
|
MD5 | 920a666f8386914574877180cf4d1d5c |
|
BLAKE2b-256 | 82de937204f93eeaa1f293b8710edd3dc58489f8d94c561a5c42bf948bc7cd53 |