Tienes que usar la pseudo clase :focus
en lugar de :onclick
tags$head(
tags$style(HTML("
.form-control:focus {
background-color: #F3E9AF;
border-color: #E9C80B;
box-shadow: 10px 16px 15px #E9C80B;
}
")))
Enseguida te dejo el código completo de una shinyapp
que hace esto.
library(shiny)
library(shinydashboard)
ui <- fluidPage(
tags$head(
tags$style(HTML("
.form-control:focus {
background-color: #F3E9AF;
border-color: #E9C80B;
box-shadow: 10px 16px 15px #E9C80B;
}
"))),
# Application title
titlePanel("Calculo"),
sidebarLayout(
sidebarPanel(
numericInput("num", "Numero:", 1, min = 1, max = 100),
actionButton('btnCalculo', 'Calcular',
btn_type = "button", type = "primary"),
),
mainPanel(
uiOutput("valuebox2")#valueBoxOutput("valuebox2")
)
)
)
server <- function(input, output) {
rv<-reactiveValues(result=NULL)
observeEvent(input$btnCalculo,{
rv$result[input$btnCalculo] <- input$num + 1000
})
output$valuebox2<-renderUI({#renderInfoBox({
if(is.null(rv$result)){
div()
}else(
#valueBox(format(round(rv$result,0), big.mark = ","),"Suma")
lapply(rev(rv$result), function(i) {
valueBox(format(round(i,0), big.mark = ","),"Suma")
} )
)
})
}
shinyApp(ui = ui, server = server)