Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make buttons more customizable by allowing more bootstrap colors #1675

Closed
dmpe opened this issue Apr 23, 2017 · 4 comments
Closed

Make buttons more customizable by allowing more bootstrap colors #1675

dmpe opened this issue Apr 23, 2017 · 4 comments

Comments

@dmpe
Copy link
Contributor

dmpe commented Apr 23, 2017

https://getbootstrap.com/css/#buttons
https://v4-alpha.getbootstrap.com/components/buttons/#examples

allows to have primary, secondary etc.

It would be nice to have it e.g. here as well. https://github.com/rstudio/shiny/blob/master/R/bootstrap.R#L1458

I.e. I would like to change default to danger

@bborgesr
Copy link
Contributor

bborgesr commented May 1, 2017

@dmpe, Given the way that CSS works, if you assign two different classes that each specify a different color, the last one wins out. So, functionally, you can already do what you want in Shiny. I realize that it may look clunky to have two color classes, but it's valid CSS.

This applies to all Shiny buttons, as demoed below:

library(shiny)
ui <- fluidPage(
  h3("Action Buttons"),
  actionButton("default", "Default"),
  actionButton("primary", "Primary", class = "btn-primary"),
  actionButton("secondary", "Secondary", class = "btn-secondary"),
  actionButton("success", "Success", class = "btn-success"),
  actionButton("info", "Info", class = "btn-info"),
  actionButton("warning", "Warning", class = "btn-warning"),
  actionButton("danger", "Danger", class = "btn-danger"),
  actionButton("link", "Link", class = "btn-link"),
  
  h3("Download Buttons"),
  downloadButton("default", "Default"),
  downloadButton("primary", "Primary", class = "btn-primary"),
  downloadButton("secondary", "Secondary", class = "btn-secondary"),
  downloadButton("success", "Success", class = "btn-success"),
  downloadButton("info", "Info", class = "btn-info"),
  downloadButton("warning", "Warning", class = "btn-warning"),
  downloadButton("danger", "Danger", class = "btn-danger"),
  downloadButton("link", "Link", class = "btn-link"),
  
  h3("Bookmark Buttons"),
  bookmarkButton("Default"),
  bookmarkButton("Primary", class = "btn-primary"),
  bookmarkButton("Secondary", class = "btn-secondary"),
  bookmarkButton("Success", class = "btn-success"),
  bookmarkButton("Info", class = "btn-info"),
  bookmarkButton("Warning", class = "btn-warning"),
  bookmarkButton("Danger", class = "btn-danger"),
  bookmarkButton("Link", class = "btn-link")
)
server <- function(input, output, session) {}
shinyApp(ui, server)

@dmpe
Copy link
Contributor Author

dmpe commented May 1, 2017

maybe for bootstrap v4 :) Because the fix is very simple - just add a new parameter :)

@bborgesr
Copy link
Contributor

bborgesr commented May 1, 2017

No, we're unlikely to add a new a parameter, since the code above is sufficient and clear. Adding a new parameter that replicates existing functionality is bad practice.

@alandipert
Copy link
Contributor

Closing because a workaround was provided, but please don't hesitate to comment further or create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants