Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add new line to text in UI of shiny app

Tags:

r

shiny

is there a way to add a new line when putting text through the UI?

I currently have something like

mainPanel(
h3("This is my app!\n\n"),
h4("Download your data using the choose file button\n\n"),
h4("Thank you for using the app!")
)

but the new lines don't seem to be working.

like image 466
Getch Avatar asked Jul 15 '15 04:07

Getch


People also ask

How do you add text to a Shiny app?

You can use tahs$h1() to h6() to add headings, or add text using textOutput(). You can add text using text within quotes(" ").

What is UI and server in R Shiny?

Shiny Tutorial A simple shiny app is a directory containing two R scripts, one is ui. R , which controls the layout and appearance of your app, the other is server. R , which contains the instructions that your computer needs to build your app.


1 Answers

\n doesn't work in shiny app. For the new line, you could use HTML tag <br/>:

  mainPanel(
    HTML(
     paste(
      h3("This is my app!"),'<br/>',
      h4("Download your data using the choose file button"),'<br/>',
      h4("Thank you for using the app!")
     )
    )
  )
like image 187
M455y Avatar answered Sep 27 '22 01:09

M455y