ui.modal_show
=None) ui.modal_show(modal, session
Show a modal dialog.
modal_show is used to display a modal that has been created with modal.
Parameters
modal : Tag
-
Typically a modal instance.
session : Optional[
Session
] = None-
The Session instance to display the modal in. If not provided, the session is inferred via get_current_session.
See Also
Examples
#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
## file: app.py
from shiny import App, Inputs, Outputs, Session, reactive, ui
app_ui = ui.page_fluid(
ui.input_action_button("show", "Show modal dialog"),
)
def server(input: Inputs, output: Outputs, session: Session):
@reactive.effect
@reactive.event(input.show)
def _():
m = ui.modal(
"This is a somewhat important message.",
title="Somewhat important message",
easy_close=True,
footer=None,
)
ui.modal_show(m)
app = App(app_ui, server)