Search code examples
rshinypickerinput

How to change the pickerinput label to fine instead of bold


I am creating an app with shiny. When creating a label with pickerinput, it is in bold by default. Is it possible to change this to fine print?

If you know how to do it, or if you know a web page that can be used as a reference, please let me know.

Nice to meet you.

The sample code is below.

library(shiny)
library(leaflet)
library(leaflet.extras)

ui <- fluidPage(
  titlePanel("ShinyApp"),
  sidebarLayout(
    sidebarPanel(
        pickerInput(
        inputId = "Pick",
        label = "SampleSampleSample",
        choices = list(
          c("Sample"),
          Test_list = c("Test1", "Test2", "Test3")
        ),
        options = list(
          `actions-box` = TRUE,
          size = 7,
          `selected-text-format` = "count > 3"
        ),
        multiple = FALSE
      ),
    ),
    mainPanel(
    )
  )
)

server <- function(input, output, session) {}

shinyApp(ui, server)

Solution

  • Try the css code below. You can remove the color: red line from css.

    css <-"
    #expr-container label {
      font-weight: 400;
      color: red; 
    }
    "
    
    ui <- fluidPage(
      titlePanel("ShinyApp"),
      sidebarLayout(
        
        sidebarPanel(
          tags$style(css),
          tags$div(id = "expr-container", pickerInput(
            inputId = "Pick",
            label = "SampleSampleSample",
            choices = list(
              c("Sample"),
              Test_list = c("Test1", "Test2", "Test3")
            ),
            options = list(
              `actions-box` = TRUE,
              size = 7,
              `selected-text-format` = "count > 3"
            ),
            multiple = FALSE
          )),
        ),
        mainPanel(
        )
      )
    )
    
    server <- function(input, output, session) {}
    
    shinyApp(ui, server)
    

    output