dreamRs / shinyWidgets

shinyWidgets : Extend widgets available in shiny
https://dreamrs.github.io/shinyWidgets/
GNU General Public License v3.0
826 stars 153 forks source link

Make switchInput themable #452

Closed AshesITR closed 2 years ago

AshesITR commented 2 years ago
library(shiny)
library(shinyWidgets)

shiny::shinyOptions(bootstrapTheme = bslib::bs_theme(primary = "#ff0000"))

shinyApp(
  fluidPage(switchInput("si", "switchInput", offStatus = "primary")),
  function(input, output, session) {}
)

Created on 2021-12-06 by the reprex package (v2.0.1)

Yields this page: image

instead of this expected page: image

This is the current SCSS for Bootstrap 4, that should be used for theming: https://github.com/Bttstrp/bootstrap-switch/blob/master/src/sass/bootstrap4/bootstrap-switch.scss

AshesITR commented 2 years ago

For whatever reason shinyOptions() doesn't work for me even after the fix, but here is a working piece of code:

library(shiny)
library(shinyWidgets) # On #454 

shinyApp(
  fluidPage(switchInput("si", "switchInput", offStatus = "primary"), theme = bslib::bs_theme(primary = "#ff0000")),
  function(input, output, session) {}
)