Reputation: 13
I'm trying to print 2 lines of text in shinydashboard server section, and "\n" doesn't seem to work
output$textbox_ID <- renderText(
{
paste0("Apples \n Bananas")
}
)
Upvotes: 0
Views: 3654
Reputation: 13125
First of all \n
is unicode line break, for shiny you need HTML line break i.e. <br>
.
Here is a solution using renderUI
since I am not sure if it is possible to insert HTML tags in renderText
.
uiOutput('textbox_ID')
output$textbox_ID <- renderUI(
{
HTML(paste0("Apples",br()," Bananas"))
}
)
If you do not need to retrieve something from the server side, then you can use the following in the UI directly:
helpText( HTML(paste0("Apples",br()," Bananas")))
#OR
HTML("Apples <br> Bananas")
Upvotes: 4