Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove bold in a shiny sidebar in R

Tags:

r

shiny

I'm new to Shiny and can't figure out how to "unbold" labels (feed rate and operation in the screenshot attached). Here's my code for the UI part:

ui <- fluidPage(titlePanel(""),
                sidebarLayout(
                  sidebarPanel(
                    # adding the new div tag to the sidebar            
                    tags$div(class="header", checked=NA,
                             tags$h4(strong("Duty"))),
                    selectInput('id1', 'Feed rate (m^3/h)', c("All", main$metric[1:3])),
                    selectInput('id2', 'Operation', c("All", main$metric[4:5])),
                  mainPanel(DT::dataTableOutput("table"))
                ))

And here's the screenshot:

enter image description here

like image 593
Misha Avatar asked Aug 31 '25 04:08

Misha


1 Answers

You can do this by adding your own style sheet to your Shiny app. First we give the sidebar panel a class sidebar so we can refer to it. Then we can add the following to a file www/style.css:

.sidebar label {
  font-weight: 400;
}

Finally we set the theme parameter of your fluidPage to "style.css".

ui <- fluidPage(theme="style.css", titlePanel(""),
   # content here
))

The result should look like this:

enter image description here

like image 105
Simon Larsen Avatar answered Sep 02 '25 16:09

Simon Larsen