New to Rshiny, bootstrapPage question

413 views
Skip to first unread message

elisabet...@gmail.com

unread,
Mar 15, 2017, 4:13:56 PM3/15/17
to Shiny - Web Framework for R
Hello all, 

Undergrad student here, I have decent knowledge of javaScript/Html/Css and web frameworks (albeit rusty) and most recently I use R quite a bit. Shiny is awesome. 

I have a question about the function bootstrapPage() I see that it allows me to make a custom bootstrap layout, but I'm confused on how to actually use the function to implement custom bootstrap. Does this require an HTML page and bootstrapPage() allows you to plug into that, OR is there special syntax that just goes directly in boostrapPage(). I see that fluidPage() is what is normally used, but I am just discovering/learning so I want to know how to use bootstrapPage(). 

Thank you!


Joe Cheng

unread,
Mar 15, 2017, 5:17:46 PM3/15/17
to elisabet...@gmail.com, Shiny - Web Framework for R
bootstrapPage() creates an empty container (not even a div tag, just a list of HTML tags which happens to have zero elements), with metadata attached to load the Bootstrap CSS and JS assets. If you want to stay in R for defining your UI, you can pass in any HTML objects as children of bootstrapPage.

bootstrapPage(
  tags$div(id = "mainContainer",
    "This is text in the main container"
  ),
  tags$button(class = "btn btn-primary", "Here's a button")
)

Note that when you define your UI in R, you shouldn't insert the outer <html> or <body> tags, those are implied.

You can also write raw HTML if you want, or combine raw HTML with R calls. It should all be described in the video "Shiny UI" by Garrett Grolemund, on this page:

--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/022645fc-9bc0-4158-aaca-c199e7d59a7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

elisabet...@gmail.com

unread,
Mar 15, 2017, 6:20:32 PM3/15/17
to Shiny - Web Framework for R
Thank you Joe, that makes sense!

PhiiForReal Kobe

unread,
Mar 14, 2018, 5:38:25 AM3/14/18
to Shiny - Web Framework for R
Hi Elisabeth. I am working on a project for R shiny that is going to require me to use bootstrapPage(). I am new to shiny so I am exactly where you were in terms of how I go about using the function. Have you managed to dig up more good examples for the function so far? if yes can you please share the links to those sites. I am looking for a step by step example on the subject. Thanks
Reply all
Reply to author
Forward
0 new messages