0
votes

I'm using a Shiny modal dialog to show a plot to the user. The modal dialog box is showed whenever the user clicks an input button in the app.

However, this plot is fairly static. If the user wants to see new data or modify this data with some parameter, he needs to close the dialog box and input new parameters and then generate the plot again.

How can I add input controls inside the dialog box? As of right now, the only button I have is a download button, which I implemented like this:

showModal(
    modalDialog(
        body = plotOutput(ns("plot")),
        footer = downloadButton(ns("downloadPlot")),
        easyClose = TRUE,
        size = "l"
    )
)

So how can I add a second input button to it?

1

1 Answers

1
votes

Your first parameter doesn't need the 'body' name. You should be able to pass as many items as you need as unnamed parameters to modalDialog.

showModal(
    modalDialog(
        plotOutput(ns("plot")),
        otherOutput("output1"),
        otherOutput("output2"),
        footer = downloadButton(ns("downloadPlot")),
        easyClose = TRUE,
        size = "l"
    )
)

You can see here that the UI elements for the modal body can be passed in directly.