Is It Possible To Have Fixed Width Verbatimtextoutput And Have Texts Change Lines In Shiny?
I have a simple app that uses verbatimTextOutput to display some texts. I am wondering if it is possible to have the width of verbatimTextOutput to be fixed and have the text outpu
Solution 1:
Please try the following css:
library(shiny)
ui <- function(request){
  fluidPage(
    tags$style(type='text/css', '#txt_out {white-space: pre-wrap;}'),
    column(
      width = 6,
      textInput(inputId = "txt", label = "Type in some texts",
                value = paste0(rep(letters, 10), collapse = "")),
      strong("Show the texts"),
      verbatimTextOutput("txt_out"),
      br(),
      bookmarkButton()
    )
  )
}
server <- function(input, output, session){
  output$txt_out <- renderText({
    input$txt
  })
}
enableBookmarking("url")
shinyApp(ui, server)
Post a Comment for "Is It Possible To Have Fixed Width Verbatimtextoutput And Have Texts Change Lines In Shiny?"