3

I've got a team who has built plenty with shiny UI (and also shinydashboard) but I'd like to come through and restyle the entire set of apps we've built.

I can link to our css in a number of ways, but that's just setting a new css file on top of the bootstrap base css. *I have not found a way to just ditch the bootstrap css entirely. Is this possible? * Even setting theme to NULL seems to still keep that base css in there.

This causes issues of specificity that I have to overcome, which is annoying.

(I realize by ditching bootstrap I will have to recreate many styles they've defined -- and am losing some of the value of shiny, that's not a problem at this point for me)

Tyler Lee
  • 31
  • 3

1 Answers1

5

The shiny package includes a function suppressDependencies which may be used to drop web dependencies. See ?shiny::suppressDependencies for more information. Unfortunately, I do not believe one can remove only the bootstrap CSS resource, instead one must remove all bootstrap related resources. This appears to be a result of how shiny handles resource dependencies, i.e. all the bootstrap related resources are bundled under the name "bootstrap" which suppressDependencies looks for and then drops entirely.

Limitation aside, I put together a small demo Shiny application showing how to drop the bootstrap resources.

library(shiny)

shinyApp(
  ui = tagList(
    suppressDependencies("bootstrap"),
    tags$p("Hello, world!")
  ),
  server = function(input, output) {

  }
)
nteetor
  • 1,175
  • 11
  • 13