ui.modal_button
ui.modal_button(label, icon=None, **kwargs)
Creates a button that will dismiss a modal.
modal_button is usually passed to the footer
of a modal to add a button to the footer that will close the modal.
Parameters
label: TagChild
-
An input label.
icon: TagChild = None
-
An icon to appear inline with the button/link.
**kwargs: TagAttrValue = {}
-
Attributes to be applied to the button.
Returns
Type | Description |
---|---|
Tag | A UI element |
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)