Below is sample code using bslib to use a bootstrap theme. I am passing the class tag to one of the action buttons so it's formatted nicely. But, is there a way to do this more globally as a default for all action buttons so that I don't need to add the class to each one individually?
I am also experimenting with shinythemes instead of bslib and it would be the same issue using that package as well. However, the app loads must faster (locally) with shinythemes compared to bslib.
So, two questions:
- How can I establish a global way to pass a class to to bootstrap components (like to an actionButton)
- Which package seems to be a better choice, shinythemes or bslib?
library(shiny)
library(bslib)
ui <- fluidPage(
navbarPage(
theme = bs_theme(bootswatch = "flatly"),
title = 'Methods',
tabPanel('One'),
tabPanel('Two'),
tabPanel('Three'),
tabPanel('Four')
),
mainPanel(
h1('Hello World'),
fileInput("file", "Choose CSV File", accept = ".csv"),
actionButton('aButton', 'Do Stuff'),
submitButton("Submit"),
actionButton("primary", "Primary", class = "btn-primary m-2"),
checkboxInput('aCheckBox', 'Check Me', TRUE)
)
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)