Description Usage Arguments Details See Also Examples
Remove a UI object from the app.
1 2 | removeUI(selector, multiple = FALSE, immediate = FALSE,
session = getDefaultReactiveDomain())
|
selector |
A string that is accepted by jQuery's selector (i.e. the
string |
multiple |
In case your selector matches more than one element,
|
immediate |
Whether the element(s) should be immediately removed from
the app when you call |
session |
The shiny session within which to call |
This function allows you to remove any part of your UI. Once removeUI
is executed on some element, it is gone forever.
While it may be a particularly useful pattern to pair this with
insertUI
(to remove some UI you had previously inserted),
there is no restriction on what you can use removeUI
on. Any
element that can be selected through a jQuery selector can be removed
through this function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Only run this example in interactive R sessions
if (interactive()) {
# Define UI
ui <- fluidPage(
actionButton("rmv", "Remove UI"),
textInput("txt", "This is no longer useful")
)
# Server logic
server <- function(input, output, session) {
observeEvent(input$rmv, {
removeUI(
selector = "div:has(> #txt)"
)
})
}
# Complete app with UI and server components
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.