ui.modal_remove
ui.modal_remove(session=None)
Remove a modal dialog box.
modal_remove provides a way to remove a modal programatically. Modals can also be removed manually by the user if a modal_button is provided, or if the modal is created with easy_close=True
.
Parameters
session: Optional[
Session
] = None-
The Session instance that contains the modal to remove. 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)