Home > Enterprise >  Change Font Size in R Shiny Input Options (shinyjqui)
Change Font Size in R Shiny Input Options (shinyjqui)

Time:08-18

I'm trying to make the font size of the words on each button to be smaller (which would hopefully also shrink the overall button size for each option) but am struggling to find the right place to write the style = 'font-size: 5px' code. Where would I add that?

library(shiny)
library(shinyjqui)

server <- function(input, output) {
  output$order <- renderPrint({ print(input$dest) })
}

ui <- fluidPage(
  orderInput('source', 'Source', items = month.abb,
             as_source = TRUE, connect = 'dest'),
  orderInput('dest', 'Dest', items = NULL, placeholder = 'Drag items here...'),
  verbatimTextOutput('order')
)

shinyApp(ui, server)

CodePudding user response:

library(shiny)
library(shinyjqui)

server <- function(input, output) {
    output$order <- renderPrint({ print(input$dest) })
}

ui <- fluidPage(
    orderInput('source', 'Source', items = month.abb,
               as_source = TRUE, connect = 'dest'),
    orderInput('dest', 'Dest', items = NULL, placeholder = 'Drag items here...'),
    verbatimTextOutput('order'),
    tags$style(HTML(
        '
        .btn.shinyjqui {font-size: 5px}
        '
    ))
)

shinyApp(ui, server)

enter image description here

to also shrink the button

    tags$style(HTML(
        '
        .btn.shinyjqui {
            font-size: 5px;
            padding: 0;
        }
        
        '
    ))

enter image description here

  • Related