Fisseha Berhane
Fisseha Berhane

Reputation: 2653

Change font size of text from a modal with multiple lines in shiny

I want to show some summary report in my modal window and it has multiple lines. How can I change the font of the text?

shinyApp(
ui = basicPage(
  actionButton("show", "Show modal dialog")
),
server = function(input, output) {
  observeEvent(input$show, {
    str1 = paste('iris data frame has ', nrow(iris), 'rows')
    str2 = paste('cars data frame has ', nrow(cars), 'rows')
    showModal(modalDialog(
      title = "Important message",
     renderUI(HTML(paste(str1, str2, sep = '<br/>')))
    ))
  })
}
)

Upvotes: 0

Views: 363

Answers (1)

St&#233;phane Laurent
St&#233;phane Laurent

Reputation: 84659

A possibility:

library(shiny)
shinyApp(
  ui = basicPage(
    actionButton("show", "Show modal dialog")
  ),
  server = function(input, output) {
    observeEvent(input$show, {
      str1 = tags$span(
        paste('iris data frame has ', nrow(iris), 'rows'),
        style = "font-size: 25px;"
      )
      str2 = tags$span(
        paste('cars data frame has ', nrow(cars), 'rows'),
        style = "font-size: 25px"
      )
      showModal(modalDialog(
        title = "Important message",
        tagList(str1, br(), str2)
      ))
    })
  }
)

Upvotes: 2

Related Questions