Description Usage Arguments Examples
Use in a Shiny app to remove a card from layout.
1 | remove_card(shuffleId, cardId, session = shiny::getDefaultReactiveDomain())
|
shuffleId |
The id of the shuffle container. |
cardId |
The id of the card to remove. |
session |
The |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | if (interactive()) {
library(shiny)
library(shufflecards)
ui <- fluidPage(
tags$h2("Remove a card"),
selectInput(
inputId = "select",
label = "Select card to remove",
choices = paste0("card", 1:4)
),
actionButton("remove", "Remove it!"),
shuffle_container(
shuffleId = "grid",
shuffle_card(
id = "card1",
tags$div("My first card", style = "text-align: center; line-height: 200px"),
style = "border: 2px solid red; border-radius: 5px;",
width = "300px", # better with fixed width/height
height = "200px"
),
shuffle_card(
id = "card2",
tags$div("Second one", style = "text-align: center; line-height: 200px"),
style = "border: 2px solid red; border-radius: 5px;",
width = "300px", # better with fixed width/height
height = "200px"
),
shuffle_card(
id = "card3",
tags$div("Third one", style = "text-align: center; line-height: 200px"),
style = "border: 2px solid red; border-radius: 5px;",
width = "300px", # better with fixed width/height
height = "200px"
),
shuffle_card(
id = "card4",
tags$div("Fourth one", style = "text-align: center; line-height: 200px"),
style = "border: 2px solid red; border-radius: 5px;",
width = "300px", # better with fixed width/height
height = "200px"
)
)
)
server <- function(input, output, session) {
observeEvent(input$remove, {
remove_card("grid", input$select)
}, ignoreInit = TRUE)
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.