I want to have a line break inside a renderText()
, but none of the ways I know work. This is a short, reproduceable (and dull) example:
library(shiny)
ui <- fluidPage(
textOutput("textOut")
)
server <- function(input, output) {
output$textOut <- renderText({
paste0("First line", "\nSecond Line", "<br>Third Line")
})
}
shinyApp(ui, server)
However, this gave me:
First line Second Line<br>Third Line
I've tried \n
, \br
, <br>
, </br>
, <\br
, <br><\br>
, etc. I've even tried using %>% lapply(htmltools::HTML)
, but nothing seems to work.
I want to avoid using renderHTML()
, but if it's the only way, then that's fine. Also, I do not want to make multiple renderText()
s – that really is a last-case scenario, because it's tedious, it consumes too many variable names and can't possibly be the optimal solution.