Skip to content

Instantly share code, notes, and snippets.

@xiaodaigh
Last active February 1, 2017 02:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiaodaigh/7012930 to your computer and use it in GitHub Desktop.
Save xiaodaigh/7012930 to your computer and use it in GitHub Desktop.
== actionButton styling == The Twitter Bootstrap allows for many class styles for buttons. http://getbootstrap.com/2.3.2/base-css.html#buttons Added support for these styles to the actionButton.
library(shiny)
shinyServer(function(input,output){
})
library(shiny)
actionButton <- function(inputId, label, btn.style = "" , css.class = "") {
if ( btn.style %in% c("primary","info","success","warning","danger","inverse","link")) {
btn.css.class <- paste("btn",btn.style,sep="-")
} else btn.css.class = ""
tags$button(id=inputId, type="button", class=paste("btn action-button",btn.css.class,css.class,collapse=" "), label)
}
shinyUI(basicPage(
actionButton("primary","primary","primary",c("btn-large", "meheh")),
actionButton("info","info","info"),
actionButton("success","success","success"),
actionButton("warning","warning","warning"),
actionButton("danger","danger","danger"),
actionButton("inverse","inverse","inverse"),
actionButton("link","link","link")
)
)
@knbknb
Copy link

knbknb commented Sep 19, 2014

great idea, works perfectly, just what I needed, but didn't find in the standrd documentation.

@ferroao
Copy link

ferroao commented May 18, 2016

size is not working

@cutariechu
Copy link

Works great for me, thanks!
A working example with button size change:

actionButton("boton",strong("BUSCAR"),"primary","btn-sm")

@DnPeter
Copy link

DnPeter commented Feb 1, 2017

Any example for the class, for example circle?
Tks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment