4

I want to have an infobox show text over two lines. For example, if I were to combine html and and shiny (like one does for the popups in leaflet):

output$myInfoBox <- renderInfoBox({infobox(paste("Output1: ", myout1, "<br>", "Output2: ", myout2, sep = ""))})

I've tried "<br>", "\n", etc. Nothing works.

Thanks!

user1357015
  • 11,168
  • 22
  • 66
  • 111
  • Does [this (possibly related) answer](http://stackoverflow.com/a/26368406/1167750) help? – summea Dec 11 '15 at 23:17
  • Possible duplicate of [how to insert new line in R shiny string](http://stackoverflow.com/questions/26368192/how-to-insert-new-line-in-r-shiny-string) – summea Dec 18 '15 at 18:14

1 Answers1

13

I was struggling with this as well. The solution I found is to use the shiny HTML() function which explicitly marks text as HTML to avoid escaping.

For example, if you execute infoBox("test_id",paste("test_value",br())) in the R console, you'll see that the break tag br() is escaped as &lt;br/&gt;. Thus, the solution is to specify that it is html.

infoBox("test_id",HTML(paste("test_value",br())))
Noah Pollock
  • 131
  • 1
  • 3