Change the color of action button in shiny

前端 未结 3 993
感情败类
感情败类 2020-12-24 05:45

I am trying to change the color of the action button from gray to orange.

actionButton(\"run\",\"Run Analysis\")

(This is in server.R

相关标签:
3条回答
  • 2020-12-24 05:55

    Below, I've made your action button look like a submit button (also adding a font-awesome icon):

    actionButton("run", "Run Analysis", icon("paper-plane"), 
        style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
    
    0 讨论(0)
  • 2020-12-24 05:57

    As @MLavoie mentioned, you can embed CSS in your shiny app using tags$head. Try this:

    library(shiny)
    
    ui <- shinyUI(fluidPage(
      tags$head(
        tags$style(HTML('#run{background-color:orange}'))
      ),
      actionButton("run","Run Analysis")
    ))
    server <- shinyServer(function(input, output) {
    
    })
    shinyApp(ui, server)
    

    If you're unfamiliar to CSS, w3schools has really good and easy tutorials.

    0 讨论(0)
  • 2020-12-24 06:00

    You can use boostrap colors in the class attribute:

    actionButton("run","Run Analysis", class = "btn-warning")
    

    These are basic colors only but really usefull for graphic standards.

    0 讨论(0)
提交回复
热议问题