tinku tinku - 8 months ago 107
R Question

Change the color and font of text in Shiny App

I am using below code in

to display the text in the main panel. This is working exactly the way it should work.

output$text1 <- renderText({
if(input$ag == 0) return(NULL)
return('First 20 rows for requested AG')

Is there any way to change the font and color of the text?


You can use css as @jbaums indicated

  ui = bootstrapPage(
    numericInput('n', 'Number of obs', 100),
    tags$head(tags$style("#text1{color: red;
                                 font-size: 20px;
                                 font-style: italic;
  server = function(input, output) {
    output$text1 <- renderText({ paste("hello input is",input$n) })

Normally you would include this in a styles.css file but it is shown inline here to be self contained. #text1 refers to the DOM element with id=text1 and the contents of the curly brackets are the relevant styles.