1

Very simple question: In my shiny UI, I have two buttons, A and B

on the click of button B I would like button A to be hidden, but I don't think updateActionButton has this capability. So how is this accomplished?

Thanks in advance

John Smith
  • 393
  • 1
  • 6
  • 17

1 Answers1

2

Dean built wonderful shinyjs package that has this functionality. Note that I added toggle instead of hide but you can switch if you like

rm(list = ls())
library(shiny)
library(shinyjs)

ui <- fluidPage(
  useShinyjs(),
  actionButton("hide","a"),
  actionButton("b","b")
)

server <- shinyServer(function(input,output){

  observeEvent(input$hide,{
    toggle("b")
  })

})
runApp(list(ui = ui, server = server))

enter image description here

Pork Chop
  • 28,528
  • 5
  • 63
  • 77