Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the color of action button in shiny

Tags:

r

shiny

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

actionButton("run","Run Analysis") 

(This is in server.R.) Is it possible to change its color?

like image 842
Sam Kingston Avatar asked Nov 09 '15 23:11

Sam Kingston


2 Answers

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") 
like image 132
Megatron Avatar answered Sep 22 '22 07:09

Megatron


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.

like image 44
RmIu Avatar answered Sep 18 '22 07:09

RmIu