1

In the following example, I have a numeric input. The font type of the label is bold (see the image). How can I make the font of the label as the same as plain text, like the one in "Here are some texts"?

library(shiny)

ui <- fluidPage(
  br(),
  "Here are some texts",
  br(),
  numericInput(inputId = "num1",
               label = "This is a numeric input",
               value = NA)
)

server <- function(input, output){
  
}

shinyApp(ui, server)

enter image description here

www
  • 38,575
  • 12
  • 48
  • 84

1 Answers1

8

Adding this line to your ui will remove the bold from labels:

tags$head(tags$style(HTML("label {font-weight:normal;}"))),

enter image description here


Added, we can wrap it in a div and give it a class:

tags$head(tags$style(HTML(".not_bold label {font-weight:normal;}"))),
    div(numericInput(inputId = "num1",
                 label = "This is a numeric input",
                 value = NA),class="not_bold")  
    ,numericInput(inputId = "num2",
                 label = "This is a numeric input too",
                 value = NA)

enter image description here

  • Thank you for the nice solution. I have upvoted your answer. I should have been more clear. There are other shiny widgets in my real-world example. For some reasons, I have to make the label of this one plain text. Your solution seems to make all labels plain. Would it be possible to just make a specific Shiny widget's label plain? – www Jun 03 '21 at 18:50
  • 1
    I have added to the answer to show how to change only the font-weight of a single class' labels –  Jun 03 '21 at 19:07