Hi all, I am somewhat new to Shiny development and have what is possibly a novice question. I am trying to wrap text output rendered with the textOutput() function in a UI file.
Why not use htmlOutput instead of textOutput? That should fix it and your text would look nicer as well. If you want to stick with textOutput you can use CSS
See example below:
library(shiny)
ui <- fluidPage(
tags$head(tags$style(HTML("pre { white-space: pre-wrap; word-break: keep-all; }"))),
textOutput("text")
)
server <- function(input, output) {
output$text <- renderPrint({
cat(paste0(rep("print a few words", 100), collapse = " "))
})
}
shinyApp(ui = ui, server = server)
Interestingly, this is the opposite of a question I just asked