简体   繁体   中英

Parse HTML inside renderUI

Is there a way to parse HTML inside renderUI. I tried below code, but it is taking as character and not a HTML. Basically, "Next Line" should be displayed in the next line?

library(shiny)

ui <- fluidPage(
  uiOutput("text")
)

server <- function(input, output, session) {
  output$text <- renderUI({
    paste0("Filtered value are for ", as.character(br()),"Next line")
})
}

shinyApp(ui, server)

I'm not sure why you're using renderUI rather than renderText ...

library(shiny)

ui <- fluidPage(
  uiOutput("text")
)

server <- function(input, output, session) {
  output$text <- renderText({
    paste0("Filtered value are for ", br(),"Next line")
  })
}

shinyApp(ui, server)

Gives

在此处输入图像描述

If you do need to use renderUI ,

library(shiny)

ui <- fluidPage(
  uiOutput("text")
)

server <- function(input, output, session) {
  output$text <- renderUI({
    tagList("Filtered value are for ", br(),"Next line")
  })
}

shinyApp(ui, server)

gives the same result.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM