express.ui.modal_button

express.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 reactive
from shiny.express import input, ui

ui.input_action_button("show", "Show modal dialog")


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