how to add multiple line breaks conveniently in shiny?

Viewed 5769

I want put multiple line breaks in my shiny app. Instead of

br(),
br(),
br(),
...

is there any more convenient way of doing it?Thanks.

1 Answers

I have no idea if that's convenient for you, but it saves you some typing.

linebreaks(n) repeats <br/> n times and parses it as HTML.

library(shiny)


linebreaks <- function(n){HTML(strrep(br(), n))}

ui <- fluidPage(

  titlePanel(
              p( 
                  h1("first sentence", align = "center"),

                  linebreaks(10),

                  h3("second sentence", align = "center")
                )
              )
  )

Related