Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Shiny Dashboard Infobox over two lines

Tags:

r

shiny

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!

like image 240
user1357015 Avatar asked Jan 07 '23 00:01

user1357015


1 Answers

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())))
like image 138
Noah Pollock Avatar answered Jan 18 '23 21:01

Noah Pollock