removeInput.Rd
The removal of the named input in a shiny session.
removeInput(
id,
selector = paste0("#", id),
session = getDefaultReactiveDomain()
)
An invisible `TRUE` value confirming that the input has been removed.
If the input is a standard shiny input e.g. `numericInput`, then to remove the label as well as the input, set the selector to be `paste0(":has(> #", id, ")")`
if (FALSE) { # interactive()
library(shiny)
library(shiny.destroy)
ui <- fluidPage(
numericInput("number", "Select number:", 5, 1, 10),
p("Selected number:", textOutput("number_out", inline = TRUE)),
actionButton("delete", "Remove input")
)
server <- function(input, output, session) {
output$number_out <- renderText(input$number %||% "input unavailable")
observeEvent(
input$delete,
removeInput("number", selector = ":has(> #number)")
)
}
shinyApp(ui, server)
}