Skip to main content

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")

Example

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)

Example

Open the Dialog in Fullscreen (whole iFrame)
#The open button will be hidden

st_mui_dialog(..., fullscreen = True)

Example

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"}""")

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_mui_dialog-0.0.6.tar.gz (699.1 kB view details)

Uploaded Source

Built Distribution

st_mui_dialog-0.0.6-py3-none-any.whl (706.4 kB view details)

Uploaded Python 3

File details

Details for the file st_mui_dialog-0.0.6.tar.gz.

File metadata

  • Download URL: st_mui_dialog-0.0.6.tar.gz
  • Upload date:
  • Size: 699.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for st_mui_dialog-0.0.6.tar.gz
Algorithm Hash digest
SHA256 5d749b950e5fba8921527271c202c6004bed38526496b2449a36658bdc3ddcbf
MD5 ca0e78250ec9676b3af6c27891d7c9ad
BLAKE2b-256 819df62bc15ab2213403d0fda042f397196bb89638233a4172560917434316dc

See more details on using hashes here.

File details

Details for the file st_mui_dialog-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for st_mui_dialog-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 631d7d9c977f31191aedb294db49ae4d3310042857a05d46f6144358d403f032
MD5 58f9c0fe2315dae634a1f99e4fb5eec2
BLAKE2b-256 0f4604b95b1cb31e69e71a63d0ddb87126cc64d2b98aa97a41dc9a0d4f4fb16b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page