Hi,
How can I retain line breaks that a user enters in a text box when I display it in a modal?
I have tried to replace the new line character with a break line character but this is getting rendered in the modal
Any pointers greatly appreciated
Thanks
Iain
library(shiny)
library(stringr)
shiny::shinyApp(
ui = basicPage(
textAreaInput("text","Text to appear in Modal"),
actionButton("show", "Show modal dialog")
),
server = function(input, output) {
observeEvent(input$show, {
showModal(modalDialog(
title = "Somewhat important message",
p(str_replace(input$text,"\n","<br/>")),
easyClose = TRUE,
footer = NULL
))
})
}
)