user1357015
user1357015

Reputation: 11676

R Shiny Dashboard Infobox over two lines

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!

Upvotes: 4

Views: 4849

Answers (1)

Noah Pollock
Noah Pollock

Reputation: 131

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())))

Upvotes: 13

Related Questions